mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 21:19:00 +01:00
inventory fixes
This commit is contained in:
parent
b76bc9cfb3
commit
61b79e8f98
@ -31,9 +31,6 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
private double at;
|
private double at;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
protected org.bukkit.entity.Entity bukkitPoweredMinecart;
|
|
||||||
protected org.bukkit.entity.Entity bukkitStorageMinecart;
|
|
||||||
|
|
||||||
private boolean slowWhenEmpty = true;
|
private boolean slowWhenEmpty = true;
|
||||||
private double derailedX = 0.5;
|
private double derailedX = 0.5;
|
||||||
private double derailedY = 0.5;
|
private double derailedY = 0.5;
|
||||||
@ -49,7 +46,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
|
|
||||||
public EntityMinecart(World world) {
|
public EntityMinecart(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
this.al = new ItemStack[36];
|
this.al = new ItemStack[27]; //Craftbukkit
|
||||||
this.a = 0;
|
this.a = 0;
|
||||||
this.b = 0;
|
this.b = 0;
|
||||||
this.c = 1;
|
this.c = 1;
|
||||||
|
@ -13,7 +13,7 @@ public class InventoryCraftResult implements IInventory {
|
|||||||
public InventoryCraftResult() {}
|
public InventoryCraftResult() {}
|
||||||
|
|
||||||
public int h_() {
|
public int h_() {
|
||||||
return 1;
|
return this.a.length; //Craftbukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i) {
|
public ItemStack a(int i) {
|
||||||
|
@ -231,7 +231,7 @@ public class InventoryPlayer implements IInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int h_() {
|
public int h_() {
|
||||||
return this.a.length + 4;
|
return this.a.length + this.b.length; //Craftbukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i) {
|
public ItemStack a(int i) {
|
||||||
|
@ -2,7 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
public class TileEntityChest extends TileEntity implements IInventory {
|
public class TileEntityChest extends TileEntity implements IInventory {
|
||||||
|
|
||||||
private ItemStack[] e = new ItemStack[36];
|
private ItemStack[] e = new ItemStack[27]; //Craftbukkit
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
@ -13,7 +13,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
|||||||
public TileEntityChest() {}
|
public TileEntityChest() {}
|
||||||
|
|
||||||
public int h_() {
|
public int h_() {
|
||||||
return 27;
|
return this.e.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i) {
|
public ItemStack a(int i) {
|
||||||
|
@ -16,7 +16,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
|||||||
public TileEntityDispenser() {}
|
public TileEntityDispenser() {}
|
||||||
|
|
||||||
public int h_() {
|
public int h_() {
|
||||||
return 9;
|
return this.e.length; //Craftbukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i) {
|
public ItemStack a(int i) {
|
||||||
|
@ -179,7 +179,14 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int firstPartial(ItemStack item) {
|
public int firstPartial(ItemStack item) {
|
||||||
return firstPartial(item.getTypeId());
|
CraftItemStack[] inventory = getContents();
|
||||||
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
|
CraftItemStack cItem = inventory[i];
|
||||||
|
if (item != null && cItem.getTypeId() == item.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == item.getDurability()) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
|
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
|
||||||
@ -195,7 +202,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
ItemStack item = items[i];
|
ItemStack item = items[i];
|
||||||
while (true) {
|
while (true) {
|
||||||
// Do we already have a stack of it?
|
// Do we already have a stack of it?
|
||||||
int firstPartial = firstPartial( item.getTypeId() );
|
int firstPartial = firstPartial(item);
|
||||||
|
|
||||||
// Drat! no partial stack
|
// Drat! no partial stack
|
||||||
if (firstPartial == -1) {
|
if (firstPartial == -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user