Paper/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvilAbstract.patch
CraftBukkit/Spigot 8cbaba0a8a SPIGOT-6078: Add SmithItemEvent and expand SmithingInventory API
By: Julian van den Berkmortel <julianvdberkmortel@outlook.com>
2021-04-18 18:03:23 +10:00

42 lines
1.8 KiB
Diff

--- a/net/minecraft/world/inventory/ContainerAnvilAbstract.java
+++ b/net/minecraft/world/inventory/ContainerAnvilAbstract.java
@@ -11,13 +11,7 @@
public abstract class ContainerAnvilAbstract extends Container {
protected final InventoryCraftResult resultInventory = new InventoryCraftResult();
- protected final IInventory repairInventory = new InventorySubcontainer(2) {
- @Override
- public void update() {
- super.update();
- ContainerAnvilAbstract.this.a((IInventory) this);
- }
- };
+ protected final IInventory repairInventory; // CraftBukkit - instantiate repairInventory in the constructor
protected final ContainerAccess containerAccess;
protected final EntityHuman player;
@@ -31,6 +25,15 @@
super(containers, i);
this.containerAccess = containeraccess;
this.player = playerinventory.player;
+ // CraftBukkit start
+ this.repairInventory = new InventoryCrafting(this, 1, 2, player) {
+ @Override
+ public void update() {
+ super.update();
+ ContainerAnvilAbstract.this.a((IInventory) this);
+ }
+ };
+ // CraftBukkit end
this.a(new Slot(this.repairInventory, 0, 27, 47));
this.a(new Slot(this.repairInventory, 1, 76, 47));
this.a(new Slot(this.resultInventory, 2, 134, 47) {
@@ -85,6 +88,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return (Boolean) this.containerAccess.a((world, blockposition) -> {
return !this.a(world.getType(blockposition)) ? false : entityhuman.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D;
}, true);