Update to Minecraft 1.17

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-06-11 15:00:00 +10:00
parent 75faba7fde
commit b3a8254758
619 changed files with 10708 additions and 8451 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/Container.java
+++ b/net/minecraft/world/inventory/Container.java
@@ -21,6 +21,20 @@
@@ -29,6 +29,20 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.TileEntity;
@@ -20,10 +20,10 @@
+
public abstract class Container {
public NonNullList<ItemStack> items = NonNullList.a();
@@ -35,6 +49,27 @@
private final List<ICrafting> listeners = Lists.newArrayList();
private final Set<EntityHuman> k = Sets.newHashSet();
public static final int SLOT_CLICKED_OUTSIDE = -999;
@@ -57,6 +71,27 @@
private ContainerSynchronizer synchronizer;
private boolean suppressRemoteUpdates;
+ // CraftBukkit start
+ public boolean checkReachable = true;
@@ -47,43 +47,57 @@
+ // CraftBukkit end
+
protected Container(@Nullable Containers<?> containers, int i) {
this.e = containers;
this.windowId = i;
@@ -216,6 +251,7 @@
k = playerinventory.getCarried().getCount();
Iterator iterator = this.i.iterator();
this.carried = ItemStack.EMPTY;
this.remoteSlots = NonNullList.a();
@@ -154,6 +189,15 @@
}
+ // CraftBukkit start
+ public void broadcastCarriedItem() {
+ this.remoteCarried = this.getCarried().cloneItemStack();
+ if (this.synchronizer != null) {
+ this.synchronizer.sendCarriedChange(this, this.remoteCarried);
+ }
+ }
+ // CraftBukkit end
+
public void b(ICrafting icrafting) {
this.containerListeners.remove(icrafting);
}
@@ -349,6 +393,7 @@
l = this.getCarried().getCount();
Iterator iterator = this.quickcraftSlots.iterator();
+ Map<Integer, ItemStack> draggedSlots = new HashMap<Integer, ItemStack>(); // CraftBukkit - Store slots from drag in map (raw slot id -> new stack)
while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next();
ItemStack itemstack3 = playerinventory.getCarried();
@@ -231,12 +267,48 @@
ItemStack itemstack2 = this.getCarried();
@@ -365,12 +410,48 @@
}
k -= itemstack4.getCount() - j1;
- slot1.set(itemstack4);
+ // slot1.set(itemstack4);
+ draggedSlots.put(slot1.rawSlotIndex, itemstack4); // CraftBukkit - Put in map instead of setting
}
}
- itemstack2.setCount(k);
- playerinventory.setCarried(itemstack2);
l -= itemstack3.getCount() - j1;
- slot1.set(itemstack3);
+ // slot1.set(itemstack3);
+ draggedSlots.put(slot1.index, itemstack3); // CraftBukkit - Put in map instead of setting
+ }
+ }
+
+ // CraftBukkit start - InventoryDragEvent
+ InventoryView view = getBukkitView();
+ org.bukkit.inventory.ItemStack newcursor = CraftItemStack.asCraftMirror(itemstack2);
+ newcursor.setAmount(k);
+ org.bukkit.inventory.ItemStack newcursor = CraftItemStack.asCraftMirror(itemstack1);
+ newcursor.setAmount(l);
+ Map<Integer, org.bukkit.inventory.ItemStack> eventmap = new HashMap<Integer, org.bukkit.inventory.ItemStack>();
+ for (Map.Entry<Integer, ItemStack> ditem : draggedSlots.entrySet()) {
+ eventmap.put(ditem.getKey(), CraftItemStack.asBukkitCopy(ditem.getValue()));
+ }
+
+ // It's essential that we set the cursor to the new value here to prevent item duplication if a plugin closes the inventory.
+ ItemStack oldCursor = playerinventory.getCarried();
+ playerinventory.setCarried(CraftItemStack.asNMSCopy(newcursor));
+ ItemStack oldCursor = this.getCarried();
+ this.setCarried(CraftItemStack.asNMSCopy(newcursor));
+
+ InventoryDragEvent event = new InventoryDragEvent(view, (newcursor.getType() != org.bukkit.Material.AIR ? newcursor : null), CraftItemStack.asBukkitCopy(oldCursor), this.dragType == 1, eventmap);
+ entityhuman.world.getServer().getPluginManager().callEvent(event);
+ InventoryDragEvent event = new InventoryDragEvent(view, (newcursor.getType() != org.bukkit.Material.AIR ? newcursor : null), CraftItemStack.asBukkitCopy(oldCursor), this.quickcraftType == 1, eventmap);
+ entityhuman.level.getServer().getPluginManager().callEvent(event);
+
+ // Whether or not a change was made to the inventory that requires an update.
+ boolean needsUpdate = event.getResult() != Result.DEFAULT;
@@ -94,60 +108,74 @@
+ }
+ // The only time the carried item will be set to null is if the inventory is closed by the server.
+ // If the inventory is closed by the server, then the cursor items are dropped. This is why we change the cursor early.
+ if (playerinventory.getCarried() != null) {
+ playerinventory.setCarried(CraftItemStack.asNMSCopy(event.getCursor()));
+ if (this.getCarried() != null) {
+ this.setCarried(CraftItemStack.asNMSCopy(event.getCursor()));
+ needsUpdate = true;
+ }
}
+ } else {
+ playerinventory.setCarried(oldCursor);
+ }
+
+ this.setCarried(oldCursor);
}
- itemstack1.setCount(l);
- this.setCarried(itemstack1);
+ if (needsUpdate && entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).updateInventory(this);
+ this.updateInventory();
+ }
+ // CraftBukkit end
}
this.d();
@@ -253,8 +325,11 @@
this.e();
@@ -388,8 +469,11 @@
if (i == -999) {
if (!playerinventory.getCarried().isEmpty()) {
if (j == 0) {
- entityhuman.drop(playerinventory.getCarried(), true);
if (!this.getCarried().isEmpty()) {
if (clickaction == ClickAction.PRIMARY) {
- entityhuman.drop(this.getCarried(), true);
+ // CraftBukkit start
+ ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(ItemStack.b);
+ ItemStack carried = this.getCarried();
this.setCarried(ItemStack.EMPTY);
+ entityhuman.drop(carried, true);
+ // CraftBukkit start
} else {
entityhuman.drop(this.getCarried().cloneAndSubtract(1), true);
}
if (j == 1) {
@@ -342,6 +417,15 @@
}
slot2.d();
+ // CraftBukkit start - Make sure the client has the right slot contents
+ if (entityhuman instanceof EntityPlayer && slot2.getMaxStackSize() != 64) {
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, slot2.rawSlotIndex, slot2.getItem()));
+ // Updating a crafting inventory makes the client reset the result slot, have to send it again
+ if (this.getBukkitView().getType() == InventoryType.WORKBENCH || this.getBukkitView().getType() == InventoryType.CRAFTING) {
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, 0, this.getSlot(0).getItem()));
+ }
+ }
+ // CraftBukkit end
@@ -452,6 +536,15 @@
}
}
} else if (inventoryclicktype == InventoryClickType.SWAP) {
@@ -444,8 +528,11 @@
PlayerInventory playerinventory = entityhuman.inventory;
if (!playerinventory.getCarried().isEmpty()) {
- entityhuman.drop(playerinventory.getCarried(), false);
slot.d();
+ // CraftBukkit start - Make sure the client has the right slot contents
+ if (entityhuman instanceof EntityPlayer && slot.getMaxStackSize() != 64) {
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutSetSlot(this.containerId, slot.index, slot.getItem()));
+ // Updating a crafting inventory makes the client reset the result slot, have to send it again
+ if (this.getBukkitView().getType() == InventoryType.WORKBENCH || this.getBukkitView().getType() == InventoryType.CRAFTING) {
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutSetSlot(this.containerId, 0, this.getSlot(0).getItem()));
+ }
+ }
+ // CraftBukkit end
}
} else {
Slot slot2;
@@ -556,8 +649,11 @@
public void b(EntityHuman entityhuman) {
if (!this.getCarried().isEmpty()) {
- entityhuman.drop(this.getCarried(), false);
+ // CraftBukkit start - SPIGOT-4556
+ ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(ItemStack.b);
+ ItemStack carried = this.getCarried();
this.setCarried(ItemStack.EMPTY);
+ entityhuman.drop(carried, false);
+ // CraftBukkit end
}
}
@@ -767,6 +863,11 @@
}
public ItemStack getCarried() {
+ // CraftBukkit start
+ if (this.carried.isEmpty()) {
+ this.setCarried(ItemStack.EMPTY);
+ }
+ // CraftBukkit end
return this.carried;
}

View File

@@ -18,7 +18,7 @@
+ }
+ // CraftBukkit end
+
ContainerAccess a = new ContainerAccess() {
ContainerAccess NULL = new ContainerAccess() {
@Override
public <T> Optional<T> a(BiFunction<World, BlockPosition, T> bifunction) {
@@ -17,6 +31,18 @@

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerAnvil.java
+++ b/net/minecraft/world/inventory/ContainerAnvil.java
@@ -19,12 +19,20 @@
@@ -19,6 +19,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -11,79 +11,80 @@
public class ContainerAnvil extends ContainerAnvilAbstract {
private static final Logger LOGGER = LogManager.getLogger();
private int h;
public String renameText;
public final ContainerProperty levelCost;
@@ -34,6 +38,10 @@
private static final int COST_REPAIR_SACRIFICE = 2;
private static final int COST_INCOMPATIBLE_PENALTY = 1;
private static final int COST_RENAME = 1;
+ // CraftBukkit start
+ public int maximumRepairCost = 40;
+ private CraftInventoryView bukkitEntity;
+ // CraftBukkit end
public ContainerAnvil(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -98,7 +106,7 @@
this(i, playerinventory, ContainerAccess.NULL);
@@ -107,7 +115,7 @@
byte b1 = 0;
if (itemstack.isEmpty()) {
- this.resultInventory.setItem(0, ItemStack.b);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.b); // CraftBukkit
this.levelCost.set(0);
- this.resultSlots.setItem(0, ItemStack.EMPTY);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
this.cost.set(0);
} else {
ItemStack itemstack1 = itemstack.cloneItemStack();
@@ -116,7 +124,7 @@
if (itemstack1.e() && itemstack1.getItem().a(itemstack, itemstack2)) {
k = Math.min(itemstack1.getDamage(), itemstack1.h() / 4);
@@ -125,7 +133,7 @@
if (itemstack1.f() && itemstack1.getItem().a(itemstack, itemstack2)) {
k = Math.min(itemstack1.getDamage(), itemstack1.i() / 4);
if (k <= 0) {
- this.resultInventory.setItem(0, ItemStack.b);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.b); // CraftBukkit
this.levelCost.set(0);
- this.resultSlots.setItem(0, ItemStack.EMPTY);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
this.cost.set(0);
return;
}
@@ -131,7 +139,7 @@
this.h = i1;
@@ -140,7 +148,7 @@
this.repairItemCountCost = i1;
} else {
if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.e())) {
- this.resultInventory.setItem(0, ItemStack.b);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.b); // CraftBukkit
this.levelCost.set(0);
if (!flag && (!itemstack1.a(itemstack2.getItem()) || !itemstack1.f())) {
- this.resultSlots.setItem(0, ItemStack.EMPTY);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
this.cost.set(0);
return;
}
@@ -221,7 +229,7 @@
@@ -230,7 +238,7 @@
}
if (flag2 && !flag1) {
- this.resultInventory.setItem(0, ItemStack.b);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.b); // CraftBukkit
this.levelCost.set(0);
- this.resultSlots.setItem(0, ItemStack.EMPTY);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
this.cost.set(0);
return;
}
@@ -245,11 +253,11 @@
itemstack1 = ItemStack.b;
@@ -254,11 +262,11 @@
itemstack1 = ItemStack.EMPTY;
}
- if (b1 == i && b1 > 0 && this.levelCost.get() >= 40) {
- this.levelCost.set(39);
+ if (b1 == i && b1 > 0 && this.levelCost.get() >= maximumRepairCost) { // CraftBukkit
+ this.levelCost.set(maximumRepairCost - 1); // CraftBukkit
- if (b1 == i && b1 > 0 && this.cost.get() >= 40) {
- this.cost.set(39);
+ if (b1 == i && b1 > 0 && this.cost.get() >= maximumRepairCost) { // CraftBukkit
+ this.cost.set(maximumRepairCost - 1); // CraftBukkit
}
- if (this.levelCost.get() >= 40 && !this.player.abilities.canInstantlyBuild) {
+ if (this.levelCost.get() >= maximumRepairCost && !this.player.abilities.canInstantlyBuild) { // CraftBukkit
itemstack1 = ItemStack.b;
- if (this.cost.get() >= 40 && !this.player.getAbilities().instabuild) {
+ if (this.cost.get() >= maximumRepairCost && !this.player.getAbilities().instabuild) { // CraftBukkit
itemstack1 = ItemStack.EMPTY;
}
@@ -268,7 +276,7 @@
@@ -277,7 +285,7 @@
EnchantmentManager.a(map, itemstack1);
}
- this.resultInventory.setItem(0, itemstack1);
- this.resultSlots.setItem(0, itemstack1);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), itemstack1); // CraftBukkit
this.c();
this.d();
}
}
@@ -291,4 +299,18 @@
this.e();
@@ -304,4 +312,18 @@
public int j() {
return this.cost.get();
}
+
+ // CraftBukkit start
@@ -94,7 +95,7 @@
+ }
+
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(
+ containerAccess.getLocation(), this.repairInventory, this.resultInventory, this);
+ access.getLocation(), this.inputSlots, this.resultSlots, this);
+ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }

View File

@@ -1,10 +1,10 @@
--- a/net/minecraft/world/inventory/ContainerAnvilAbstract.java
+++ b/net/minecraft/world/inventory/ContainerAnvilAbstract.java
@@ -85,6 +85,7 @@
@@ -92,6 +92,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return (Boolean) this.containerAccess.a((world, blockposition) -> {
return (Boolean) this.access.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);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerBeacon.java
+++ b/net/minecraft/world/inventory/ContainerBeacon.java
@@ -8,12 +8,21 @@
@@ -10,6 +10,11 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Blocks;
@@ -11,18 +11,19 @@
+
public class ContainerBeacon extends Container {
private final IInventory beacon;
private final ContainerBeacon.SlotBeacon d;
private final ContainerAccess containerAccess;
private final IContainerProperties containerProperties;
private static final int PAYMENT_SLOT = 0;
@@ -23,6 +28,10 @@
private final ContainerBeacon.SlotBeacon paymentSlot;
private final ContainerAccess access;
private final IContainerProperties beaconData;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+ // CraftBukkit end
public ContainerBeacon(int i, IInventory iinventory) {
this(i, iinventory, new ContainerProperties(3), ContainerAccess.a);
@@ -21,6 +30,7 @@
this(i, iinventory, new ContainerProperties(3), ContainerAccess.NULL);
@@ -30,6 +39,7 @@
public ContainerBeacon(int i, IInventory iinventory, IContainerProperties icontainerproperties, ContainerAccess containeraccess) {
super(Containers.BEACON, i);
@@ -30,15 +31,15 @@
this.beacon = new InventorySubcontainer(1) {
@Override
public boolean b(int j, ItemStack itemstack) {
@@ -70,6 +80,7 @@
@@ -79,6 +89,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.BEACON);
return a(this.access, entityhuman, Blocks.BEACON);
}
@@ -151,4 +162,17 @@
@@ -178,4 +189,17 @@
return 1;
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerBrewingStand.java
+++ b/net/minecraft/world/inventory/ContainerBrewingStand.java
@@ -13,18 +13,29 @@
@@ -12,6 +12,11 @@
import net.minecraft.world.item.alchemy.PotionRegistry;
import net.minecraft.world.item.alchemy.PotionUtil;
@@ -11,9 +11,10 @@
+
public class ContainerBrewingStand extends Container {
private final IInventory brewingStand;
private final IContainerProperties d;
private final Slot e;
private static final int BOTTLE_SLOT_START = 0;
@@ -28,12 +33,18 @@
private final IContainerProperties brewingStandData;
private final Slot ingredientSlot;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
@@ -30,7 +31,7 @@
a(iinventory, 5);
a(icontainerproperties, 2);
this.brewingStand = iinventory;
@@ -52,6 +63,7 @@
@@ -61,6 +72,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
@@ -38,8 +39,8 @@
return this.brewingStand.a(entityhuman);
}
@@ -184,4 +196,17 @@
return item == Items.POTION || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE;
@@ -198,4 +210,17 @@
return 64;
}
}
+

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerCartography.java
+++ b/net/minecraft/world/inventory/ContainerCartography.java
@@ -13,8 +13,30 @@
@@ -12,8 +12,30 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.saveddata.maps.WorldMap;
@@ -23,15 +23,15 @@
+ return bukkitEntity;
+ }
+
+ CraftInventoryCartography inventory = new CraftInventoryCartography(this.inventory, this.resultInventory);
+ CraftInventoryCartography inventory = new CraftInventoryCartography(this.container, this.resultContainer);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
private final ContainerAccess containerAccess;
private long e;
public final IInventory inventory;
@@ -32,6 +54,13 @@
public static final int MAP_SLOT = 0;
public static final int ADDITIONAL_SLOT = 1;
public static final int RESULT_SLOT = 2;
@@ -38,6 +60,13 @@
ContainerCartography.this.a((IInventory) this);
super.update();
}
@@ -43,9 +43,9 @@
+ }
+ // CraftBukkit end
};
this.resultInventory = new InventoryCraftResult() {
this.resultContainer = new InventoryCraftResult() {
@Override
@@ -39,6 +68,13 @@
@@ -45,6 +74,13 @@
ContainerCartography.this.a((IInventory) this);
super.update();
}
@@ -57,9 +57,9 @@
+ }
+ // CraftBukkit end
};
this.containerAccess = containeraccess;
this.a(new Slot(this.inventory, 0, 15, 15) {
@@ -91,10 +127,12 @@
this.access = containeraccess;
this.a(new Slot(this.container, 0, 15, 15) {
@@ -95,10 +131,12 @@
this.a(new Slot(playerinventory, j, 8 + j * 18, 142));
}
@@ -69,6 +69,6 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.CARTOGRAPHY_TABLE);
return a(this.access, entityhuman, Blocks.CARTOGRAPHY_TABLE);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerChest.java
+++ b/net/minecraft/world/inventory/ContainerChest.java
@@ -6,10 +6,39 @@
@@ -6,11 +6,40 @@
import net.minecraft.world.entity.player.PlayerInventory;
import net.minecraft.world.item.ItemStack;
@@ -12,8 +12,9 @@
+
public class ContainerChest extends Container {
private static final int SLOTS_PER_ROW = 9;
private final IInventory container;
private final int d;
private final int containerRows;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
@@ -40,9 +41,9 @@
private ContainerChest(Containers<?> containers, int i, PlayerInventory playerinventory, int j) {
this(containers, i, playerinventory, new InventorySubcontainer(9 * j), j);
@@ -55,6 +84,10 @@
@@ -56,6 +85,10 @@
iinventory.startOpen(playerinventory.player);
int k = (this.d - 4) * 18;
int k = (this.containerRows - 4) * 18;
+ // CraftBukkit start - Save player
+ this.player = playerinventory;
@@ -51,7 +52,7 @@
int l;
int i1;
@@ -78,6 +111,7 @@
@@ -79,6 +112,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerDispenser.java
+++ b/net/minecraft/world/inventory/ContainerDispenser.java
@@ -6,9 +6,18 @@
@@ -6,6 +6,11 @@
import net.minecraft.world.entity.player.PlayerInventory;
import net.minecraft.world.item.ItemStack;
@@ -11,7 +11,11 @@
+
public class ContainerDispenser extends Container {
public final IInventory items;
private static final int SLOT_COUNT = 9;
@@ -14,6 +19,10 @@
private static final int USE_ROW_SLOT_START = 36;
private static final int USE_ROW_SLOT_END = 45;
public final IInventory dispenser;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
@@ -19,28 +23,28 @@
public ContainerDispenser(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new InventorySubcontainer(9));
@@ -16,6 +25,10 @@
@@ -21,6 +30,10 @@
public ContainerDispenser(int i, PlayerInventory playerinventory, IInventory iinventory) {
super(Containers.GENERIC_3X3, i);
super(Containers.GENERIC_3x3, i);
+ // CraftBukkit start - Save player
+ this.player = playerinventory;
+ // CraftBukkit end
+
a(iinventory, 9);
this.items = iinventory;
this.dispenser = iinventory;
iinventory.startOpen(playerinventory.player);
@@ -43,6 +56,7 @@
@@ -48,6 +61,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.items.a(entityhuman);
return this.dispenser.a(entityhuman);
}
@@ -84,4 +98,17 @@
@@ -89,4 +103,17 @@
super.b(entityhuman);
this.items.closeContainer(entityhuman);
this.dispenser.closeContainer(entityhuman);
}
+
+ // CraftBukkit start
@@ -50,7 +54,7 @@
+ return bukkitEntity;
+ }
+
+ CraftInventory inventory = new CraftInventory(this.items);
+ CraftInventory inventory = new CraftInventory(this.dispenser);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }

View File

@@ -24,15 +24,15 @@
private final IInventory enchantSlots;
@@ -29,6 +44,10 @@
public final int[] costs;
public final int[] enchantments;
public final int[] levels;
public final int[] enchantClue;
public final int[] levelClue;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private Player player;
+ // CraftBukkit end
public ContainerEnchantTable(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
this(i, playerinventory, ContainerAccess.NULL);
@@ -42,6 +61,13 @@
super.update();
ContainerEnchantTable.this.a((IInventory) this);
@@ -45,12 +45,12 @@
+ }
+ // CraftBukkit end
};
this.h = new Random();
this.i = ContainerProperty.a();
this.random = new Random();
this.enchantmentSeed = ContainerProperty.a();
@@ -89,6 +115,9 @@
this.a(ContainerProperty.a(this.levels, 0));
this.a(ContainerProperty.a(this.levels, 1));
this.a(ContainerProperty.a(this.levels, 2));
this.a(ContainerProperty.a(this.levelClue, 0));
this.a(ContainerProperty.a(this.levelClue, 1));
this.a(ContainerProperty.a(this.levelClue, 2));
+ // CraftBukkit start
+ player = (Player) playerinventory.player.getBukkitEntity();
+ // CraftBukkit end
@@ -63,17 +63,10 @@
- if (!itemstack.isEmpty() && itemstack.canEnchant()) {
+ if (!itemstack.isEmpty()) { // CraftBukkit - relax condition
this.containerAccess.a((world, blockposition) -> {
this.access.a((world, blockposition) -> {
int i = 0;
@@ -152,12 +181,47 @@
if (list != null && !list.isEmpty()) {
WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(this.h.nextInt(list.size()));
- this.enchantments[j] = IRegistry.ENCHANTMENT.a((Object) weightedrandomenchant.enchantment);
+ this.enchantments[j] = IRegistry.ENCHANTMENT.a(weightedrandomenchant.enchantment); // CraftBukkit - decompile error
this.levels[j] = weightedrandomenchant.level;
}
@@ -158,6 +187,41 @@
}
}
@@ -81,19 +74,19 @@
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.enchantments.EnchantmentOffer[] offers = new EnchantmentOffer[3];
+ for (j = 0; j < 3; ++j) {
+ org.bukkit.enchantments.Enchantment enchantment = (this.enchantments[j] >= 0) ? org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(IRegistry.ENCHANTMENT.fromId(this.enchantments[j])))) : null;
+ offers[j] = (enchantment != null) ? new EnchantmentOffer(enchantment, this.levels[j], this.costs[j]) : null;
+ org.bukkit.enchantments.Enchantment enchantment = (this.enchantClue[j] >= 0) ? org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(IRegistry.ENCHANTMENT.fromId(this.enchantClue[j])))) : null;
+ offers[j] = (enchantment != null) ? new EnchantmentOffer(enchantment, this.levelClue[j], this.costs[j]) : null;
+ }
+
+ PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), containerAccess.getLocation().getBlock(), item, offers, i);
+ PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), access.getLocation().getBlock(), item, offers, i);
+ event.setCancelled(!itemstack.canEnchant());
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ for (j = 0; j < 3; ++j) {
+ this.costs[j] = 0;
+ this.enchantments[j] = -1;
+ this.levels[j] = -1;
+ this.enchantClue[j] = -1;
+ this.levelClue[j] = -1;
+ }
+ return;
+ }
@@ -102,17 +95,17 @@
+ EnchantmentOffer offer = event.getOffers()[j];
+ if (offer != null) {
+ this.costs[j] = offer.getCost();
+ this.enchantments[j] = IRegistry.ENCHANTMENT.a(IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(offer.getEnchantment().getKey())));
+ this.levels[j] = offer.getEnchantmentLevel();
+ this.enchantClue[j] = IRegistry.ENCHANTMENT.getId(IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(offer.getEnchantment().getKey())));
+ this.levelClue[j] = offer.getEnchantmentLevel();
+ } else {
+ this.costs[j] = 0;
+ this.enchantments[j] = -1;
+ this.levels[j] = -1;
+ this.enchantClue[j] = -1;
+ this.levelClue[j] = -1;
+ }
+ }
+ // CraftBukkit end
+
this.c();
this.d();
});
} else {
@@ -184,9 +248,24 @@
@@ -124,7 +117,7 @@
+ // CraftBukkit start
+ if (true || !list.isEmpty()) {
+ // entityhuman.enchantDone(itemstack, j); // Moved down
boolean flag = itemstack.getItem() == Items.BOOK;
boolean flag = itemstack.a(Items.BOOK);
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
+ for (Object obj : list) {
+ WeightedRandomEnchant instance = (WeightedRandomEnchant) obj;
@@ -132,11 +125,11 @@
+ }
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack2);
+
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), containerAccess.getLocation().getBlock(), item, this.costs[i], enchants, i);
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), access.getLocation().getBlock(), item, this.costs[i], enchants, i);
+ world.getServer().getPluginManager().callEvent(event);
+
+ int level = event.getExpLevelCost();
+ if (event.isCancelled() || (level > entityhuman.expLevel && !entityhuman.abilities.canInstantlyBuild) || event.getEnchantsToAdd().isEmpty()) {
+ if (event.isCancelled() || (level > entityhuman.experienceLevel && !entityhuman.getAbilities().instabuild) || event.getEnchantsToAdd().isEmpty()) {
+ return;
+ }
@@ -175,18 +168,18 @@
+ // CraftBukkit end
+
+ // CraftBukkit - TODO: let plugins change this
if (!entityhuman.abilities.canInstantlyBuild) {
if (!entityhuman.getAbilities().instabuild) {
itemstack1.subtract(j);
if (itemstack1.isEmpty()) {
@@ -255,6 +347,7 @@
@@ -265,6 +357,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.ENCHANTING_TABLE);
return a(this.access, entityhuman, Blocks.ENCHANTING_TABLE);
}
@@ -306,4 +399,17 @@
@@ -316,4 +409,17 @@
return itemstack;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerFurnace.java
+++ b/net/minecraft/world/inventory/ContainerFurnace.java
@@ -14,6 +14,11 @@
@@ -12,6 +12,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.entity.TileEntityFurnace;
@@ -11,10 +11,10 @@
+
public abstract class ContainerFurnace extends ContainerRecipeBook<IInventory> {
private final IInventory furnace;
@@ -22,6 +27,22 @@
private final Recipes<? extends RecipeCooking> f;
private final RecipeBookType g;
public static final int INGREDIENT_SLOT = 0;
@@ -29,6 +34,22 @@
private final Recipes<? extends RecipeCooking> recipeType;
private final RecipeBookType recipeBookType;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
@@ -26,7 +26,7 @@
+ return bukkitEntity;
+ }
+
+ CraftInventoryFurnace inventory = new CraftInventoryFurnace((TileEntityFurnace) this.furnace);
+ CraftInventoryFurnace inventory = new CraftInventoryFurnace((TileEntityFurnace) this.container);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
@@ -35,7 +35,7 @@
protected ContainerFurnace(Containers<?> containers, Recipes<? extends RecipeCooking> recipes, RecipeBookType recipebooktype, int i, PlayerInventory playerinventory) {
this(containers, recipes, recipebooktype, i, playerinventory, new InventorySubcontainer(3), new ContainerProperties(4));
}
@@ -38,6 +59,7 @@
@@ -45,6 +66,7 @@
this.a(new Slot(iinventory, 0, 56, 17));
this.a((Slot) (new SlotFurnaceFuel(this, iinventory, 1, 56, 53)));
this.a((Slot) (new SlotFurnaceResult(playerinventory.player, iinventory, 2, 116, 35)));
@@ -43,29 +43,20 @@
int j;
@@ -69,7 +91,7 @@
@Override
public void a(boolean flag, IRecipe<?> irecipe, EntityPlayer entityplayer) {
- (new AutoRecipeFurnace<>(this)).a(entityplayer, irecipe, flag);
+ (new AutoRecipeFurnace(this)).a(entityplayer, irecipe, flag); // CraftBukkit - decompile error
}
@Override
@@ -94,6 +116,7 @@
@@ -102,6 +124,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.furnace.a(entityhuman);
return this.container.a(entityhuman);
}
@@ -149,7 +172,7 @@
@@ -157,7 +180,7 @@
}
protected boolean a(ItemStack itemstack) {
- return this.c.getCraftingManager().craft(this.f, new InventorySubcontainer(new ItemStack[]{itemstack}), this.c).isPresent();
+ return this.c.getCraftingManager().craft((Recipes<RecipeCooking>) this.f, new InventorySubcontainer(new ItemStack[]{itemstack}), this.c).isPresent(); // Eclipse fail
protected boolean c(ItemStack itemstack) {
- return this.level.getCraftingManager().craft(this.recipeType, new InventorySubcontainer(new ItemStack[]{itemstack}), this.level).isPresent();
+ return this.level.getCraftingManager().craft((Recipes<RecipeCooking>) this.recipeType, new InventorySubcontainer(new ItemStack[]{itemstack}), this.level).isPresent(); // Eclipse fail
}
protected boolean b(ItemStack itemstack) {
protected boolean d(ItemStack itemstack) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/inventory/ContainerGrindstone.java
+++ b/net/minecraft/world/inventory/ContainerGrindstone.java
@@ -17,8 +17,30 @@
import net.minecraft.world.level.World;
@@ -20,8 +20,30 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.Location;
@@ -23,15 +23,15 @@
+ return bukkitEntity;
+ }
+
+ CraftInventoryGrindstone inventory = new CraftInventoryGrindstone(this.craftInventory, this.resultInventory);
+ CraftInventoryGrindstone inventory = new CraftInventoryGrindstone(this.repairSlots, this.resultSlots);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
private final IInventory resultInventory;
private final IInventory craftInventory;
private final ContainerAccess containerAccess;
@@ -36,6 +58,13 @@
public static final int MAX_NAME_LENGTH = 35;
public static final int INPUT_SLOT = 0;
public static final int ADDITIONAL_SLOT = 1;
@@ -47,6 +69,13 @@
super.update();
ContainerGrindstone.this.a((IInventory) this);
}
@@ -43,9 +43,9 @@
+ }
+ // CraftBukkit end
};
this.containerAccess = containeraccess;
this.a(new Slot(this.craftInventory, 0, 49, 19) {
@@ -120,6 +149,7 @@
this.access = containeraccess;
this.a(new Slot(this.repairSlots, 0, 49, 19) {
@@ -125,6 +154,7 @@
this.a(new Slot(playerinventory, j, 8 + j * 18, 142));
}
@@ -53,11 +53,11 @@
}
@Override
@@ -247,6 +277,7 @@
@@ -252,6 +282,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.GRINDSTONE);
return a(this.access, entityhuman, Blocks.GRINDSTONE);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerHopper.java
+++ b/net/minecraft/world/inventory/ContainerHopper.java
@@ -6,10 +6,31 @@
@@ -6,11 +6,32 @@
import net.minecraft.world.entity.player.PlayerInventory;
import net.minecraft.world.item.ItemStack;
@@ -11,6 +11,7 @@
+
public class ContainerHopper extends Container {
public static final int CONTAINER_SIZE = 5;
private final IInventory hopper;
+ // CraftBukkit start
@@ -32,7 +33,7 @@
public ContainerHopper(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new InventorySubcontainer(5));
}
@@ -17,6 +38,7 @@
@@ -18,6 +39,7 @@
public ContainerHopper(int i, PlayerInventory playerinventory, IInventory iinventory) {
super(Containers.HOPPER, i);
this.hopper = iinventory;
@@ -40,7 +41,7 @@
a(iinventory, 5);
iinventory.startOpen(playerinventory.player);
boolean flag = true;
@@ -41,6 +63,7 @@
@@ -42,6 +64,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {

View File

@@ -11,8 +11,8 @@
+
public class ContainerHorse extends Container {
private final IInventory c;
private final EntityHorseAbstract d;
private final IInventory horseContainer;
private final EntityHorseAbstract horse;
+ // CraftBukkit start
+ org.bukkit.craftbukkit.inventory.CraftInventoryView bukkitEntity;
@@ -24,13 +24,13 @@
+ return bukkitEntity;
+ }
+
+ return bukkitEntity = new CraftInventoryView(player.player.getBukkitEntity(), c.getOwner().getInventory(), this);
+ return bukkitEntity = new CraftInventoryView(player.player.getBukkitEntity(), horseContainer.getOwner().getInventory(), this);
+ }
+
public ContainerHorse(int i, PlayerInventory playerinventory, IInventory iinventory, final EntityHorseAbstract entityhorseabstract) {
super((Containers) null, i);
+ player = playerinventory;
+ // CraftBukkit end
this.c = iinventory;
this.d = entityhorseabstract;
this.horseContainer = iinventory;
this.horse = entityhorseabstract;
boolean flag = true;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerLectern.java
+++ b/net/minecraft/world/inventory/ContainerLectern.java
@@ -5,16 +5,43 @@
@@ -5,8 +5,33 @@
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.ItemStack;
@@ -26,13 +26,17 @@
+ return bukkitEntity;
+ }
+
+ CraftInventoryLectern inventory = new CraftInventoryLectern(this.inventory);
+ CraftInventoryLectern inventory = new CraftInventoryLectern(this.lectern);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
private final IInventory inventory;
private final IContainerProperties containerProperties;
private static final int DATA_COUNT = 1;
private static final int SLOT_COUNT = 1;
public static final int BUTTON_PREV_PAGE = 1;
@@ -16,11 +41,13 @@
private final IInventory lectern;
private final IContainerProperties lecternData;
- public ContainerLectern(int i) {
- this(i, new InventorySubcontainer(1), new ContainerProperties(1));
@@ -47,7 +51,7 @@
super(Containers.LECTERN, i);
a(iinventory, 1);
a(icontainerproperties, 1);
@@ -28,6 +55,7 @@
@@ -34,6 +61,7 @@
}
});
this.a(icontainerproperties);
@@ -55,7 +59,7 @@
}
@Override
@@ -53,6 +81,13 @@
@@ -59,6 +87,13 @@
return false;
}
@@ -66,15 +70,15 @@
+ return false;
+ }
+ // CraftBukkit end
ItemStack itemstack = this.inventory.splitWithoutUpdate(0);
ItemStack itemstack = this.lectern.splitWithoutUpdate(0);
this.inventory.update();
@@ -75,6 +110,8 @@
this.lectern.update();
@@ -81,6 +116,8 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (inventory instanceof LecternInventory && !((LecternInventory) inventory).getLectern().hasBook()) return false; // CraftBukkit
+ if (lectern instanceof LecternInventory && !((LecternInventory) lectern).getLectern().hasBook()) return false; // CraftBukkit
+ if (!this.checkReachable) return true; // CraftBukkit
return this.inventory.a(entityhuman);
return this.lectern.a(entityhuman);
}
}

View File

@@ -23,17 +23,17 @@
+ return bukkitEntity;
+ }
+
+ CraftInventoryLoom inventory = new CraftInventoryLoom(this.craftInventory, this.resultInventory);
+ CraftInventoryLoom inventory = new CraftInventoryLoom(this.inputContainer, this.outputContainer);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
private final ContainerAccess containerAccess;
private final ContainerProperty d;
private Runnable e;
@@ -45,6 +67,13 @@
private static final int INV_SLOT_START = 4;
private static final int INV_SLOT_END = 31;
private static final int USE_ROW_SLOT_START = 31;
@@ -49,6 +71,13 @@
ContainerLoom.this.a((IInventory) this);
ContainerLoom.this.e.run();
ContainerLoom.this.slotUpdateListener.run();
}
+
+ // CraftBukkit start
@@ -43,11 +43,11 @@
+ }
+ // CraftBukkit end
};
this.resultInventory = new InventorySubcontainer(1) {
this.outputContainer = new InventorySubcontainer(1) {
@Override
@@ -52,6 +81,13 @@
@@ -56,6 +85,13 @@
super.update();
ContainerLoom.this.e.run();
ContainerLoom.this.slotUpdateListener.run();
}
+
+ // CraftBukkit start
@@ -57,22 +57,25 @@
+ }
+ // CraftBukkit end
};
this.containerAccess = containeraccess;
this.f = this.a(new Slot(this.craftInventory, 0, 13, 26) {
@@ -112,10 +148,12 @@
this.access = containeraccess;
this.bannerSlot = this.a(new Slot(this.inputContainer, 0, 13, 26) {
@@ -116,6 +152,7 @@
}
this.a(this.d);
this.a(this.selectedBannerPatternIndex);
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
}
public int i() {
@@ -124,6 +161,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.LOOM);
return a(this.access, entityhuman, Blocks.LOOM);
}
@@ -234,6 +272,11 @@
@@ -246,6 +284,11 @@
if (nbttagcompound.hasKeyOfType("Patterns", 9)) {
nbttaglist = nbttagcompound.getList("Patterns", 10);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerMerchant.java
+++ b/net/minecraft/world/inventory/ContainerMerchant.java
@@ -12,11 +12,26 @@
@@ -12,6 +12,8 @@
import net.minecraft.world.item.trading.MerchantRecipe;
import net.minecraft.world.item.trading.MerchantRecipeList;
@@ -8,8 +8,10 @@
+
public class ContainerMerchant extends Container {
private final IMerchant merchant;
private final InventoryMerchant inventoryMerchant;
protected static final int PAYMENT1_SLOT = 0;
@@ -31,6 +33,19 @@
private boolean showProgressBar;
private boolean canRestock;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
@@ -18,7 +20,7 @@
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity == null) {
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant(merchant, inventoryMerchant), this);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant(trader, tradeContainer), this);
+ }
+ return bukkitEntity;
+ }
@@ -27,20 +29,20 @@
public ContainerMerchant(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new MerchantWrapper(playerinventory.player));
}
@@ -28,6 +43,7 @@
this.a(new Slot(this.inventoryMerchant, 0, 136, 37));
this.a(new Slot(this.inventoryMerchant, 1, 162, 37));
this.a((Slot) (new SlotMerchantResult(playerinventory.player, imerchant, this.inventoryMerchant, 2, 220, 37)));
@@ -42,6 +57,7 @@
this.a(new Slot(this.tradeContainer, 0, 136, 37));
this.a(new Slot(this.tradeContainer, 1, 162, 37));
this.a((Slot) (new SlotMerchantResult(playerinventory.player, imerchant, this.tradeContainer, 2, 220, 37)));
+ this.player = playerinventory; // CraftBukkit - save player
int j;
@@ -108,7 +124,7 @@
@@ -154,7 +170,7 @@
}
private void k() {
- if (!this.merchant.getWorld().isClientSide) {
+ if (!this.merchant.getWorld().isClientSide && this.merchant instanceof Entity) { // CraftBukkit - SPIGOT-5035
Entity entity = (Entity) this.merchant;
private void o() {
- if (!this.trader.getWorld().isClientSide) {
+ if (!this.trader.getWorld().isClientSide && this.trader instanceof Entity) { // CraftBukkit - SPIGOT-5035
Entity entity = (Entity) this.trader;
this.merchant.getWorld().a(entity.locX(), entity.locY(), entity.locZ(), this.merchant.getTradeSound(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false);
this.trader.getWorld().a(entity.locX(), entity.locY(), entity.locZ(), this.trader.getTradeSound(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerPlayer.java
+++ b/net/minecraft/world/inventory/ContainerPlayer.java
@@ -11,6 +11,12 @@
@@ -12,6 +12,12 @@
import net.minecraft.world.item.crafting.IRecipe;
import net.minecraft.world.item.enchantment.EnchantmentManager;
@@ -12,18 +12,18 @@
+
public class ContainerPlayer extends ContainerRecipeBook<InventoryCrafting> {
public static final MinecraftKey c = new MinecraftKey("textures/atlas/blocks.png");
@@ -21,15 +27,28 @@
public static final MinecraftKey h = new MinecraftKey("item/empty_armor_slot_shield");
private static final MinecraftKey[] j = new MinecraftKey[]{ContainerPlayer.g, ContainerPlayer.f, ContainerPlayer.e, ContainerPlayer.d};
private static final EnumItemSlot[] k = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
- private final InventoryCrafting craftInventory = new InventoryCrafting(this, 2, 2);
- private final InventoryCraftResult resultInventory = new InventoryCraftResult();
public static final int CONTAINER_ID = 0;
@@ -33,15 +39,28 @@
public static final MinecraftKey EMPTY_ARMOR_SLOT_SHIELD = new MinecraftKey("item/empty_armor_slot_shield");
static final MinecraftKey[] TEXTURE_EMPTY_SLOTS = new MinecraftKey[]{ContainerPlayer.EMPTY_ARMOR_SLOT_BOOTS, ContainerPlayer.EMPTY_ARMOR_SLOT_LEGGINGS, ContainerPlayer.EMPTY_ARMOR_SLOT_CHESTPLATE, ContainerPlayer.EMPTY_ARMOR_SLOT_HELMET};
private static final EnumItemSlot[] SLOT_IDS = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
- private final InventoryCrafting craftSlots = new InventoryCrafting(this, 2, 2);
- private final InventoryCraftResult resultSlots = new InventoryCraftResult();
+ // CraftBukkit start
+ private final InventoryCrafting craftInventory;
+ private final InventoryCraftResult resultInventory;
+ private final InventoryCrafting craftSlots;
+ private final InventoryCraftResult resultSlots;
+ // CraftBukkit end
public final boolean i;
public final boolean active;
private final EntityHuman owner;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
@@ -32,30 +32,21 @@
public ContainerPlayer(PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) {
super((Containers) null, 0);
this.i = flag;
this.active = flag;
this.owner = entityhuman;
+ // CraftBukkit start
+ this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction
+ this.craftInventory = new InventoryCrafting(this, 2, 2, playerinventory.player); // CraftBukkit - pass player
+ this.craftInventory.resultInventory = this.resultInventory; // CraftBukkit - let InventoryCrafting know about its result slot
+ this.resultSlots = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction
+ this.craftSlots = new InventoryCrafting(this, 2, 2, playerinventory.player); // CraftBukkit - pass player
+ this.craftSlots.resultInventory = this.resultSlots; // CraftBukkit - let InventoryCrafting know about its result slot
+ this.player = playerinventory; // CraftBukkit - save player
+ setTitle(new ChatMessage("container.crafting")); // SPIGOT-4722: Allocate title for player inventory
+ // CraftBukkit end
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 154, 28)));
this.a((Slot) (new SlotResult(playerinventory.player, this.craftSlots, this.resultSlots, 0, 154, 28)));
int i;
@@ -96,7 +115,7 @@
@Override
public void a(IInventory iinventory) {
- ContainerWorkbench.a(this.windowId, this.owner.world, this.owner, this.craftInventory, this.resultInventory);
+ ContainerWorkbench.a(this.windowId, this.owner.world, this.owner, this.craftInventory, this.resultInventory, this); // CraftBukkit
}
@Override
@@ -203,4 +222,17 @@
public InventoryCrafting j() {
return this.craftInventory;
@@ -242,4 +261,17 @@
public boolean d(int i) {
return i != this.j();
}
+
+ // CraftBukkit start
@@ -65,7 +56,7 @@
+ return bukkitEntity;
+ }
+
+ CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory);
+ CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftSlots, this.resultSlots);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerShulkerBox.java
+++ b/net/minecraft/world/inventory/ContainerShulkerBox.java
@@ -6,9 +6,28 @@
@@ -6,10 +6,29 @@
import net.minecraft.world.entity.player.PlayerInventory;
import net.minecraft.world.item.ItemStack;
@@ -11,7 +11,8 @@
+
public class ContainerShulkerBox extends Container {
private final IInventory c;
private static final int CONTAINER_SIZE = 27;
private final IInventory container;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity;
+ private PlayerInventory player;
@@ -22,17 +23,17 @@
+ return bukkitEntity;
+ }
+
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new CraftInventory(this.c), this);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new CraftInventory(this.container), this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
public ContainerShulkerBox(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new InventorySubcontainer(27));
@@ -18,6 +37,7 @@
@@ -19,6 +38,7 @@
super(Containers.SHULKER_BOX, i);
a(iinventory, 27);
this.c = iinventory;
this.container = iinventory;
+ this.player = playerinventory; // CraftBukkit - save player
iinventory.startOpen(playerinventory.player);
boolean flag = true;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerSmithing.java
+++ b/net/minecraft/world/inventory/ContainerSmithing.java
@@ -12,12 +12,17 @@
@@ -11,12 +11,17 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -8,37 +8,37 @@
+
public class ContainerSmithing extends ContainerAnvilAbstract {
private final World g;
private final World level;
@Nullable
private RecipeSmithing h;
private final List<RecipeSmithing> i;
private RecipeSmithing selectedRecipe;
private final List<RecipeSmithing> recipes;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity;
+ // CraftBukkit end
public ContainerSmithing(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -63,13 +68,15 @@
List<RecipeSmithing> list = this.g.getCraftingManager().b(Recipes.SMITHING, this.repairInventory, this.g);
this(i, playerinventory, ContainerAccess.NULL);
@@ -61,13 +66,15 @@
List<RecipeSmithing> list = this.level.getCraftingManager().b(Recipes.SMITHING, this.inputSlots, this.level);
if (list.isEmpty()) {
- this.resultInventory.setItem(0, ItemStack.b);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), ItemStack.b); // CraftBukkit
- this.resultSlots.setItem(0, ItemStack.EMPTY);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
} else {
this.h = (RecipeSmithing) list.get(0);
ItemStack itemstack = this.h.a(this.repairInventory);
this.selectedRecipe = (RecipeSmithing) list.get(0);
ItemStack itemstack = this.selectedRecipe.a(this.inputSlots);
this.resultInventory.a((IRecipe) this.h);
- this.resultInventory.setItem(0, itemstack);
this.resultSlots.setRecipeUsed(this.selectedRecipe);
- this.resultSlots.setItem(0, itemstack);
+ // CraftBukkit start
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack);
+ // CraftBukkit end
}
}
@@ -85,4 +92,18 @@
@@ -83,4 +90,18 @@
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
return slot.container != this.resultSlots && super.a(itemstack, slot);
}
+
+ // CraftBukkit start
@@ -49,7 +49,7 @@
+ }
+
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventorySmithing(
+ containerAccess.getLocation(), this.repairInventory, this.resultInventory);
+ access.getLocation(), this.inputSlots, this.resultSlots);
+ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerStonecutter.java
+++ b/net/minecraft/world/inventory/ContainerStonecutter.java
@@ -16,6 +16,13 @@
@@ -15,6 +15,13 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Blocks;
@@ -13,11 +13,11 @@
+
public class ContainerStonecutter extends Container {
private final ContainerAccess containerAccess;
@@ -29,6 +36,21 @@
private Runnable l;
public final IInventory inventory;
private final InventoryCraftResult resultInventory;
public static final int INPUT_SLOT = 0;
@@ -34,6 +41,21 @@
Runnable slotUpdateListener;
public final IInventory container;
final InventoryCraftResult resultContainer;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private Player player;
@@ -28,17 +28,17 @@
+ return bukkitEntity;
+ }
+
+ CraftInventoryStonecutter inventory = new CraftInventoryStonecutter(this.inventory, this.resultInventory);
+ CraftInventoryStonecutter inventory = new CraftInventoryStonecutter(this.container, this.resultContainer);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
public ContainerStonecutter(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -48,6 +70,13 @@
this(i, playerinventory, ContainerAccess.NULL);
@@ -53,6 +75,13 @@
ContainerStonecutter.this.a((IInventory) this);
ContainerStonecutter.this.l.run();
ContainerStonecutter.this.slotUpdateListener.run();
}
+
+ // CraftBukkit start
@@ -48,18 +48,21 @@
+ }
+ // CraftBukkit end
};
this.resultInventory = new InventoryCraftResult();
this.containerAccess = containeraccess;
@@ -95,10 +124,12 @@
this.resultContainer = new InventoryCraftResult();
this.access = containeraccess;
@@ -100,6 +129,7 @@
}
this.a(this.containerProperty);
this.a(this.selectedRecipeIndex);
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
}
public int i() {
@@ -120,6 +150,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.STONECUTTER);
return a(this.access, entityhuman, Blocks.STONECUTTER);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerWorkbench.java
+++ b/net/minecraft/world/inventory/ContainerWorkbench.java
@@ -14,12 +14,21 @@
@@ -14,6 +14,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Blocks;
@@ -11,68 +11,53 @@
+
public class ContainerWorkbench extends ContainerRecipeBook<InventoryCrafting> {
private final InventoryCrafting craftInventory;
private final InventoryCraftResult resultInventory;
public final ContainerAccess containerAccess;
private final EntityHuman f;
public static final int RESULT_SLOT = 0;
@@ -27,6 +32,9 @@
private final InventoryCraftResult resultSlots;
public final ContainerAccess access;
private final EntityHuman player;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+ // CraftBukkit end
public ContainerWorkbench(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -27,8 +36,12 @@
this(i, playerinventory, ContainerAccess.NULL);
@@ -34,8 +42,11 @@
public ContainerWorkbench(int i, PlayerInventory playerinventory, ContainerAccess containeraccess) {
super(Containers.CRAFTING, i);
- this.craftInventory = new InventoryCrafting(this, 3, 3);
- this.craftSlots = new InventoryCrafting(this, 3, 3);
+ // CraftBukkit start - Switched order of IInventory construction and stored player
this.resultInventory = new InventoryCraftResult();
+ this.craftInventory = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player
+ this.craftInventory.resultInventory = this.resultInventory;
+ this.player = playerinventory;
this.resultSlots = new InventoryCraftResult();
+ this.craftSlots = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player
+ this.craftSlots.resultInventory = this.resultSlots;
+ // CraftBukkit end
this.containerAccess = containeraccess;
this.f = playerinventory.player;
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 124, 35)));
@@ -54,7 +67,7 @@
this.access = containeraccess;
this.player = playerinventory.player;
this.a((Slot) (new SlotResult(playerinventory.player, this.craftSlots, this.resultSlots, 0, 124, 35)));
@@ -71,9 +82,10 @@
RecipeCrafting recipecrafting = (RecipeCrafting) optional.get();
}
- protected static void a(int i, World world, EntityHuman entityhuman, InventoryCrafting inventorycrafting, InventoryCraftResult inventorycraftresult) {
+ protected static void a(int i, World world, EntityHuman entityhuman, InventoryCrafting inventorycrafting, InventoryCraftResult inventorycraftresult, Container container) { // CraftBukkit
if (!world.isClientSide) {
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
ItemStack itemstack = ItemStack.b;
@@ -67,6 +80,7 @@
itemstack = recipecrafting.a(inventorycrafting);
if (inventorycraftresult.setRecipeUsed(world, entityplayer, recipecrafting)) {
- itemstack = recipecrafting.a((IInventory) inventorycrafting);
+ itemstack = recipecrafting.a(inventorycrafting); // CraftBukkit - decompile error
}
}
+ itemstack = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycraftresult, itemstack, container.getBukkitView(), false); // CraftBukkit
inventorycraftresult.setItem(0, itemstack);
entityplayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(i, 0, itemstack));
@@ -76,7 +90,7 @@
@Override
public void a(IInventory iinventory) {
this.containerAccess.a((world, blockposition) -> {
- a(this.windowId, world, this.f, this.craftInventory, this.resultInventory);
+ a(this.windowId, world, this.f, this.craftInventory, this.resultInventory, this); // CraftBukkit
});
}
@@ -106,6 +120,7 @@
container.a(0, itemstack);
@@ -114,6 +126,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.CRAFTING_TABLE);
return a(this.access, entityhuman, Blocks.CRAFTING_TABLE);
}
@@ -180,4 +195,17 @@
public int h() {
return this.craftInventory.f();
@@ -202,4 +215,17 @@
public boolean d(int i) {
return i != this.j();
}
+
+ // CraftBukkit start
@@ -82,8 +67,8 @@
+ return bukkitEntity;
+ }
+
+ CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftSlots, this.resultSlots);
+ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/inventory/Containers.java
+++ b/net/minecraft/world/inventory/Containers.java
@@ -2,6 +2,10 @@
@@ -3,6 +3,10 @@
import net.minecraft.core.IRegistry;
import net.minecraft.world.entity.player.PlayerInventory;
+// CraftBukkit start
+import net.minecraft.world.entity.player.PlayerInventory;
@@ -10,8 +10,8 @@
+
public class Containers<T extends Container> {
public static final Containers<ContainerChest> GENERIC_9X1 = a("generic_9x1", ContainerChest::a);
@@ -21,7 +25,7 @@
public static final Containers<ContainerChest> GENERIC_9x1 = a("generic_9x1", ContainerChest::a);
@@ -22,7 +26,7 @@
public static final Containers<ContainerGrindstone> GRINDSTONE = a("grindstone", ContainerGrindstone::new);
public static final Containers<ContainerHopper> HOPPER = a("hopper", ContainerHopper::new);
public static final Containers<ContainerLectern> LECTERN = a("lectern", (i, playerinventory) -> {
@@ -20,8 +20,8 @@
});
public static final Containers<ContainerLoom> LOOM = a("loom", ContainerLoom::new);
public static final Containers<ContainerMerchant> MERCHANT = a("merchant", ContainerMerchant::new);
@@ -33,12 +37,17 @@
private final Containers.Supplier<T> y;
@@ -34,7 +38,7 @@
private final Containers.Supplier<T> constructor;
private static <T extends Container> Containers<T> a(String s, Containers.Supplier<T> containers_supplier) {
- return (Containers) IRegistry.a(IRegistry.MENU, s, (Object) (new Containers<>(containers_supplier)));
@@ -29,14 +29,3 @@
}
private Containers(Containers.Supplier<T> containers_supplier) {
this.y = containers_supplier;
}
- interface Supplier<T extends Container> {}
+ // CraftBukkit start
+ interface Supplier<T extends Container> {
+
+ T supply(int id, PlayerInventory playerinventory);
+ }
+ // CraftBukkit end
}

View File

@@ -12,15 +12,15 @@
+
public class InventoryCraftResult implements IInventory, RecipeHolder {
private final NonNullList<ItemStack> items;
private final NonNullList<ItemStack> itemStacks;
@Nullable
private IRecipe<?> b;
private IRecipe<?> recipeUsed;
+ // CraftBukkit start
+ private int maxStack = MAX_STACK;
+
+ public java.util.List<ItemStack> getContents() {
+ return this.items;
+ return this.itemStacks;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
@@ -50,5 +50,5 @@
+ // CraftBukkit end
+
public InventoryCraftResult() {
this.items = NonNullList.a(1, ItemStack.b);
this.itemStacks = NonNullList.a(1, ItemStack.EMPTY);
}

View File

@@ -17,8 +17,8 @@
private final NonNullList<ItemStack> items;
@@ -15,6 +24,68 @@
private final int c;
public final Container container;
private final int height;
public final Container menu;
+ // CraftBukkit start - add fields
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@@ -63,7 +63,7 @@
+
+ @Override
+ public Location getLocation() {
+ return container instanceof ContainerWorkbench ? ((ContainerWorkbench) container).containerAccess.getLocation() : owner.getBukkitEntity().getLocation();
+ return menu instanceof ContainerWorkbench ? ((ContainerWorkbench) menu).access.getLocation() : owner.getBukkitEntity().getLocation();
+ }
+
+ @Override
@@ -83,5 +83,5 @@
+ // CraftBukkit end
+
public InventoryCrafting(Container container, int i, int j) {
this.items = NonNullList.a(i * j, ItemStack.b);
this.container = container;
this.items = NonNullList.a(i * j, ItemStack.EMPTY);
this.menu = container;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/InventoryEnderChest.java
+++ b/net/minecraft/world/inventory/InventoryEnderChest.java
@@ -7,12 +7,30 @@
@@ -8,13 +8,31 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.TileEntityEnderChest;
@@ -11,7 +11,8 @@
+
public class InventoryEnderChest extends InventorySubcontainer {
private TileEntityEnderChest a;
@Nullable
private TileEntityEnderChest activeChest;
+ // CraftBukkit start
+ private final EntityHuman owner;
+
@@ -21,7 +22,7 @@
+
+ @Override
+ public Location getLocation() {
+ return this.a != null ? new Location(this.a.getWorld().getWorld(), this.a.getPosition().getX(), this.a.getPosition().getY(), this.a.getPosition().getZ()) : null;
+ return this.activeChest != null ? new Location(this.activeChest.getWorld().getWorld(), this.activeChest.getPosition().getX(), this.activeChest.getPosition().getY(), this.activeChest.getPosition().getZ()) : null;
+ }
- public InventoryEnderChest() {

View File

@@ -18,15 +18,15 @@
private final IMerchant merchant;
@@ -20,6 +30,46 @@
public int selectedIndex;
private int e;
public int selectionHint;
private int futureXp;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ public List<ItemStack> getContents() {
+ return this.itemsInSlots;
+ return this.itemStacks;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
@@ -62,5 +62,5 @@
+ // CraftBukkit end
+
public InventoryMerchant(IMerchant imerchant) {
this.itemsInSlots = NonNullList.a(3, ItemStack.b);
this.itemStacks = NonNullList.a(3, ItemStack.EMPTY);
this.merchant = imerchant;

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/inventory/SlotFurnaceResult.java
+++ b/net/minecraft/world/inventory/SlotFurnaceResult.java
@@ -46,7 +46,7 @@
protected void c(ItemStack itemstack) {
itemstack.a(this.a.world, this.a, this.b);
if (!this.a.world.isClientSide && this.inventory instanceof TileEntityFurnace) {
- ((TileEntityFurnace) this.inventory).d(this.a);
+ ((TileEntityFurnace) this.inventory).d(this.a, itemstack, this.b); // CraftBukkit
protected void b_(ItemStack itemstack) {
itemstack.a(this.player.level, this.player, this.removeCount);
if (this.player instanceof EntityPlayer && this.container instanceof TileEntityFurnace) {
- ((TileEntityFurnace) this.container).a((EntityPlayer) this.player);
+ ((TileEntityFurnace) this.container).a((EntityPlayer) this.player, itemstack, this.removeCount); // CraftBukkit
}
this.b = 0;
this.removeCount = 0;