接口 Block
- 所有超级接口:
Metadatable
-
方法概要
修饰符和类型方法说明boolean
Breaks the block and spawns items as if a player had digged itboolean
breakNaturally
(ItemStack tool) Breaks the block and spawns items as if a player had digged it with a specific toolgetBiome()
Returns the biome that this block resides inint
Returns the redstone power being provided to this blockint
getBlockPower
(BlockFace face) Returns the redstone power being provided to this block facegetChunk()
获取包含此方块的区块(方块所在的区块).byte
getData()
已过时。不安全的参数getDrops()
Returns a list of items which would drop by destroying this blockReturns a list of items which would drop by destroying this block with a specific toolGets the face relation of this block compared to the given block.double
Gets the humidity of the biome of this blockbyte
Get the amount of light at this block from nearby blocks.byte
Get the amount of light at this block from the sky.byte
获取此方块的光亮等级,范围0~15.获取方块的位置信息.getLocation
(Location loc) Stores the location of the block in the provided Location object.Returns the reaction of the block when moved by a pistongetRelative
(int modX, int modY, int modZ) 以指定坐标偏移量获取方块 (相对与方块位置的偏移量).getRelative
(BlockFace face) Gets the block at the given facegetRelative
(BlockFace face, int distance) Gets the block at the given distance of the given facegetState()
Captures the current state of this block.double
Gets the temperature of the biome of this blockgetType()
获取此方块的种类.int
已过时。不安全的参数getWorld()
获取此方块所处的世界.int
getX()
获取此方块的X坐标.int
getY()
获取此方块的Y坐标.int
getZ()
获取此方块的Z坐标.boolean
Returns true if the block face is being indirectly powered by Redstone.boolean
isBlockFacePowered
(BlockFace face) Returns true if the block face is being powered by Redstone.boolean
Returns true if the block is being indirectly powered by Redstone.boolean
Returns true if the block is being powered by Redstone.boolean
isEmpty()
Checks if this block is empty.boolean
isLiquid()
Checks if this block is liquid.void
Sets the biome that this block resides invoid
setData
(byte data) 已过时。不安全的参数void
setData
(byte data, boolean applyPhysics) 已过时。不安全的参数void
设置这个方块的类型.void
Sets the type of this blockboolean
setTypeId
(int type) 已过时。Magic valueboolean
setTypeId
(int type, boolean applyPhysics) 已过时。Magic valueboolean
setTypeIdAndData
(int type, byte data, boolean applyPhysics) 已过时。Magic value从接口继承的方法 org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
-
方法详细资料
-
getData
已过时。不安全的参数获取此方块的元数据.原文:Gets the metadata for this block
- 返回:
- 方块元数据
-
getRelative
以指定坐标偏移量获取方块 (相对与方块位置的偏移量).原文:Gets the block at the given offsets
- 参数:
modX
- X坐标偏移量modY
- Y坐标偏移量modZ
- Z坐标偏移量- 返回:
- 在此坐标偏移量的方块
-
getRelative
Gets the block at the given faceThis method is equal to getRelative(face, 1)
- 参数:
face
- Face of this block to return- 返回:
- Block at the given face
- 另请参阅:
-
getRelative
Gets the block at the given distance of the given faceFor example, the following method places water at 100,102,100; two blocks above 100,100,100.
Block block = world.getBlockAt(100, 100, 100); Block shower = block.getRelative(BlockFace.UP, 2); shower.setType(Material.WATER);
- 参数:
face
- Face of this block to returndistance
- Distance to get the block at- 返回:
- Block at the given face
-
getType
Material getType()获取此方块的种类.原文:Gets the type of this block
- 返回:
- 方块种类
-
getTypeId
已过时。不安全的参数获取此方块的种类ID.原文:Gets the type-id of this block
- 返回:
- 方块种类ID
-
getLightLevel
byte getLightLevel()获取此方块的光亮等级,范围0~15.原文:Gets the light level between 0-15
- 返回:
- 光亮等级
-
getLightFromSky
byte getLightFromSky()Get the amount of light at this block from the sky.Any light given from other sources (such as blocks like torches) will be ignored.
- 返回:
- Sky light level
-
getLightFromBlocks
byte getLightFromBlocks()Get the amount of light at this block from nearby blocks.Any light given from other sources (such as the sun) will be ignored.
- 返回:
- Block light level
-
getWorld
World getWorld()获取此方块所处的世界.原文:Gets the world which contains this Block
- 返回:
- 方块所处的世界
-
getX
int getX()获取此方块的X坐标.原文:Gets the x-coordinate of this block
- 返回:
- X坐标
-
getY
int getY()获取此方块的Y坐标.原文:Gets the y-coordinate of this block
- 返回:
- Y坐标
-
getZ
int getZ()获取此方块的Z坐标.原文:Gets the z-coordinate of this block
- 返回:
- Z坐标
-
getLocation
Location getLocation()获取方块的位置信息.原文:Gets the Location of the block
- 返回:
- 方块的位置
-
getLocation
Stores the location of the block in the provided Location object.If the provided Location is null this method does nothing and returns null.
- 参数:
loc
- the location to copy into- 返回:
- The Location object provided or null
-
getChunk
Chunk getChunk()获取包含此方块的区块(方块所在的区块).原文:Gets the chunk which contains this block
- 返回:
- 包含此方块的区块
-
setData
已过时。不安全的参数为这个方块设置元数据.原文:Sets the metadata for this block
- 参数:
data
- 元数据
-
setData
已过时。不安全的参数为这个方块设置元数据.原文:Sets the metadata for this block
- 参数:
data
- 元数据applyPhysics
- False to cancel physics from the changed block.
-
setType
设置这个方块的类型.原文:Sets the type of this block
- 参数:
type
- 方块的Material类型
-
setType
Sets the type of this block- 参数:
type
- Material to change this block toapplyPhysics
- False to cancel physics on the changed block.
-
setTypeId
已过时。Magic valueSets the type-id of this block- 参数:
type
- Type-Id to change this block to- 返回:
- whether the block was changed
-
setTypeId
已过时。Magic valueSets the type-id of this block- 参数:
type
- Type-Id to change this block toapplyPhysics
- False to cancel physics on the changed block.- 返回:
- whether the block was changed
-
setTypeIdAndData
已过时。Magic valueSets the type-id of this block- 参数:
type
- Type-Id to change this block todata
- The data value to change this block toapplyPhysics
- False to cancel physics on the changed block- 返回:
- whether the block was changed
-
getFace
Gets the face relation of this block compared to the given block.For example:
Block current = world.getBlockAt(100, 100, 100); Block target = world.getBlockAt(100, 101, 100); current.getFace(target) == BlockFace.Up;
If the given block is not connected to this block, null may be returned- 参数:
block
- Block to compare against this block- 返回:
- BlockFace of this block which has the requested block, or null
-
getState
BlockState getState()Captures the current state of this block. You may then cast that state into any accepted type, such as Furnace or Sign.The returned object will never be updated, and you are not guaranteed that (for example) a sign is still a sign after you capture its state.
- 返回:
- BlockState with the current state of this block.
-
getBiome
Biome getBiome()Returns the biome that this block resides in- 返回:
- Biome type containing this block
-
setBiome
Sets the biome that this block resides in- 参数:
bio
- new Biome type for this block
-
isBlockPowered
boolean isBlockPowered()Returns true if the block is being powered by Redstone.- 返回:
- True if the block is powered.
-
isBlockIndirectlyPowered
boolean isBlockIndirectlyPowered()Returns true if the block is being indirectly powered by Redstone.- 返回:
- True if the block is indirectly powered.
-
isBlockFacePowered
Returns true if the block face is being powered by Redstone.- 参数:
face
- The block face- 返回:
- True if the block face is powered.
-
isBlockFaceIndirectlyPowered
Returns true if the block face is being indirectly powered by Redstone.- 参数:
face
- The block face- 返回:
- True if the block face is indirectly powered.
-
getBlockPower
Returns the redstone power being provided to this block face- 参数:
face
- the face of the block to query or BlockFace.SELF for the block itself- 返回:
- The power level.
-
getBlockPower
int getBlockPower()Returns the redstone power being provided to this block- 返回:
- The power level.
-
isEmpty
boolean isEmpty()Checks if this block is empty.A block is considered empty when
getType()
returnsMaterial.AIR
.- 返回:
- true if this block is empty
-
isLiquid
boolean isLiquid()Checks if this block is liquid.A block is considered liquid when
getType()
returnsMaterial.WATER
,Material.STATIONARY_WATER
,Material.LAVA
orMaterial.STATIONARY_LAVA
.- 返回:
- true if this block is liquid
-
getTemperature
double getTemperature()Gets the temperature of the biome of this block- 返回:
- Temperature of this block
-
getHumidity
double getHumidity()Gets the humidity of the biome of this block- 返回:
- Humidity of this block
-
getPistonMoveReaction
PistonMoveReaction getPistonMoveReaction()Returns the reaction of the block when moved by a piston- 返回:
- reaction
-
breakNaturally
boolean breakNaturally()Breaks the block and spawns items as if a player had digged it- 返回:
- true if the block was destroyed
-
breakNaturally
Breaks the block and spawns items as if a player had digged it with a specific tool- 参数:
tool
- The tool or item in hand used for digging- 返回:
- true if the block was destroyed
-
getDrops
Collection<ItemStack> getDrops()Returns a list of items which would drop by destroying this block- 返回:
- a list of dropped items for this type of block
-
getDrops
Returns a list of items which would drop by destroying this block with a specific tool- 参数:
tool
- The tool or item in hand used for digging- 返回:
- a list of dropped items for this type of block
-