GT5-Unofficial/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java

73 lines
2.3 KiB
Java
Raw Normal View History

2015-04-23 16:14:22 +00:00
package gregtech.api.gui;
2015-10-22 02:06:25 +00:00
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
2015-04-23 16:14:22 +00:00
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
2015-10-22 02:06:25 +00:00
import java.util.Iterator;
2015-04-23 16:14:22 +00:00
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
2015-10-22 02:06:25 +00:00
* <p/>
2015-04-23 16:14:22 +00:00
* The Container I use for all my Basic Tanks
*/
public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine {
2015-10-22 02:06:25 +00:00
public int mContent = 0;
public GT_Container_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
super(aInventoryPlayer, aTileEntity);
}
2015-04-23 16:14:22 +00:00
@Override
2015-10-22 02:06:25 +00:00
public void addSlots(InventoryPlayer aInventoryPlayer) {
addSlotToContainer(new Slot(mTileEntity, 0, 80, 17));
addSlotToContainer(new GT_Slot_Output(mTileEntity, 1, 80, 53));
addSlotToContainer(new GT_Slot_Render(mTileEntity, 2, 59, 42));
2015-04-23 16:14:22 +00:00
}
2015-10-22 02:06:25 +00:00
2015-04-23 16:14:22 +00:00
@Override
2015-10-22 02:06:25 +00:00
public void detectAndSendChanges() {
2015-04-23 16:14:22 +00:00
super.detectAndSendChanges();
2015-10-22 02:06:25 +00:00
if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return;
if (((GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity()).mFluid != null)
mContent = ((GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity()).mFluid.amount;
else
mContent = 0;
2015-04-23 16:14:22 +00:00
Iterator var2 = this.crafters.iterator();
while (var2.hasNext()) {
2015-10-22 02:06:25 +00:00
ICrafting var1 = (ICrafting) var2.next();
2015-04-23 16:14:22 +00:00
var1.sendProgressBarUpdate(this, 100, mContent & 65535);
var1.sendProgressBarUpdate(this, 101, mContent >>> 16);
}
}
2015-10-22 02:06:25 +00:00
2015-04-23 16:14:22 +00:00
@Override
2015-10-22 02:06:25 +00:00
@SideOnly(Side.CLIENT)
2015-04-23 16:14:22 +00:00
public void updateProgressBar(int par1, int par2) {
2015-10-22 02:06:25 +00:00
super.updateProgressBar(par1, par2);
switch (par1) {
case 100:
mContent = mContent & -65536 | par2;
break;
case 101:
mContent = mContent & 65535 | par2 << 16;
break;
}
2015-04-23 16:14:22 +00:00
}
2015-10-22 02:06:25 +00:00
2015-04-23 16:14:22 +00:00
@Override
2015-10-22 02:06:25 +00:00
public int getSlotCount() {
return 2;
2015-04-23 16:14:22 +00:00
}
@Override
2015-10-22 02:06:25 +00:00
public int getShiftClickSlotCount() {
return 1;
2015-04-23 16:14:22 +00:00
}
}