mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Proper block entity checks; ignore invalid block entity data sent by Java server
This commit is contained in:
parent
77fa37ff82
commit
2827e48cc8
24 changed files with 248 additions and 92 deletions
|
|
@ -408,34 +408,34 @@ public final class Blocks {
|
|||
public static final Block FURNACE = register(new FurnaceBlock("furnace", builder().setBlockEntity().requiresCorrectToolForDrops().destroyTime(3.5f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(LIT)));
|
||||
public static final Block OAK_SIGN = register(new Block("oak_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block OAK_SIGN = register(new SignBlock("oak_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block SPRUCE_SIGN = register(new Block("spruce_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block SPRUCE_SIGN = register(new SignBlock("spruce_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block BIRCH_SIGN = register(new Block("birch_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block BIRCH_SIGN = register(new SignBlock("birch_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block ACACIA_SIGN = register(new Block("acacia_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block ACACIA_SIGN = register(new SignBlock("acacia_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block CHERRY_SIGN = register(new Block("cherry_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block CHERRY_SIGN = register(new SignBlock("cherry_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block JUNGLE_SIGN = register(new Block("jungle_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block JUNGLE_SIGN = register(new SignBlock("jungle_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block DARK_OAK_SIGN = register(new Block("dark_oak_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block DARK_OAK_SIGN = register(new SignBlock("dark_oak_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block MANGROVE_SIGN = register(new Block("mangrove_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block MANGROVE_SIGN = register(new SignBlock("mangrove_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block BAMBOO_SIGN = register(new Block("bamboo_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block BAMBOO_SIGN = register(new SignBlock("bamboo_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block OAK_DOOR = register(new DoorBlock("oak_door", builder().destroyTime(3.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block OAK_DOOR = register(new SignBlock("oak_door", builder().destroyTime(3.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.enumState(DOUBLE_BLOCK_HALF)
|
||||
.enumState(DOOR_HINGE)
|
||||
|
|
@ -452,108 +452,108 @@ public final class Blocks {
|
|||
.enumState(HALF)
|
||||
.enumState(STAIRS_SHAPE)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block OAK_WALL_SIGN = register(new Block("oak_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block OAK_WALL_SIGN = register(new SignBlock("oak_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block SPRUCE_WALL_SIGN = register(new Block("spruce_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block SPRUCE_WALL_SIGN = register(new SignBlock("spruce_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block BIRCH_WALL_SIGN = register(new Block("birch_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block BIRCH_WALL_SIGN = register(new SignBlock("birch_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block ACACIA_WALL_SIGN = register(new Block("acacia_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block ACACIA_WALL_SIGN = register(new SignBlock("acacia_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block CHERRY_WALL_SIGN = register(new Block("cherry_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block CHERRY_WALL_SIGN = register(new SignBlock("cherry_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block JUNGLE_WALL_SIGN = register(new Block("jungle_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block JUNGLE_WALL_SIGN = register(new SignBlock("jungle_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block DARK_OAK_WALL_SIGN = register(new Block("dark_oak_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block DARK_OAK_WALL_SIGN = register(new SignBlock("dark_oak_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block MANGROVE_WALL_SIGN = register(new Block("mangrove_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block MANGROVE_WALL_SIGN = register(new SignBlock("mangrove_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block BAMBOO_WALL_SIGN = register(new Block("bamboo_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block BAMBOO_WALL_SIGN = register(new SignBlock("bamboo_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block OAK_HANGING_SIGN = register(new Block("oak_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block OAK_HANGING_SIGN = register(new SignBlock("oak_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block SPRUCE_HANGING_SIGN = register(new Block("spruce_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block SPRUCE_HANGING_SIGN = register(new SignBlock("spruce_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block BIRCH_HANGING_SIGN = register(new Block("birch_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block BIRCH_HANGING_SIGN = register(new SignBlock("birch_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block ACACIA_HANGING_SIGN = register(new Block("acacia_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block ACACIA_HANGING_SIGN = register(new SignBlock("acacia_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block CHERRY_HANGING_SIGN = register(new Block("cherry_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block CHERRY_HANGING_SIGN = register(new SignBlock("cherry_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block JUNGLE_HANGING_SIGN = register(new Block("jungle_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block JUNGLE_HANGING_SIGN = register(new SignBlock("jungle_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block DARK_OAK_HANGING_SIGN = register(new Block("dark_oak_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block DARK_OAK_HANGING_SIGN = register(new SignBlock("dark_oak_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block CRIMSON_HANGING_SIGN = register(new Block("crimson_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block CRIMSON_HANGING_SIGN = register(new SignBlock("crimson_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block WARPED_HANGING_SIGN = register(new Block("warped_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block WARPED_HANGING_SIGN = register(new SignBlock("warped_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block MANGROVE_HANGING_SIGN = register(new Block("mangrove_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block MANGROVE_HANGING_SIGN = register(new SignBlock("mangrove_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block BAMBOO_HANGING_SIGN = register(new Block("bamboo_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block BAMBOO_HANGING_SIGN = register(new SignBlock("bamboo_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.booleanState(ATTACHED)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block OAK_WALL_HANGING_SIGN = register(new Block("oak_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block OAK_WALL_HANGING_SIGN = register(new SignBlock("oak_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block SPRUCE_WALL_HANGING_SIGN = register(new Block("spruce_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block SPRUCE_WALL_HANGING_SIGN = register(new SignBlock("spruce_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block BIRCH_WALL_HANGING_SIGN = register(new Block("birch_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block BIRCH_WALL_HANGING_SIGN = register(new SignBlock("birch_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block ACACIA_WALL_HANGING_SIGN = register(new Block("acacia_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block ACACIA_WALL_HANGING_SIGN = register(new SignBlock("acacia_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block CHERRY_WALL_HANGING_SIGN = register(new Block("cherry_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block CHERRY_WALL_HANGING_SIGN = register(new SignBlock("cherry_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block JUNGLE_WALL_HANGING_SIGN = register(new Block("jungle_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block JUNGLE_WALL_HANGING_SIGN = register(new SignBlock("jungle_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block DARK_OAK_WALL_HANGING_SIGN = register(new Block("dark_oak_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block DARK_OAK_WALL_HANGING_SIGN = register(new SignBlock("dark_oak_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block MANGROVE_WALL_HANGING_SIGN = register(new Block("mangrove_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block MANGROVE_WALL_HANGING_SIGN = register(new SignBlock("mangrove_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block CRIMSON_WALL_HANGING_SIGN = register(new Block("crimson_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block CRIMSON_WALL_HANGING_SIGN = register(new SignBlock("crimson_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block WARPED_WALL_HANGING_SIGN = register(new Block("warped_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block WARPED_WALL_HANGING_SIGN = register(new SignBlock("warped_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block BAMBOO_WALL_HANGING_SIGN = register(new Block("bamboo_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block BAMBOO_WALL_HANGING_SIGN = register(new SignBlock("bamboo_wall_hanging_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block LEVER = register(new Block("lever", builder().destroyTime(0.5f).pushReaction(PistonBehavior.DESTROY)
|
||||
|
|
@ -1596,39 +1596,39 @@ public final class Blocks {
|
|||
public static final Block OBSERVER = register(new Block("observer", builder().requiresCorrectToolForDrops().destroyTime(3.0f)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)
|
||||
.booleanState(POWERED)));
|
||||
public static final Block SHULKER_BOX = register(new Block("shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block SHULKER_BOX = register(new ShulkerBoxBlock("shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block WHITE_SHULKER_BOX = register(new Block("white_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block WHITE_SHULKER_BOX = register(new ShulkerBoxBlock("white_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block ORANGE_SHULKER_BOX = register(new Block("orange_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block ORANGE_SHULKER_BOX = register(new ShulkerBoxBlock("orange_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block MAGENTA_SHULKER_BOX = register(new Block("magenta_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block MAGENTA_SHULKER_BOX = register(new ShulkerBoxBlock("magenta_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block LIGHT_BLUE_SHULKER_BOX = register(new Block("light_blue_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block LIGHT_BLUE_SHULKER_BOX = register(new ShulkerBoxBlock("light_blue_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block YELLOW_SHULKER_BOX = register(new Block("yellow_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block YELLOW_SHULKER_BOX = register(new ShulkerBoxBlock("yellow_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block LIME_SHULKER_BOX = register(new Block("lime_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block LIME_SHULKER_BOX = register(new ShulkerBoxBlock("lime_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block PINK_SHULKER_BOX = register(new Block("pink_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block PINK_SHULKER_BOX = register(new ShulkerBoxBlock("pink_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block GRAY_SHULKER_BOX = register(new Block("gray_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block GRAY_SHULKER_BOX = register(new ShulkerBoxBlock("gray_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block LIGHT_GRAY_SHULKER_BOX = register(new Block("light_gray_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block LIGHT_GRAY_SHULKER_BOX = register(new ShulkerBoxBlock("light_gray_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block CYAN_SHULKER_BOX = register(new Block("cyan_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block CYAN_SHULKER_BOX = register(new ShulkerBoxBlock("cyan_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block PURPLE_SHULKER_BOX = register(new Block("purple_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block PURPLE_SHULKER_BOX = register(new ShulkerBoxBlock("purple_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block BLUE_SHULKER_BOX = register(new Block("blue_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block BLUE_SHULKER_BOX = register(new ShulkerBoxBlock("blue_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block BROWN_SHULKER_BOX = register(new Block("brown_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block BROWN_SHULKER_BOX = register(new ShulkerBoxBlock("brown_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block GREEN_SHULKER_BOX = register(new Block("green_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block GREEN_SHULKER_BOX = register(new ShulkerBoxBlock("green_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block RED_SHULKER_BOX = register(new Block("red_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block RED_SHULKER_BOX = register(new ShulkerBoxBlock("red_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block BLACK_SHULKER_BOX = register(new Block("black_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
public static final Block BLACK_SHULKER_BOX = register(new ShulkerBoxBlock("black_shulker_box", builder().setBlockEntity().destroyTime(2.0f).pushReaction(PistonBehavior.DESTROY)
|
||||
.enumState(FACING, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN)));
|
||||
public static final Block WHITE_GLAZED_TERRACOTTA = register(new Block("white_glazed_terracotta", builder().requiresCorrectToolForDrops().destroyTime(1.4f).pushReaction(PistonBehavior.PUSH_ONLY)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)));
|
||||
|
|
@ -2155,16 +2155,16 @@ public final class Blocks {
|
|||
.enumState(DOOR_HINGE)
|
||||
.booleanState(OPEN)
|
||||
.booleanState(POWERED)));
|
||||
public static final Block CRIMSON_SIGN = register(new Block("crimson_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block CRIMSON_SIGN = register(new SignBlock("crimson_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block WARPED_SIGN = register(new Block("warped_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block WARPED_SIGN = register(new SignBlock("warped_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.intState(ROTATION_16)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block CRIMSON_WALL_SIGN = register(new Block("crimson_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block CRIMSON_WALL_SIGN = register(new SignBlock("crimson_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block WARPED_WALL_SIGN = register(new Block("warped_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
public static final Block WARPED_WALL_SIGN = register(new SignBlock("warped_wall_sign", builder().setBlockEntity().destroyTime(1.0f)
|
||||
.enumState(HORIZONTAL_FACING, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)
|
||||
.booleanState(WATERLOGGED)));
|
||||
public static final Block STRUCTURE_BLOCK = register(new Block("structure_block", builder().setBlockEntity().requiresCorrectToolForDrops().destroyTime(-1.0f)
|
||||
|
|
|
|||
|
|
@ -65,14 +65,6 @@ public final class BlockState {
|
|||
return (T) get(property);
|
||||
}
|
||||
|
||||
public boolean getValue(Property<Boolean> property, boolean def) {
|
||||
var value = get(property);
|
||||
if (value == null) {
|
||||
return def;
|
||||
}
|
||||
return (Boolean) value;
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> T getValue(Property<T> property, T def) {
|
||||
var value = get(property);
|
||||
if (value == null) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.level.block.type;
|
||||
|
||||
public class ShulkerBoxBlock extends Block {
|
||||
public ShulkerBoxBlock(String javaIdentifier, Builder builder) {
|
||||
super(javaIdentifier, builder);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.level.block.type;
|
||||
|
||||
public class SignBlock extends Block {
|
||||
public SignBlock(String javaIdentifier, Builder builder) {
|
||||
super(javaIdentifier, builder);
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,12 @@ import java.util.List;
|
|||
|
||||
@BlockEntity(type = BlockEntityType.BANNER)
|
||||
public class BannerBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState {
|
||||
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.block() instanceof BannerBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, @Nullable NbtMap javaNbt, BlockState blockState) {
|
||||
if (blockState.block() instanceof BannerBlock banner) {
|
||||
|
|
|
|||
|
|
@ -27,12 +27,18 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.BEACON)
|
||||
public class BeaconBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.BEACON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
int primary = javaNbt.getInt("primary");
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@ import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType
|
|||
|
||||
@BlockEntity(type = BlockEntityType.BED)
|
||||
public class BedBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.block() instanceof BedBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
bedrockNbt.putByte("color", (byte) (blockState.block() instanceof BedBlock bed ? bed.dyeColor() : 0));
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ public abstract class BlockEntityTranslator {
|
|||
|
||||
public abstract void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState);
|
||||
|
||||
public abstract boolean shouldTranslate(GeyserSession session, BlockState blockState);
|
||||
|
||||
public NbtMap getBlockEntityTag(GeyserSession session, BlockEntityType type, int x, int y, int z, @Nullable NbtMap javaNbt, BlockState blockState) {
|
||||
NbtMapBuilder tagBuilder = getConstantBedrockTag(type, x, y, z);
|
||||
if (javaNbt != null || this instanceof RequiresBlockState) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.property.Properties;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
|
|
@ -37,6 +38,10 @@ import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType
|
|||
|
||||
@BlockEntity(type = BlockEntityType.BRUSHABLE_BLOCK)
|
||||
public class BrushableBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.SUSPICIOUS_GRAVEL) || blockState.is(Blocks.SUSPICIOUS_SAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, @Nullable NbtMap javaNbt, BlockState blockState) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
@ -38,6 +39,11 @@ import java.util.List;
|
|||
|
||||
@BlockEntity(type = BlockEntityType.CAMPFIRE)
|
||||
public class CampfireBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.CAMPFIRE) || blockState.is(Blocks.SOUL_CAMPFIRE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
List<NbtMap> items = javaNbt.getList("Items", NbtType.COMPOUND);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.property.Properties;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
@ -35,6 +36,11 @@ import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType
|
|||
|
||||
@BlockEntity(type = BlockEntityType.COMMAND_BLOCK)
|
||||
public class CommandBlockBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.COMMAND_BLOCK) || blockState.is(Blocks.CHAIN_COMMAND_BLOCK) || blockState.is(Blocks.REPEATING_COMMAND_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
if (javaNbt == null || javaNbt.size() < 5) {
|
||||
|
|
|
|||
|
|
@ -28,12 +28,17 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.DECORATED_POT)
|
||||
public class DecoratedPotBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.DECORATED_POT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.property.ChestType;
|
||||
import org.geysermc.geyser.level.block.property.Properties;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.level.block.type.ChestBlock;
|
||||
import org.geysermc.geyser.level.physics.Direction;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType;
|
||||
|
|
@ -40,12 +40,13 @@ import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType
|
|||
*/
|
||||
@BlockEntity(type = { BlockEntityType.CHEST, BlockEntityType.TRAPPED_CHEST })
|
||||
public class DoubleChestBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.block() instanceof ChestBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
if (!(blockState.is(Blocks.CHEST) || blockState.is(Blocks.TRAPPED_CHEST))) {
|
||||
return;
|
||||
}
|
||||
if (blockState.getValue(Properties.CHEST_TYPE) != ChestType.SINGLE) {
|
||||
int x = (int) bedrockNbt.get("x");
|
||||
int z = (int) bedrockNbt.get("z");
|
||||
|
|
|
|||
|
|
@ -34,4 +34,9 @@ public class EmptyBlockEntityTranslator extends BlockEntityTranslator {
|
|||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,12 +31,18 @@ import org.cloudburstmc.nbt.NbtList;
|
|||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.END_GATEWAY)
|
||||
public class EndGatewayBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.END_GATEWAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
bedrockNbt.putInt("Age", (int) javaNbt.getLong("Age"));
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.property.Properties;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
@ -35,6 +36,11 @@ import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType
|
|||
|
||||
@BlockEntity(type = BlockEntityType.JIGSAW)
|
||||
public class JigsawBlockBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.JIGSAW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, @Nullable NbtMap javaNbt, BlockState blockState) {
|
||||
if (javaNbt == null) {
|
||||
|
|
|
|||
|
|
@ -30,19 +30,24 @@ import org.cloudburstmc.nbt.NbtMap;
|
|||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.property.Properties;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.level.physics.Direction;
|
||||
import org.geysermc.geyser.level.block.type.ShulkerBoxBlock;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.inventory.ShulkerInventoryTranslator;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.SHULKER_BOX)
|
||||
public class ShulkerBoxBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.block() instanceof ShulkerBoxBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Also used in {@link ShulkerInventoryTranslator}
|
||||
* where {@code tag} is passed as null.
|
||||
*/
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, @Nullable NbtMap javaNbt, BlockState blockState) {
|
||||
bedrockNbt.putByte("facing", (byte) blockState.getValue(Properties.FACING, Direction.UP).ordinal());
|
||||
bedrockNbt.putByte("facing", (byte) blockState.getValue(Properties.FACING).ordinal());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.cloudburstmc.nbt.NbtMap;
|
|||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.level.block.type.SignBlock;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
|
|
@ -39,6 +40,11 @@ import java.util.List;
|
|||
|
||||
@BlockEntity(type = BlockEntityType.SIGN)
|
||||
public class SignBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.block() instanceof SignBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a color stored in a sign's Color tag to its ARGB value.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ import java.util.concurrent.ExecutionException;
|
|||
|
||||
@BlockEntity(type = BlockEntityType.SKULL)
|
||||
public class SkullBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.block() instanceof SkullBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
|
|
|
|||
|
|
@ -33,12 +33,17 @@ import org.cloudburstmc.nbt.NbtMapBuilder;
|
|||
import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.level.block.type.SpawnerBlock;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.MOB_SPAWNER)
|
||||
public class SpawnerBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.block() instanceof SpawnerBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtMap getBlockEntityTag(GeyserSession session, BlockEntityType type, int x, int y, int z, @Nullable NbtMap javaNbt, BlockState blockState) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.cloudburstmc.nbt.NbtMapBuilder;
|
|||
import org.cloudburstmc.protocol.bedrock.data.structure.StructureMirror;
|
||||
import org.cloudburstmc.protocol.bedrock.data.structure.StructureRotation;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.util.StructureBlockUtils;
|
||||
|
|
@ -39,6 +40,10 @@ import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType
|
|||
|
||||
@BlockEntity(type = BlockEntityType.STRUCTURE_BLOCK)
|
||||
public class StructureBlockBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.STRUCTURE_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtMap getBlockEntityTag(GeyserSession session, BlockEntityType type, int x, int y, int z, @Nullable NbtMap javaNbt, BlockState blockState) {
|
||||
|
|
|
|||
|
|
@ -27,12 +27,17 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.TRIAL_SPAWNER)
|
||||
public class TrialSpawnerBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.TRIAL_SPAWNER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.cloudburstmc.nbt.NbtMap;
|
|||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
@ -43,6 +44,11 @@ import java.util.UUID;
|
|||
|
||||
@BlockEntity(type = BlockEntityType.VAULT)
|
||||
public class VaultBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
public boolean shouldTranslate(GeyserSession session, BlockState blockState) {
|
||||
return blockState.is(Blocks.VAULT);
|
||||
}
|
||||
|
||||
// Bedrock 1.21 does not send the position nor ID in the tag.
|
||||
@Override
|
||||
public NbtMap getBlockEntityTag(GeyserSession session, BlockEntityType type, int x, int y, int z, @Nullable NbtMap javaNbt, BlockState blockState) {
|
||||
|
|
|
|||
|
|
@ -403,24 +403,29 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
|
|||
// Note that, since 1.20.5, tags can be null, but Bedrock still needs a default tag to render the item
|
||||
// Also, some properties - like banner base colors - are part of the tag and is processed here.
|
||||
BlockEntityTranslator blockEntityTranslator = BlockEntityUtils.getBlockEntityTranslator(type);
|
||||
bedrockBlockEntities.add(blockEntityTranslator.getBlockEntityTag(session, type, x + chunkBlockX, y, z + chunkBlockZ, tag, blockState));
|
||||
|
||||
// Check for custom skulls
|
||||
if (session.getPreferencesCache().showCustomSkulls() && type == BlockEntityType.SKULL && tag != null && tag.containsKey("profile")) {
|
||||
BlockDefinition blockDefinition = SkullBlockEntityTranslator.translateSkull(session, tag, Vector3i.from(x + chunkBlockX, y, z + chunkBlockZ), blockState);
|
||||
if (blockDefinition != null) {
|
||||
int bedrockSectionY = (y >> 4) - (bedrockDimension.minY() >> 4);
|
||||
int subChunkIndex = (y >> 4) + (bedrockDimension.minY() >> 4);
|
||||
if (0 <= bedrockSectionY && bedrockSectionY < maxBedrockSectionY) {
|
||||
// Custom skull is in a section accepted by Bedrock
|
||||
GeyserChunkSection bedrockSection = sections[bedrockSectionY];
|
||||
IntList palette = bedrockSection.getBlockStorageArray()[0].getPalette();
|
||||
if (palette instanceof IntImmutableList || palette instanceof IntLists.Singleton) {
|
||||
// TODO there has to be a better way to expand the palette .-.
|
||||
bedrockSection = bedrockSection.copy(subChunkIndex);
|
||||
sections[bedrockSectionY] = bedrockSection;
|
||||
// The Java server can send block entity data for blocks that aren't actually those blocks.
|
||||
// A Java client ignores these
|
||||
if (blockState.block().hasBlockEntity() && blockEntityTranslator.shouldTranslate(session, blockState)) {
|
||||
bedrockBlockEntities.add(blockEntityTranslator.getBlockEntityTag(session, type, x + chunkBlockX, y, z + chunkBlockZ, tag, blockState));
|
||||
|
||||
// Check for custom skulls
|
||||
if (session.getPreferencesCache().showCustomSkulls() && type == BlockEntityType.SKULL && tag != null && tag.containsKey("profile")) {
|
||||
BlockDefinition blockDefinition = SkullBlockEntityTranslator.translateSkull(session, tag, Vector3i.from(x + chunkBlockX, y, z + chunkBlockZ), blockState);
|
||||
if (blockDefinition != null) {
|
||||
int bedrockSectionY = (y >> 4) - (bedrockDimension.minY() >> 4);
|
||||
int subChunkIndex = (y >> 4) + (bedrockDimension.minY() >> 4);
|
||||
if (0 <= bedrockSectionY && bedrockSectionY < maxBedrockSectionY) {
|
||||
// Custom skull is in a section accepted by Bedrock
|
||||
GeyserChunkSection bedrockSection = sections[bedrockSectionY];
|
||||
IntList palette = bedrockSection.getBlockStorageArray()[0].getPalette();
|
||||
if (palette instanceof IntImmutableList || palette instanceof IntLists.Singleton) {
|
||||
// TODO there has to be a better way to expand the palette .-.
|
||||
bedrockSection = bedrockSection.copy(subChunkIndex);
|
||||
sections[bedrockSectionY] = bedrockSection;
|
||||
}
|
||||
bedrockSection.setFullBlock(x, y & 0xF, z, 0, blockDefinition.getRuntimeId());
|
||||
}
|
||||
bedrockSection.setFullBlock(x, y & 0xF, z, 0, blockDefinition.getRuntimeId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue