SPIGOT-4947: Allow setting the content on a lectern

This commit is contained in:
Brokkonaut 2019-05-17 20:03:36 +02:00 committed by md_5
parent 09d00e9f90
commit 5a02707175

View File

@ -63,7 +63,19 @@
@Override @Override
public int getSize() { public int getSize() {
return 1; return 1;
@@ -53,7 +104,7 @@ @@ -49,11 +100,18 @@
}
@Override
- public void setItem(int i, ItemStack itemstack) {}
+ // CraftBukkit start
+ public void setItem(int i, ItemStack itemstack) {
+ if (i == 0) {
+ TileEntityLectern.this.a(itemstack); // PAIL rename setBook
+ BlockLectern.a(TileEntityLectern.this.getWorld(), TileEntityLectern.this.getPosition(), TileEntityLectern.this.getBlock(), TileEntityLectern.this.f()); // PAIL rename a -> setHasBook, f -> hasBook
+ }
+ }
+ // CraftBukkit end
@Override @Override
public int getMaxStackSize() { public int getMaxStackSize() {
@ -72,7 +84,7 @@
} }
@Override @Override
@@ -158,6 +209,32 @@ @@ -158,6 +216,32 @@
return itemstack; return itemstack;
} }
@ -105,7 +117,7 @@
private CommandListenerWrapper a(@Nullable EntityHuman entityhuman) { private CommandListenerWrapper a(@Nullable EntityHuman entityhuman) {
String s; String s;
Object object; Object object;
@@ -172,7 +249,8 @@ @@ -172,7 +256,8 @@
Vec3D vec3d = new Vec3D((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D); Vec3D vec3d = new Vec3D((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D);
@ -115,7 +127,7 @@
} }
@Override @Override
@@ -206,7 +284,7 @@ @@ -206,7 +291,7 @@
@Override @Override
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) { public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {