Package org.geysermc.geyser.level.block
Class BlockStateValues
java.lang.Object
org.geysermc.geyser.level.block.BlockStateValues
Used for block entities if the Java block state contains Bedrock block information.
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
static int
static int
static int
static int
static int
static int
static int
static int
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canPistonDestroyBlock(int state)
static boolean
canPistonMoveBlock(int javaId, boolean isPushing)
static int
getBannerColor(int state)
Banner colors are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock.static byte
getBedColor(int state)
Bed colors are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock.static it.unimi.dsi.fastutil.ints.Int2ByteMap
The block state in Java and Bedrock both contain the conditional bit, however command block block entity tags in Bedrock need the conditional information.static it.unimi.dsi.fastutil.ints.Int2ObjectMap<DoubleChestValue>
All double chest values are part of the block state in Java and part of the block entity tag in Bedrock.static it.unimi.dsi.fastutil.ints.Int2ObjectMap<String>
Get the Int2ObjectMap of flower pot block states to containing plantstatic LecternHasBookMap
static int
getNoteblockPitch(int state)
The note that noteblocks output when hit is part of the block state in Java but sent as a BlockEventPacket in Bedrock.static int
getPistonHead(Direction direction)
Get the Java Block State for a piston head for a specific direction This is used in PistonBlockEntity to get the BlockCollision for the piston head.static Direction
getPistonOrientation(int state)
This is used in GeyserPistonEvents.java and accepts minecraft:piston, minecraft:sticky_piston, and minecraft:moving_piston.static it.unimi.dsi.fastutil.ints.Int2BooleanMap
Get the Int2BooleanMap showing if a piston block state is extended or not.static byte
getShulkerBoxDirection(int state)
Shulker box directions are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock.static byte
getSkullRotation(int state)
Skull rotations are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock.static byte
getSkullVariant(int state)
Skull variations are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock.static it.unimi.dsi.fastutil.ints.Int2IntMap
Skull rotations are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock.static float
getSlipperiness(int state)
Get the slipperiness of a block.static int
getWaterLevel(int state)
Get the level of water from the block state.static boolean
isBlockAttached(int stateA, int stateB)
Check if two blocks are attached to each other.static boolean
isBlockSticky(int state)
Checks if a block sticks to other blocks (Slime and honey blocks)static boolean
isMovingPiston(int state)
Check if a block is a minecraft:moving_piston This is used in ChunkUtils to prevent them from being placed as it causes pistons to flicker and it is not neededstatic boolean
isPistonHead(int state)
static boolean
isStickyPiston(int blockState)
static void
storeBlockStateValues(String javaId, int javaBlockState, com.fasterxml.jackson.databind.JsonNode blockData)
Determines if the block state contains Bedrock block information
-
Field Details
-
JAVA_AIR_ID
public static final int JAVA_AIR_ID- See Also:
- Constant Field Values
-
JAVA_BELL_ID
public static int JAVA_BELL_ID -
JAVA_COBWEB_ID
public static int JAVA_COBWEB_ID -
JAVA_FURNACE_ID
public static int JAVA_FURNACE_ID -
JAVA_FURNACE_LIT_ID
public static int JAVA_FURNACE_LIT_ID -
JAVA_HONEY_BLOCK_ID
public static int JAVA_HONEY_BLOCK_ID -
JAVA_SLIME_BLOCK_ID
public static int JAVA_SLIME_BLOCK_ID -
JAVA_SPAWNER_ID
public static int JAVA_SPAWNER_ID -
JAVA_WATER_ID
public static int JAVA_WATER_ID
-
-
Method Details
-
storeBlockStateValues
public static void storeBlockStateValues(String javaId, int javaBlockState, com.fasterxml.jackson.databind.JsonNode blockData)Determines if the block state contains Bedrock block information- Parameters:
javaId
- The Java Identifier of the blockjavaBlockState
- the Java Block State of the blockblockData
- JsonNode of info about the block from blocks.json
-
getBannerColor
public static int getBannerColor(int state)Banner colors are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock. This gives an integer color that Bedrock can use.- Parameters:
state
- BlockState of the block- Returns:
- Banner color integer or -1 if no color
-
getBedColor
public static byte getBedColor(int state)Bed colors are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock. This gives a byte color that Bedrock can use - Bedrock needs a byte in the final tag.- Parameters:
state
- BlockState of the block- Returns:
- Bed color byte or -1 if no color
-
getCommandBlockValues
public static it.unimi.dsi.fastutil.ints.Int2ByteMap getCommandBlockValues()The block state in Java and Bedrock both contain the conditional bit, however command block block entity tags in Bedrock need the conditional information.- Returns:
- the list of all command blocks and if they are conditional (1 or 0)
-
getDoubleChestValues
All double chest values are part of the block state in Java and part of the block entity tag in Bedrock. This gives the DoubleChestValue that can be calculated into the final tag.- Returns:
- The map of all DoubleChestValues.
-
getFlowerPotValues
Get the Int2ObjectMap of flower pot block states to containing plant- Returns:
- Int2ObjectMap of flower pot values
-
getLecternBookStates
- Returns:
- the lectern book state map pointing to book present state
-
getNoteblockPitch
public static int getNoteblockPitch(int state)The note that noteblocks output when hit is part of the block state in Java but sent as a BlockEventPacket in Bedrock. This gives an integer pitch that Bedrock can use.- Parameters:
state
- BlockState of the block- Returns:
- note block note integer or -1 if not present
-
getPistonValues
public static it.unimi.dsi.fastutil.ints.Int2BooleanMap getPistonValues()Get the Int2BooleanMap showing if a piston block state is extended or not.- Returns:
- the Int2BooleanMap of piston extensions.
-
isStickyPiston
public static boolean isStickyPiston(int blockState) -
isPistonHead
public static boolean isPistonHead(int state) -
getPistonHead
Get the Java Block State for a piston head for a specific direction This is used in PistonBlockEntity to get the BlockCollision for the piston head.- Parameters:
direction
- Direction the piston head points in- Returns:
- Block state for the piston head
-
isMovingPiston
public static boolean isMovingPiston(int state)Check if a block is a minecraft:moving_piston This is used in ChunkUtils to prevent them from being placed as it causes pistons to flicker and it is not needed- Parameters:
state
- Block state of the block- Returns:
- True if the block is a moving_piston
-
getPistonOrientation
This is used in GeyserPistonEvents.java and accepts minecraft:piston, minecraft:sticky_piston, and minecraft:moving_piston.- Parameters:
state
- The block state of the piston base- Returns:
- The direction in which the piston faces
-
isBlockSticky
public static boolean isBlockSticky(int state)Checks if a block sticks to other blocks (Slime and honey blocks)- Parameters:
state
- The block state- Returns:
- True if the block sticks to adjacent blocks
-
isBlockAttached
public static boolean isBlockAttached(int stateA, int stateB)Check if two blocks are attached to each other.- Parameters:
stateA
- The block state of block astateB
- The block state of block b- Returns:
- True if the blocks are attached to each other
-
canPistonDestroyBlock
public static boolean canPistonDestroyBlock(int state)- Parameters:
state
- The block state of the block- Returns:
- true if a piston can break the block
-
canPistonMoveBlock
public static boolean canPistonMoveBlock(int javaId, boolean isPushing) -
getSkullVariant
public static byte getSkullVariant(int state)Skull variations are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock. This gives a byte variant ID that Bedrock can use.- Parameters:
state
- BlockState of the block- Returns:
- Skull variant byte or -1 if no variant
-
getSkullRotation
public static byte getSkullRotation(int state)Skull rotations are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock. This gives a byte rotation that Bedrock can use.- Parameters:
state
- BlockState of the block- Returns:
- Skull rotation value or -1 if no value
-
getSkullWallDirections
public static it.unimi.dsi.fastutil.ints.Int2IntMap getSkullWallDirections()Skull rotations are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock. This gives a integer rotation that Bedrock can use.- Returns:
- Skull wall rotation value with the blockstate
-
getShulkerBoxDirection
public static byte getShulkerBoxDirection(int state)Shulker box directions are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock. This gives a byte direction that Bedrock can use.- Parameters:
state
- BlockState of the block- Returns:
- Shulker direction value or -1 if no value
-
getWaterLevel
public static int getWaterLevel(int state)Get the level of water from the block state. This is used in FishingHookEntity to create splash sounds when the hook hits the water.- Parameters:
state
- BlockState of the block- Returns:
- The water level or -1 if the block isn't water
-
getSlipperiness
public static float getSlipperiness(int state)Get the slipperiness of a block. This is used in ItemEntity to calculate the friction on an item as it slides across the ground- Parameters:
state
- BlockState of the block- Returns:
- The block's slipperiness
-