3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00

[Bleeding] Make crafting and enchanting inventories keep track of their owner rather than returning null. Addresses BUKKIT-1209

Dieser Commit ist enthalten in:
Celtic Minstrel 2012-03-13 22:50:09 -04:00 committet von EvilSeph
Ursprung 4bcbe2d235
Commit b9a71db046
4 geänderte Dateien mit 7 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -50,7 +50,10 @@ public class ContainerEnchantTable extends Container {
for (l = 0; l < 9; ++l) { for (l = 0; l < 9; ++l) {
this.a(new Slot(playerinventory, l, 8 + l * 18, 142)); this.a(new Slot(playerinventory, l, 8 + l * 18, 142));
} }
player = (Player) playerinventory.player.bukkitEntity; // CraftBukkit // CraftBukkit start
player = (Player) playerinventory.player.bukkitEntity;
enchantSlots.player = player;
// CraftBukkit end
} }
public void addSlotListener(ICrafting icrafting) { public void addSlotListener(ICrafting icrafting) {

Datei anzeigen

@ -38,7 +38,7 @@ public class ContainerEnchantTableSubcontainer implements IInventory {
} }
public InventoryHolder getOwner() { public InventoryHolder getOwner() {
return null; // TODO: Enchanting tables don't really have an owner? Maybe they should? return this.player;
} }
public void setMaxStackSize(int size) { public void setMaxStackSize(int size) {

Datei anzeigen

@ -21,7 +21,7 @@ public class ContainerPlayer extends Container {
public ContainerPlayer(PlayerInventory playerinventory, boolean flag) { public ContainerPlayer(PlayerInventory playerinventory, boolean flag) {
this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction
this.craftInventory = new InventoryCrafting(this, 2, 2); 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.craftInventory.resultInventory = this.resultInventory; // CraftBukkit - let InventoryCrafting know about its result slot
this.player = playerinventory; // CraftBukkit - save player this.player = playerinventory; // CraftBukkit - save player
this.c = false; this.c = false;

Datei anzeigen

@ -21,7 +21,7 @@ public class ContainerWorkbench extends Container {
public ContainerWorkbench(PlayerInventory playerinventory, World world, int i, int j, int k) { public ContainerWorkbench(PlayerInventory playerinventory, World world, int i, int j, int k) {
// CraftBukkit start - switched order of IInventory construction and stored player // CraftBukkit start - switched order of IInventory construction and stored player
this.resultInventory = new InventoryCraftResult(); this.resultInventory = new InventoryCraftResult();
this.craftInventory = new InventoryCrafting(this, 3, 3); this.craftInventory = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player
this.craftInventory.resultInventory = this.resultInventory; this.craftInventory.resultInventory = this.resultInventory;
this.player = playerinventory; this.player = playerinventory;
// CraftBukkit end // CraftBukkit end