diff --git a/nms-patches/TileEntityLectern.patch b/nms-patches/TileEntityLectern.patch index ee37d5fb56..a067727b00 100644 --- a/nms-patches/TileEntityLectern.patch +++ b/nms-patches/TileEntityLectern.patch @@ -89,6 +89,15 @@ } @Override +@@ -135,7 +197,7 @@ + if (j != this.page) { + this.page = j; + this.update(); +- BlockLectern.a(this.getWorld(), this.getPosition(), this.getBlock()); ++ if (this.world != null) BlockLectern.a(this.getWorld(), this.getPosition(), this.getBlock()); // CraftBukkit + } + + } @@ -158,6 +220,32 @@ return itemstack; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLectern.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLectern.java index bb57b750be..eb6b6a6dcf 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLectern.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLectern.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.block; +import net.minecraft.server.BlockLectern; import net.minecraft.server.TileEntityLectern; import org.bukkit.Material; import org.bukkit.block.Block; @@ -40,4 +41,15 @@ public class CraftLectern extends CraftBlockEntityState imple return new CraftInventoryLectern(this.getTileEntity().inventory); } + + @Override + public boolean update(boolean force, boolean applyPhysics) { + boolean result = super.update(force, applyPhysics); + + if (result && this.isPlaced() && this.getType() == Material.LECTERN) { + BlockLectern.a(this.world.getHandle(), this.getPosition(), this.getHandle()); + } + + return result; + } }