Contents
- Description
- Field Summary
- Method Summary
- Field Details
- Method Details
- block(int)
- block(int, int)
- fluid(int, byte)
- full(int, int, int, int, Holder)
- full(int, int, int, int, Holder, int, byte)
- fromKey(String)
- isFluid()
- isBlock()
- isEmpty()
- getBlockId()
- getFluidId()
- getFluidLevel()
- getRotation()
- hasRotation()
- getSupport()
- getFiller()
- getHolder()
- toString()
- equals(Object)
- hashCode()
- fromPattern(BlockPattern, Random)
Class Material
java.lang.Object
com.hypixel.hytale.builtin.buildertools.utils.Material
Represents a material that can be either a block type, a fluid, or empty.
This abstraction allows builder tools to handle blocks and fluids uniformly, reducing code duplication in commands and operations.
Materials can optionally include rotation information for blocks.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Materialblock(int blockId) Creates a material representing a block type.static Materialblock(int blockId, int rotation) Creates a material representing a block type with rotation.booleanstatic Materialfluid(int fluidId, byte fluidLevel) Creates a material representing a fluid.static MaterialParses a material from a key string.static MaterialfromPattern(BlockPattern pattern, Random random) Gets the next material from a BlockPattern.static Materialfull(int blockId, int rotation, int support, int filler, Holder<ChunkStore> holder) static Materialfull(int blockId, int rotation, int support, int filler, Holder<ChunkStore> holder, int fluidId, byte fluidLevel) intintintbyteintintinthashCode()booleanbooleanisBlock()booleanisEmpty()booleanisFluid()toString()
-
Field Details
-
EMPTY
Empty material - represents clearing both block and fluid.
-
-
Method Details
-
block
Creates a material representing a block type.- Parameters:
blockId- the block type ID- Returns:
- the material
-
block
Creates a material representing a block type with rotation.- Parameters:
blockId- the block type IDrotation- the rotation tuple index- Returns:
- the material
-
fluid
Creates a material representing a fluid.- Parameters:
fluidId- the fluid IDfluidLevel- the fluid level- Returns:
- the material
-
full
@Nonnull public static Material full(int blockId, int rotation, int support, int filler, @Nullable Holder<ChunkStore> holder) -
full
@Nonnull public static Material full(int blockId, int rotation, int support, int filler, @Nullable Holder<ChunkStore> holder, int fluidId, byte fluidLevel) -
fromKey
Parses a material from a key string.Supports rotation syntax: "Rock_Stone|Yaw=90|Pitch=45"
First checks if the key is a fluid-placing item (has PlaceFluidInteraction), then falls back to checking if it's a block type.
- Parameters:
key- the material key (e.g., "Rock_Stone", "Rock_Stone|Yaw=90", "Fluid_Water", "empty")- Returns:
- the material, or null if the key is invalid
-
isFluid
public boolean isFluid()- Returns:
- true if this material represents a fluid (not a block)
-
isBlock
public boolean isBlock()- Returns:
- true if this material represents a block (not a fluid)
-
isEmpty
public boolean isEmpty()- Returns:
- true if this material represents empty (clears both block and fluid)
-
getBlockId
public int getBlockId()- Returns:
- the block type ID, or EMPTY_ID if this is a fluid material
-
getFluidId
public int getFluidId()- Returns:
- the fluid ID, or EMPTY_ID if this is a block material
-
getFluidLevel
public byte getFluidLevel()- Returns:
- the fluid level, or 0 if this is a block material
-
getRotation
public int getRotation()- Returns:
- the rotation tuple index for this material
-
hasRotation
public boolean hasRotation()- Returns:
- true if this material has a non-default rotation
-
getSupport
public int getSupport() -
getFiller
public int getFiller() -
getHolder
-
toString
-
equals
-
hashCode
-
fromPattern
Gets the next material from a BlockPattern.This checks if the pattern's block type corresponds to a fluid item and returns the appropriate Material. Rotation information from the pattern is preserved for blocks.
- Parameters:
pattern- the block pattern to get material fromrandom- the random instance for weighted selection- Returns:
- the next material from the pattern
-