2014-03-07 07:15:54 +01:00
|
|
|
package appeng.container.implementations;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
2014-03-11 07:52:48 +01:00
|
|
|
import net.minecraft.inventory.ICrafting;
|
2014-03-07 07:15:54 +01:00
|
|
|
import appeng.container.AEBaseContainer;
|
2014-03-11 07:52:48 +01:00
|
|
|
import appeng.container.slot.SlotOutput;
|
|
|
|
import appeng.container.slot.SlotRestrictedInput;
|
|
|
|
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
2014-03-07 07:15:54 +01:00
|
|
|
import appeng.tile.misc.TileInscriber;
|
2014-03-11 07:52:48 +01:00
|
|
|
import appeng.util.Platform;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2014-03-07 07:15:54 +01:00
|
|
|
|
|
|
|
public class ContainerInscriber extends AEBaseContainer
|
|
|
|
{
|
|
|
|
|
|
|
|
TileInscriber myte;
|
|
|
|
|
2014-03-11 07:52:48 +01:00
|
|
|
public int maxProessingTime = -1;
|
|
|
|
public int processingTime = -1;
|
|
|
|
|
2014-03-07 07:15:54 +01:00
|
|
|
public ContainerInscriber(InventoryPlayer ip, TileInscriber te) {
|
|
|
|
super( ip, te, null );
|
|
|
|
myte = te;
|
|
|
|
|
2014-03-11 07:52:48 +01:00
|
|
|
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_PLATE, myte, 0, 45, 16 ) );
|
|
|
|
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_INPUT, myte, 2, 63, 39 ) );
|
|
|
|
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_PLATE, myte, 1, 45, 62 ) );
|
|
|
|
|
|
|
|
addSlotToContainer( new SlotOutput( myte, 3, 113, 40, -1 ) );
|
|
|
|
|
2014-03-07 07:15:54 +01:00
|
|
|
bindPlayerInventory( ip, 0, 176 - /* height of playerinventory */82 );
|
|
|
|
}
|
|
|
|
|
2014-03-11 07:52:48 +01:00
|
|
|
@Override
|
|
|
|
public void detectAndSendChanges()
|
|
|
|
{
|
|
|
|
super.detectAndSendChanges();
|
|
|
|
|
|
|
|
if ( Platform.isServer() )
|
|
|
|
{
|
2014-03-12 04:26:50 +01:00
|
|
|
int localMax = myte.maxProessingTime;
|
|
|
|
int localTime = myte.processingTime;
|
2014-03-11 07:52:48 +01:00
|
|
|
|
|
|
|
for (int i = 0; i < this.crafters.size(); ++i)
|
|
|
|
{
|
|
|
|
ICrafting icrafting = (ICrafting) this.crafters.get( i );
|
|
|
|
|
|
|
|
if ( this.maxProessingTime != localMax )
|
|
|
|
{
|
|
|
|
icrafting.sendProgressBarUpdate( this, 0, localMax );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( this.processingTime != localTime )
|
|
|
|
{
|
|
|
|
icrafting.sendProgressBarUpdate( this, 1, localTime );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.maxProessingTime = localMax;
|
|
|
|
this.processingTime = localTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void updateProgressBar(int idx, int value)
|
|
|
|
{
|
|
|
|
if ( idx == 0 )
|
|
|
|
this.maxProessingTime = value;
|
|
|
|
|
|
|
|
if ( idx == 1 )
|
|
|
|
this.processingTime = value;
|
|
|
|
}
|
2014-03-07 07:15:54 +01:00
|
|
|
}
|