--- a/net/minecraft/world/level/block/entity/TileEntityLectern.java
+++ b/net/minecraft/world/level/block/entity/TileEntityLectern.java
@@ -25,13 +25,72 @@
 import net.minecraft.world.phys.Vec2F;
 import net.minecraft.world.phys.Vec3D;
 
-public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory {
+// CraftBukkit start
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.bukkit.Location;
+import org.bukkit.block.Lectern;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.inventory.InventoryHolder;
+// CraftBukkit end
+
+public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory, ICommandListener { // CraftBukkit - ICommandListener
 
     public static final int DATA_PAGE = 0;
     public static final int NUM_DATA = 1;
     public static final int SLOT_BOOK = 0;
     public static final int NUM_SLOTS = 1;
-    public final IInventory bookAccess = new IInventory() {
+    // CraftBukkit start - add fields and methods
+    public final IInventory bookAccess = new LecternInventory();
+    public class LecternInventory implements IInventory {
+
+        public List<HumanEntity> transaction = new ArrayList<>();
+        private int maxStack = 1;
+
+        @Override
+        public List<ItemStack> getContents() {
+            return Arrays.asList(book);
+        }
+
+        @Override
+        public void onOpen(CraftHumanEntity who) {
+            transaction.add(who);
+        }
+
+        @Override
+        public void onClose(CraftHumanEntity who) {
+            transaction.remove(who);
+        }
+
+        @Override
+        public List<HumanEntity> getViewers() {
+            return transaction;
+        }
+
+        @Override
+        public void setMaxStackSize(int i) {
+            maxStack = i;
+        }
+
+        @Override
+        public Location getLocation() {
+            if (level == null) return null;
+            return CraftLocation.toBukkit(worldPosition, level.getWorld());
+        }
+
+        @Override
+        public InventoryHolder getOwner() {
+            return (Lectern) TileEntityLectern.this.getOwner();
+        }
+
+        public TileEntityLectern getLectern() {
+            return TileEntityLectern.this;
+        }
+        // CraftBukkit end
+
         @Override
         public int getContainerSize() {
             return 1;
@@ -76,11 +135,20 @@
         }
 
         @Override
-        public void setItem(int i, ItemStack itemstack) {}
+        // CraftBukkit start
+        public void setItem(int i, ItemStack itemstack) {
+            if (i == 0) {
+                TileEntityLectern.this.setBook(itemstack);
+                if (TileEntityLectern.this.getLevel() != null) {
+                    BlockLectern.resetBookState(null, TileEntityLectern.this.getLevel(), TileEntityLectern.this.getBlockPos(), TileEntityLectern.this.getBlockState(), TileEntityLectern.this.hasBook());
+                }
+            }
+        }
+        // CraftBukkit end
 
         @Override
         public int getMaxStackSize() {
-            return 1;
+            return maxStack; // CraftBukkit
         }
 
         @Override
@@ -160,7 +228,7 @@
         if (j != this.page) {
             this.page = j;
             this.setChanged();
-            BlockLectern.signalPageChange(this.getLevel(), this.getBlockPos(), this.getBlockState());
+            if (this.level != null) BlockLectern.signalPageChange(this.getLevel(), this.getBlockPos(), this.getBlockState()); // CraftBukkit
         }
 
     }
@@ -183,6 +251,32 @@
         return itemstack;
     }
 
+    // CraftBukkit start
+    @Override
+    public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {
+    }
+
+    @Override
+    public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
+        return wrapper.getEntity() != null ? wrapper.getEntity().getBukkitSender(wrapper) : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, this);
+    }
+
+    @Override
+    public boolean acceptsSuccess() {
+        return false;
+    }
+
+    @Override
+    public boolean acceptsFailure() {
+        return false;
+    }
+
+    @Override
+    public boolean shouldInformAdmins() {
+        return false;
+    }
+
+    // CraftBukkit end
     private CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman) {
         String s;
         Object object;
@@ -197,7 +291,8 @@
 
         Vec3D vec3d = Vec3D.atCenterOf(this.worldPosition);
 
-        return new CommandListenerWrapper(ICommandListener.NULL, vec3d, Vec2F.ZERO, (WorldServer) this.level, 2, s, (IChatBaseComponent) object, this.level.getServer(), entityhuman);
+        // CraftBukkit - this
+        return new CommandListenerWrapper(this, vec3d, Vec2F.ZERO, (WorldServer) this.level, 2, s, (IChatBaseComponent) object, this.level.getServer(), entityhuman);
     }
 
     @Override
@@ -235,7 +330,7 @@
 
     @Override
     public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
-        return new ContainerLectern(i, this.bookAccess, this.dataAccess);
+        return new ContainerLectern(i, this.bookAccess, this.dataAccess, playerinventory); // CraftBukkit
     }
 
     @Override
