Package org.geysermc.geyser.util
Class BlockUtils
java.lang.Object
org.geysermc.geyser.util.BlockUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanblockMatchesPredicate(GeyserSession session, BlockState state, org.geysermc.mcprotocollib.protocol.data.game.item.component.AdventureModePredicate.BlockPredicate predicate) static floatgetBlockMiningProgressPerTick(GeyserSession session, Block block, GeyserItemStack itemInHand) Returns the total mining progress added by mining the block in a single tick Mirrors mojmap BlockBehaviour#getDestroyProgressstatic org.cloudburstmc.math.vector.Vector3igetBlockPosition(org.cloudburstmc.math.vector.Vector3i blockPos, org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction face) Given a position, return the position if a block were located on the specified block face.static StringgetCleanIdentifier(String fullJavaIdentifier) Taking in a complete Java block state identifier, output just the block ID of this block state without the states.static BlockCollisiongetCollision(int blockId) static doublereciprocal(double progress) static voidrestoreCorrectBlock(GeyserSession session, org.cloudburstmc.math.vector.Vector3i blockPos) static voidrestoreCorrectBlock(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector, BlockState blockState) static voidsendBedrockBlockDestroy(GeyserSession session, org.cloudburstmc.math.vector.Vector3f vector, int blockState) static voidsendBedrockStopBlockBreak(GeyserSession session, org.cloudburstmc.math.vector.Vector3f vector) static voidspawnBlockBreakParticles(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction direction, org.cloudburstmc.math.vector.Vector3i position, BlockState blockState) static voidstopBreakAndRestoreBlock(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector, BlockState blockState)
-
Method Details
-
getBlockMiningProgressPerTick
public static float getBlockMiningProgressPerTick(GeyserSession session, Block block, GeyserItemStack itemInHand) Returns the total mining progress added by mining the block in a single tick Mirrors mojmap BlockBehaviour#getDestroyProgress- Returns:
- the mining progress added by this tick.
-
reciprocal
public static double reciprocal(double progress) -
getBlockPosition
public static org.cloudburstmc.math.vector.Vector3i getBlockPosition(org.cloudburstmc.math.vector.Vector3i blockPos, org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction face) Given a position, return the position if a block were located on the specified block face.- Parameters:
blockPos- the block positionface- the face of the block - seeDirection- Returns:
- the block position with the block face accounted for
-
getCleanIdentifier
Taking in a complete Java block state identifier, output just the block ID of this block state without the states. Examples: minecraft:oak_log[axis=x] = minecraft:oak_log minecraft:stone_brick_wall[east=low,north=tall,south=none,up=true,waterlogged=false,west=tall] = minecraft:stone_brick_wall minecraft:stone = minecraft:stone- Parameters:
fullJavaIdentifier- a full Java block identifier, with possible block states.- Returns:
- a clean identifier in the format of minecraft:block
-
getCollision
-
spawnBlockBreakParticles
public static void spawnBlockBreakParticles(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction direction, org.cloudburstmc.math.vector.Vector3i position, BlockState blockState) -
sendBedrockStopBlockBreak
public static void sendBedrockStopBlockBreak(GeyserSession session, org.cloudburstmc.math.vector.Vector3f vector) -
sendBedrockBlockDestroy
public static void sendBedrockBlockDestroy(GeyserSession session, org.cloudburstmc.math.vector.Vector3f vector, int blockState) -
restoreCorrectBlock
public static void restoreCorrectBlock(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector, BlockState blockState) -
restoreCorrectBlock
public static void restoreCorrectBlock(GeyserSession session, org.cloudburstmc.math.vector.Vector3i blockPos) -
stopBreakAndRestoreBlock
public static void stopBreakAndRestoreBlock(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector, BlockState blockState) -
blockMatchesPredicate
public static boolean blockMatchesPredicate(GeyserSession session, BlockState state, org.geysermc.mcprotocollib.protocol.data.game.item.component.AdventureModePredicate.BlockPredicate predicate)
-