mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 12:13:54 -07:00
Added getContents() to IInventory and implemented it.
Implemented Inventory and PlayerInventory and updated StorageMinecart and Slot. Added getMaxStackSize to CraftItemStack.
This commit is contained in:
71
src/main/java/net/minecraft/server/InventoryLargeChest.java
Normal file
71
src/main/java/net/minecraft/server/InventoryLargeChest.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
|
||||
public class InventoryLargeChest
|
||||
implements IInventory {
|
||||
|
||||
private String a;
|
||||
private IInventory b;
|
||||
private IInventory c;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
ItemStack[] result = new ItemStack[a()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = a(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryLargeChest(String s, IInventory iinventory, IInventory iinventory1) {
|
||||
a = s;
|
||||
b = iinventory;
|
||||
c = iinventory1;
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return b.a() + c.a();
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
if (i >= b.a()) {
|
||||
return c.a(i - b.a());
|
||||
} else {
|
||||
return b.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
if (i >= b.a()) {
|
||||
return c.a(i - b.a(), j);
|
||||
} else {
|
||||
return b.a(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
if (i >= b.a()) {
|
||||
c.a(i - b.a(), itemstack);
|
||||
} else {
|
||||
b.a(i, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return b.c();
|
||||
}
|
||||
|
||||
public void d() {
|
||||
b.d();
|
||||
c.d();
|
||||
}
|
||||
|
||||
public boolean a_(EntityPlayer entityplayer) {
|
||||
return b.a_(entityplayer) && c.a_(entityplayer);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user