mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 14:44:35 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
a314fccd1b
commit
8f026dad8f
161 files changed
+14073
-12846
No files matched your search
@@ -5,81 +5,80 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import team.chisel.block.tileentity.TileEntityPresent;
|
||||
|
||||
public class ContainerPresent extends Container {
|
||||
|
||||
private IInventory lower;
|
||||
private int rows;
|
||||
private IInventory lower;
|
||||
private int rows;
|
||||
private boolean isContainerValid = true;
|
||||
public ContainerPresent(IInventory player, IInventory chest) {
|
||||
lower = chest;
|
||||
rows = chest.getSizeInventory() / 9;
|
||||
chest.openInventory();
|
||||
int a = (rows - 4) * 18;
|
||||
|
||||
for (int d = 0; d < rows; d++) {
|
||||
for (int e = 0; e < 9; e++) {
|
||||
addSlotToContainer(new Slot(chest, e + d * 9, 8 + e * 18, 18 + d * 18));
|
||||
}
|
||||
}
|
||||
public ContainerPresent(IInventory player, IInventory chest) {
|
||||
lower = chest;
|
||||
rows = chest.getSizeInventory() / 9;
|
||||
chest.openInventory();
|
||||
int a = (rows - 4) * 18;
|
||||
|
||||
for (int d = 0; d < 3; d++) {
|
||||
for (int e = 0; e < 9; e++) {
|
||||
addSlotToContainer(new Slot(player, e + d * 9 + 9, 8 + e * 18, 103 + d * 18 + a));
|
||||
}
|
||||
}
|
||||
for (int d = 0; d < rows; d++) {
|
||||
for (int e = 0; e < 9; e++) {
|
||||
addSlotToContainer(new Slot(chest, e + d * 9, 8 + e * 18, 18 + d * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int d = 0; d < 9; d++) {
|
||||
addSlotToContainer(new Slot(player, d, 8 + d * 18, 161 + a));
|
||||
}
|
||||
}
|
||||
for (int d = 0; d < 3; d++) {
|
||||
for (int e = 0; e < 9; e++) {
|
||||
addSlotToContainer(new Slot(player, e + d * 9 + 9, 8 + e * 18, 103 + d * 18 + a));
|
||||
}
|
||||
}
|
||||
|
||||
public IInventory getLowerPresentInventory() {
|
||||
return lower;
|
||||
}
|
||||
for (int d = 0; d < 9; d++) {
|
||||
addSlotToContainer(new Slot(player, d, 8 + d * 18, 161 + a));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
|
||||
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(p_82846_2_);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (p_82846_2_ < rows * 9) {
|
||||
if (!this.mergeItemStack(itemstack1, rows * 9, inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(itemstack1, 0, rows * 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer p_75145_1_) {
|
||||
return isContainerValid;
|
||||
}
|
||||
public IInventory getLowerPresentInventory() {
|
||||
return lower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
TileEntityPresent te = (TileEntityPresent)lower;
|
||||
if( te != null && te.hasWorldObj() && !te.getWorldObj().isRemote)
|
||||
{
|
||||
if (te.getWorldObj().getTileEntity(te.xCoord, te.yCoord, te.zCoord) != te)
|
||||
isContainerValid = false;
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
|
||||
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(p_82846_2_);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (p_82846_2_ < rows * 9) {
|
||||
if (!this.mergeItemStack(itemstack1, rows * 9, inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(itemstack1, 0, rows * 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer p_75145_1_) {
|
||||
return isContainerValid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
TileEntityPresent te = (TileEntityPresent) lower;
|
||||
if (te != null && te.hasWorldObj() && !te.getWorldObj().isRemote) {
|
||||
if (te.getWorldObj().getTileEntity(te.xCoord, te.yCoord, te.zCoord) != te) isContainerValid = false;
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user