diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LecternBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LecternBlock.java.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LecternBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LecternBlock.java.patch new file mode 100644 index 0000000000..db1ae8d6c9 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LecternBlock.java.patch @@ -0,0 +1,36 @@ +--- a/net/minecraft/world/level/block/LecternBlock.java ++++ b/net/minecraft/world/level/block/LecternBlock.java +@@ -219,18 +206,21 @@ + } + } + +- private void popBook(BlockState state, Level level, BlockPos pos) { +- if (level.getBlockEntity(pos) instanceof LecternBlockEntity lecternBlockEntity) { +- Direction direction = state.getValue(FACING); +- ItemStack itemStack = lecternBlockEntity.getBook().copy(); +- float f = 0.25F * (float)direction.getStepX(); +- float f1 = 0.25F * (float)direction.getStepZ(); +- ItemEntity itemEntity = new ItemEntity( +- level, (double)pos.getX() + 0.5 + (double)f, (double)(pos.getY() + 1), (double)pos.getZ() + 0.5 + (double)f1, itemStack +- ); +- itemEntity.setDefaultPickUpDelay(); +- level.addFreshEntity(itemEntity); +- lecternBlockEntity.clearContent(); ++ private void popBook(IBlockData state, Level level, BlockPos pos) { ++ BlockEntity tileentity = level.getBlockEntity(pos, false); // CraftBukkit - don't validate, type may be changed already ++ ++ if (tileentity instanceof LecternBlockEntity) { ++ LecternBlockEntity tileentitylectern = (LecternBlockEntity) tileentity; ++ Direction enumdirection = (Direction) state.getValue(LecternBlock.FACING); ++ ItemStack itemstack = tileentitylectern.getBook().copy(); ++ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-5500 ++ float f = 0.25F * (float) enumdirection.getStepX(); ++ float f1 = 0.25F * (float) enumdirection.getStepZ(); ++ ItemEntity entityitem = new ItemEntity(level, (double) pos.getX() + 0.5D + (double) f, (double) (pos.getY() + 1), (double) pos.getZ() + 0.5D + (double) f1, itemstack); ++ ++ entityitem.setDefaultPickUpDelay(); ++ level.addFreshEntity(entityitem); ++ tileentitylectern.clearContent(); + } + } + |