geforkt von Mirrors/Paper
Fixed NPE while clearing a slot
Dieser Commit ist enthalten in:
Ursprung
ceaf94d5bb
Commit
0ae550a11c
@ -209,6 +209,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
|||||||
|
|
||||||
public void a(int i, int j, int k) {
|
public void a(int i, int j, int k) {
|
||||||
U();
|
U();
|
||||||
|
System.out.println("OPEN_WINDOW for WorkBench");
|
||||||
a.b(((Packet) (new Packet100(bG, 1, "Crafting", 9))));
|
a.b(((Packet) (new Packet100(bG, 1, "Crafting", 9))));
|
||||||
ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, l, i, j, k)));
|
ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, l, i, j, k)));
|
||||||
ap.f = bG;
|
ap.f = bG;
|
||||||
@ -217,6 +218,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
|||||||
|
|
||||||
public void a(IInventory iinventory) {
|
public void a(IInventory iinventory) {
|
||||||
U();
|
U();
|
||||||
|
System.out.println("OPEN_WINDOW for Chest");
|
||||||
a.b(((Packet) (new Packet100(bG, 0, iinventory.b(), iinventory.h_()))));
|
a.b(((Packet) (new Packet100(bG, 0, iinventory.b(), iinventory.h_()))));
|
||||||
ap = ((CraftingInventoryCB) (new CraftingInventoryChestCB(((IInventory) (an)), iinventory)));
|
ap = ((CraftingInventoryCB) (new CraftingInventoryChestCB(((IInventory) (an)), iinventory)));
|
||||||
ap.f = bG;
|
ap.f = bG;
|
||||||
@ -225,6 +227,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
|||||||
|
|
||||||
public void a(TileEntityFurnace tileentityfurnace) {
|
public void a(TileEntityFurnace tileentityfurnace) {
|
||||||
U();
|
U();
|
||||||
|
System.out.println("OPEN_WINDOW for Furnace");
|
||||||
a.b(((Packet) (new Packet100(bG, 2, tileentityfurnace.b(), tileentityfurnace.h_()))));
|
a.b(((Packet) (new Packet100(bG, 2, tileentityfurnace.b(), tileentityfurnace.h_()))));
|
||||||
ap = ((CraftingInventoryCB) (new CraftingInventoryFurnaceCB(((IInventory) (an)), tileentityfurnace)));
|
ap = ((CraftingInventoryCB) (new CraftingInventoryFurnaceCB(((IInventory) (an)), tileentityfurnace)));
|
||||||
ap.f = bG;
|
ap.f = bG;
|
||||||
@ -233,6 +236,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
|||||||
|
|
||||||
public void a(TileEntityDispenser tileentitydispenser) {
|
public void a(TileEntityDispenser tileentitydispenser) {
|
||||||
U();
|
U();
|
||||||
|
System.out.println("OPEN_WINDOW for Dispenser");
|
||||||
a.b(((Packet) (new Packet100(bG, 3, tileentitydispenser.b(), tileentitydispenser.h_()))));
|
a.b(((Packet) (new Packet100(bG, 3, tileentitydispenser.b(), tileentitydispenser.h_()))));
|
||||||
ap = ((CraftingInventoryCB) (new CraftingInventoryDispenserCB(((IInventory) (an)), tileentitydispenser)));
|
ap = ((CraftingInventoryCB) (new CraftingInventoryDispenserCB(((IInventory) (an)), tileentitydispenser)));
|
||||||
ap.f = bG;
|
ap.f = bG;
|
||||||
@ -243,20 +247,26 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
|||||||
if (craftinginventorycb.a(i) instanceof SlotCrafting) {
|
if (craftinginventorycb.a(i) instanceof SlotCrafting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
System.out.print("SET_SLOT for window: "+craftinginventorycb.f+" index: "+i+"and stack: "+itemstack);
|
||||||
if (am) {
|
if (am) {
|
||||||
|
System.out.println(" -- NOT SEND!");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
System.out.println(" -- SEND!");
|
||||||
a.b(((Packet) (new Packet103(craftinginventorycb.f, i, itemstack))));
|
a.b(((Packet) (new Packet103(craftinginventorycb.f, i, itemstack))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(CraftingInventoryCB craftinginventorycb, List list) {
|
public void a(CraftingInventoryCB craftinginventorycb, List list) {
|
||||||
|
System.out.println("WINDOW_SLOTS for window: "+craftinginventorycb.f );
|
||||||
a.b(((Packet) (new Packet104(craftinginventorycb.f, list))));
|
a.b(((Packet) (new Packet104(craftinginventorycb.f, list))));
|
||||||
|
System.out.println("SET_SLOT for item in hand: "+i+"and stack: "+an.i());
|
||||||
a.b(((Packet) (new Packet103(-1, -1, an.i()))));
|
a.b(((Packet) (new Packet103(-1, -1, an.i()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(CraftingInventoryCB craftinginventorycb, int i, int j) {
|
public void a(CraftingInventoryCB craftinginventorycb, int i, int j) {
|
||||||
|
System.out.println(String.format("UPDATE_PROGRESS_BAR for window: %d [%d;%d]", craftinginventorycb.f, i, j));
|
||||||
a.b(((Packet) (new Packet105(craftinginventorycb.f, i, j))));
|
a.b(((Packet) (new Packet105(craftinginventorycb.f, i, j))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
Normale Datei → Ausführbare Datei
9
src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
Normale Datei → Ausführbare Datei
@ -43,8 +43,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
|
|
||||||
public void setContents(ItemStack[] items) {
|
public void setContents(ItemStack[] items) {
|
||||||
if (getInventory().getContents().length != items.length) {
|
if (getInventory().getContents().length != items.length) {
|
||||||
throw new IllegalArgumentException("Invalid inventory size; expected "
|
throw new IllegalArgumentException("Invalid inventory size; expected " + getInventory().getContents().length);
|
||||||
+ getInventory().getContents().length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
|
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
|
||||||
@ -54,15 +53,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
if (item == null) {
|
if (item == null) {
|
||||||
mcItems[i] = null;
|
mcItems[i] = null;
|
||||||
} else {
|
} else {
|
||||||
mcItems[i] = new net.minecraft.server.ItemStack(
|
mcItems[i] = new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDamage());
|
||||||
item.getTypeId(), item.getAmount(), item.getDamage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(int index, ItemStack item) {
|
public void setItem(int index, ItemStack item) {
|
||||||
getInventory().a(index, new net.minecraft.server.ItemStack(
|
getInventory().a(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDamage())));
|
||||||
item.getTypeId(), item.getAmount(), item.getDamage()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(int materialId) {
|
public boolean contains(int materialId) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren