mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-22 04:52:18 +00:00
+added Solar Factory -removed unnessecary solar and essentia generator classes +started gtnh researches +added tooltip clearance on solars (maximal output) Signed-off-by: bartimaeusnek <[email protected]>
84 lines
2.9 KiB
Java
84 lines
2.9 KiB
Java
package emt.client.gui.container;
|
|
|
|
import emt.tile.TileEntityEtherealMacerator;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
import net.minecraft.inventory.Container;
|
|
import net.minecraft.inventory.Slot;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import thaumcraft.common.container.SlotOutput;
|
|
|
|
public class ContainerEtheralMacerator extends Container {
|
|
|
|
TileEntityEtherealMacerator te;
|
|
|
|
public ContainerEtheralMacerator(InventoryPlayer inventory, TileEntity te) {
|
|
this.te = ((TileEntityEtherealMacerator) te);
|
|
addSlotToContainer(new Slot(this.te, 0, 56, 26));
|
|
addSlotToContainer(new SlotOutput(this.te, 2, 116, 26));
|
|
addSlotToContainer(new SlotOutput(this.te, 1, 116, 53));
|
|
for (int i = 0; i < 3; i++) {
|
|
for (int j = 0; j < 9; j++) {
|
|
addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
|
}
|
|
}
|
|
for (int i = 0; i < 9; i++) {
|
|
addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public boolean canInteractWith(EntityPlayer player) {
|
|
return this.te.isUseableByPlayer(player);
|
|
}
|
|
|
|
@Override
|
|
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
|
ItemStack itemstack = null;
|
|
Slot slot = (Slot) this.inventorySlots.get(par2);
|
|
|
|
if (slot != null && slot.getHasStack()) {
|
|
ItemStack itemstack1 = slot.getStack();
|
|
itemstack = itemstack1.copy();
|
|
|
|
if (par2 == 1) {
|
|
if (!this.mergeItemStack(itemstack1, 2, 38, true)) {
|
|
return null;
|
|
}
|
|
|
|
slot.onSlotChange(itemstack1, itemstack);
|
|
} else if (par2 != 0) {
|
|
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) {
|
|
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
|
|
return null;
|
|
}
|
|
} else if (par2 >= 2 && par2 < 29) {
|
|
if (!this.mergeItemStack(itemstack1, 29, 38, false)) {
|
|
return null;
|
|
}
|
|
} else if (par2 >= 29 && par2 < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) {
|
|
return null;
|
|
}
|
|
} else if (!this.mergeItemStack(itemstack1, 3, 38, false)) {
|
|
return null;
|
|
}
|
|
|
|
if (itemstack1.stackSize == 0) {
|
|
slot.putStack((ItemStack) null);
|
|
} else {
|
|
slot.onSlotChanged();
|
|
}
|
|
|
|
if (itemstack1.stackSize == itemstack.stackSize) {
|
|
return null;
|
|
}
|
|
|
|
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
|
|
}
|
|
|
|
return itemstack;
|
|
}
|
|
}
|