mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 16:29:39 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -6,83 +6,66 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerCrate extends Container
|
||||
{
|
||||
public class ContainerCrate extends Container {
|
||||
public IInventory lowerChestInventory;
|
||||
public IInventory upperChestInventory;
|
||||
private int numRows;
|
||||
|
||||
public ContainerCrate(IInventory par1IInventory, IInventory par2IInventory)
|
||||
{
|
||||
public ContainerCrate(IInventory par1IInventory, IInventory par2IInventory) {
|
||||
this.lowerChestInventory = par2IInventory;
|
||||
this.upperChestInventory = par1IInventory;
|
||||
this.numRows = 0;
|
||||
if(par2IInventory != null && par1IInventory != null){
|
||||
if (par2IInventory != null && par1IInventory != null) {
|
||||
this.numRows = par2IInventory.getSizeInventory() / 9;
|
||||
par2IInventory.openInventory();
|
||||
int i = (this.numRows - 4) * 18;
|
||||
int j;
|
||||
int k;
|
||||
|
||||
for (j = 0; j < this.numRows; ++j)
|
||||
{
|
||||
for (k = 0; k < 9; ++k)
|
||||
{
|
||||
for (j = 0; j < this.numRows; ++j) {
|
||||
for (k = 0; k < 9; ++k) {
|
||||
this.addSlotToContainer(new Slot(par2IInventory, k + j * 9, 8 + k * 18, 18 + j * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
for (k = 0; k < 9; ++k)
|
||||
{
|
||||
for (j = 0; j < 3; ++j) {
|
||||
for (k = 0; k < 9; ++k) {
|
||||
this.addSlotToContainer(new Slot(par1IInventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i));
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 9; ++j)
|
||||
{
|
||||
for (j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(par1IInventory, j, 8 + j * 18, 161 + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer) {
|
||||
return this.lowerChestInventory.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
|
||||
*/
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(par2);
|
||||
Slot slot = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (par2 < this.numRows * 9)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, this.numRows * 9, this.inventorySlots.size(), true))
|
||||
{
|
||||
if (par2 < this.numRows * 9) {
|
||||
if (!this.mergeItemStack(itemstack1, this.numRows * 9, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 0, this.numRows * 9, false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(itemstack1, 0, this.numRows * 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
@@ -93,8 +76,7 @@ public class ContainerCrate extends Container
|
||||
/**
|
||||
* Called when the container is closed.
|
||||
*/
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer) {
|
||||
super.onContainerClosed(par1EntityPlayer);
|
||||
this.lowerChestInventory.closeInventory();
|
||||
}
|
||||
@@ -102,8 +84,7 @@ public class ContainerCrate extends Container
|
||||
/**
|
||||
* Return this chest container's lower chest inventory.
|
||||
*/
|
||||
public IInventory getLowerChestInventory()
|
||||
{
|
||||
public IInventory getLowerChestInventory() {
|
||||
return this.lowerChestInventory;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user