mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 14:04:49 +01:00
SPIGOT-4961: Cannot open various inventories
This commit is contained in:
parent
b114affb9d
commit
c5e09ceaaa
3 changed files with 24 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/TileEntityLectern.java
|
||||
+++ b/net/minecraft/server/TileEntityLectern.java
|
||||
@@ -1,10 +1,61 @@
|
||||
@@ -1,10 +1,63 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -18,9 +18,11 @@
|
|||
|
||||
-public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory {
|
||||
+public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory, ICommandListener { // CraftBukkit - ICommandListener
|
||||
|
||||
public final IInventory inventory = new IInventory() {
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ public final IInventory inventory = new LecternInventory();
|
||||
+ public class LecternInventory implements IInventory {
|
||||
+
|
||||
+ public List<HumanEntity> transaction = new ArrayList<>();
|
||||
+ private int maxStack = 1;
|
||||
+
|
||||
|
@ -59,11 +61,12 @@
|
|||
+ return (Lectern) CraftBlock.at(world, position).getState();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
- public final IInventory inventory = new IInventory() {
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 1;
|
||||
@@ -49,11 +100,18 @@
|
||||
@@ -49,11 +102,18 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,7 +87,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -158,6 +216,32 @@
|
||||
@@ -158,6 +218,32 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
|
@ -117,7 +120,7 @@
|
|||
private CommandListenerWrapper a(@Nullable EntityHuman entityhuman) {
|
||||
String s;
|
||||
Object object;
|
||||
@@ -172,7 +256,8 @@
|
||||
@@ -172,7 +258,8 @@
|
||||
|
||||
Vec3D vec3d = new Vec3D((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D);
|
||||
|
||||
|
@ -127,7 +130,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -206,7 +291,7 @@
|
||||
@@ -206,7 +293,7 @@
|
||||
|
||||
@Override
|
||||
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||
|
|
|
@ -468,12 +468,19 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||
case STONECUTTER:
|
||||
openCustomInventory(inventory, player, Containers.STONECUTTER);
|
||||
break;
|
||||
case LOOM:
|
||||
openCustomInventory(inventory, player, Containers.LOOM);
|
||||
break;
|
||||
case CARTOGRAPHY:
|
||||
openCustomInventory(inventory, player, Containers.CARTOGRAPHY);
|
||||
break;
|
||||
case GRINDSTONE:
|
||||
openCustomInventory(inventory, player, Containers.GRINDSTONE);
|
||||
break;
|
||||
case CREATIVE:
|
||||
case CRAFTING:
|
||||
case MERCHANT:
|
||||
case LOOM:
|
||||
case CARTOGRAPHY:
|
||||
case GRINDSTONE:
|
||||
default:
|
||||
throw new IllegalArgumentException("Can't open a " + type + " inventory!");
|
||||
}
|
||||
if (getHandle().activeContainer == formerContainer) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.server.TileEntityBrewingStand;
|
|||
import net.minecraft.server.TileEntityDispenser;
|
||||
import net.minecraft.server.TileEntityDropper;
|
||||
import net.minecraft.server.TileEntityFurnace;
|
||||
import net.minecraft.server.TileEntityLectern;
|
||||
import net.minecraft.server.TileEntityShulkerBox;
|
||||
import net.minecraft.server.TileEntitySmoker;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
@ -479,7 +480,7 @@ public class CraftInventory implements Inventory {
|
|||
return InventoryType.SHULKER_BOX;
|
||||
} else if (inventory instanceof TileEntityBarrel) {
|
||||
return InventoryType.BARREL;
|
||||
} else if (this instanceof CraftInventoryLectern) {
|
||||
} else if (inventory instanceof TileEntityLectern.LecternInventory) {
|
||||
return InventoryType.LECTERN;
|
||||
} else if (this instanceof CraftInventoryLoom) {
|
||||
return InventoryType.LOOM;
|
||||
|
|
Loading…
Reference in a new issue