Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
SPIGOT-4961: Cannot open various inventories
Dieser Commit ist enthalten in:
Ursprung
b114affb9d
Commit
c5e09ceaaa
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/server/TileEntityLectern.java
|
--- a/net/minecraft/server/TileEntityLectern.java
|
||||||
+++ b/net/minecraft/server/TileEntityLectern.java
|
+++ b/net/minecraft/server/TileEntityLectern.java
|
||||||
@@ -1,10 +1,61 @@
|
@@ -1,10 +1,63 @@
|
||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -18,9 +18,11 @@
|
|||||||
|
|
||||||
-public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory {
|
-public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory {
|
||||||
+public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory, ICommandListener { // CraftBukkit - ICommandListener
|
+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<>();
|
+ public List<HumanEntity> transaction = new ArrayList<>();
|
||||||
+ private int maxStack = 1;
|
+ private int maxStack = 1;
|
||||||
+
|
+
|
||||||
@ -59,11 +61,12 @@
|
|||||||
+ return (Lectern) CraftBlock.at(world, position).getState();
|
+ return (Lectern) CraftBlock.at(world, position).getState();
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
|
- public final IInventory inventory = new IInventory() {
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -49,11 +100,18 @@
|
@@ -49,11 +102,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,7 +87,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -158,6 +216,32 @@
|
@@ -158,6 +218,32 @@
|
||||||
return itemstack;
|
return itemstack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +120,7 @@
|
|||||||
private CommandListenerWrapper a(@Nullable EntityHuman entityhuman) {
|
private CommandListenerWrapper a(@Nullable EntityHuman entityhuman) {
|
||||||
String s;
|
String s;
|
||||||
Object object;
|
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);
|
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
|
@Override
|
||||||
@@ -206,7 +291,7 @@
|
@@ -206,7 +293,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||||
|
@ -468,12 +468,19 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
case STONECUTTER:
|
case STONECUTTER:
|
||||||
openCustomInventory(inventory, player, Containers.STONECUTTER);
|
openCustomInventory(inventory, player, Containers.STONECUTTER);
|
||||||
break;
|
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 CREATIVE:
|
||||||
case CRAFTING:
|
case CRAFTING:
|
||||||
case MERCHANT:
|
case MERCHANT:
|
||||||
case LOOM:
|
default:
|
||||||
case CARTOGRAPHY:
|
|
||||||
case GRINDSTONE:
|
|
||||||
throw new IllegalArgumentException("Can't open a " + type + " inventory!");
|
throw new IllegalArgumentException("Can't open a " + type + " inventory!");
|
||||||
}
|
}
|
||||||
if (getHandle().activeContainer == formerContainer) {
|
if (getHandle().activeContainer == formerContainer) {
|
||||||
|
@ -16,6 +16,7 @@ import net.minecraft.server.TileEntityBrewingStand;
|
|||||||
import net.minecraft.server.TileEntityDispenser;
|
import net.minecraft.server.TileEntityDispenser;
|
||||||
import net.minecraft.server.TileEntityDropper;
|
import net.minecraft.server.TileEntityDropper;
|
||||||
import net.minecraft.server.TileEntityFurnace;
|
import net.minecraft.server.TileEntityFurnace;
|
||||||
|
import net.minecraft.server.TileEntityLectern;
|
||||||
import net.minecraft.server.TileEntityShulkerBox;
|
import net.minecraft.server.TileEntityShulkerBox;
|
||||||
import net.minecraft.server.TileEntitySmoker;
|
import net.minecraft.server.TileEntitySmoker;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
@ -479,7 +480,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return InventoryType.SHULKER_BOX;
|
return InventoryType.SHULKER_BOX;
|
||||||
} else if (inventory instanceof TileEntityBarrel) {
|
} else if (inventory instanceof TileEntityBarrel) {
|
||||||
return InventoryType.BARREL;
|
return InventoryType.BARREL;
|
||||||
} else if (this instanceof CraftInventoryLectern) {
|
} else if (inventory instanceof TileEntityLectern.LecternInventory) {
|
||||||
return InventoryType.LECTERN;
|
return InventoryType.LECTERN;
|
||||||
} else if (this instanceof CraftInventoryLoom) {
|
} else if (this instanceof CraftInventoryLoom) {
|
||||||
return InventoryType.LOOM;
|
return InventoryType.LOOM;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren