Package org.bukkit.block.data
Interface BlockData
-
- All Superinterfaces:
Cloneable
- All Known Subinterfaces:
Ageable
,AnaloguePowerable
,Attachable
,Bed
,Bisected
,BrewingStand
,BubbleColumn
,Cake
,Chest
,Cocoa
,CommandBlock
,Comparator
,CoralWallFan
,DaylightDetector
,Directional
,Dispenser
,Door
,EnderChest
,EndPortalFrame
,Farmland
,Fence
,Fire
,Furnace
,Gate
,GlassPane
,Hopper
,Jukebox
,Ladder
,Leaves
,Levelled
,Lightable
,MultipleFacing
,NoteBlock
,Observer
,Openable
,Orientable
,Piston
,PistonHead
,Powerable
,Rail
,RedstoneRail
,RedstoneWallTorch
,RedstoneWire
,Repeater
,Rotatable
,Sapling
,SeaPickle
,Sign
,Slab
,Snow
,Snowable
,Stairs
,StructureBlock
,Switch
,TechnicalPiston
,TNT
,TrapDoor
,Tripwire
,TripwireHook
,TurtleEgg
,WallSign
,Waterlogged
public interface BlockData extends Cloneable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BlockData
clone()
Returns a copy of this BlockData.String
getAsString()
Gets a string, which when passed into a method such asServer.createBlockData(java.lang.String)
will unambiguously recreate this instance.Material
getMaterial()
Get the Material represented by this block data.boolean
matches(BlockData data)
Checks if the specified BlockData matches this block data.BlockData
merge(BlockData data)
Merges all explicitly set states from the given data with this BlockData.
-
-
-
Method Detail
-
getMaterial
Material getMaterial()
Get the Material represented by this block data.- Returns:
- the material
-
getAsString
String getAsString()
Gets a string, which when passed into a method such asServer.createBlockData(java.lang.String)
will unambiguously recreate this instance.- Returns:
- serialized data string for this block
-
merge
BlockData merge(BlockData data)
Merges all explicitly set states from the given data with this BlockData.
Note that the given data MUST have been created from one of the String parse methods, e.g.Server.createBlockData(java.lang.String)
and not have been subsequently modified.
Note also that the block types must match identically.- Parameters:
data
- the data to merge from- Returns:
- a new instance of this blockdata with the merged data
-
matches
boolean matches(BlockData data)
Checks if the specified BlockData matches this block data.
The semantics of this method are such that for manually created or modified BlockData it has the same effect asObject.equals(java.lang.Object)
, whilst for parsed data (that to whichmerge(org.bukkit.block.data.BlockData)
applies, it will return true when the type and all explicitly set states match.
Note that these semantics mean that a.matches(b) may not be the same as b.matches(a)- Parameters:
data
- the data to match against (normally a parsed constant)- Returns:
- if there is a match
-
clone
BlockData clone()
Returns a copy of this BlockData.- Returns:
- a copy of the block data
-
-