2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
|
|
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
|
|
*/
|
|
|
|
|
2014-05-07 07:22:42 +02:00
|
|
|
package appeng.container.implementations;
|
|
|
|
|
2014-11-28 04:36:46 +01:00
|
|
|
|
2014-05-07 07:22:42 +02:00
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import net.minecraft.inventory.IInventory;
|
2014-11-28 04:36:46 +01:00
|
|
|
|
2014-05-07 07:22:42 +02:00
|
|
|
import appeng.api.config.FullnessMode;
|
|
|
|
import appeng.api.config.OperationMode;
|
|
|
|
import appeng.api.config.RedstoneMode;
|
|
|
|
import appeng.api.config.SecurityPermissions;
|
|
|
|
import appeng.api.config.Settings;
|
|
|
|
import appeng.container.guisync.GuiSync;
|
|
|
|
import appeng.container.slot.SlotOutput;
|
|
|
|
import appeng.container.slot.SlotRestrictedInput;
|
|
|
|
import appeng.tile.storage.TileIOPort;
|
|
|
|
import appeng.util.Platform;
|
|
|
|
|
2015-03-22 11:07:25 +01:00
|
|
|
|
2014-05-07 07:22:42 +02:00
|
|
|
public class ContainerIOPort extends ContainerUpgradeable
|
|
|
|
{
|
|
|
|
|
2014-09-29 09:54:34 +02:00
|
|
|
final TileIOPort ioPort;
|
2014-05-07 07:22:42 +02:00
|
|
|
|
2015-03-22 11:07:25 +01:00
|
|
|
@GuiSync( 2 )
|
2014-05-07 07:22:42 +02:00
|
|
|
public FullnessMode fMode = FullnessMode.EMPTY;
|
2015-03-22 11:07:25 +01:00
|
|
|
@GuiSync( 3 )
|
2014-05-07 07:22:42 +02:00
|
|
|
public OperationMode opMode = OperationMode.EMPTY;
|
|
|
|
|
2015-09-25 23:10:56 +02:00
|
|
|
public ContainerIOPort( final InventoryPlayer ip, final TileIOPort te )
|
2015-03-22 11:07:25 +01:00
|
|
|
{
|
2014-05-07 07:22:42 +02:00
|
|
|
super( ip, te );
|
2014-12-29 15:13:47 +01:00
|
|
|
this.ioPort = te;
|
2014-05-07 07:22:42 +02:00
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
@Override
|
|
|
|
protected int getHeight()
|
|
|
|
{
|
|
|
|
return 166;
|
|
|
|
}
|
|
|
|
|
2015-03-22 11:07:25 +01:00
|
|
|
@Override
|
|
|
|
protected void setupConfig()
|
|
|
|
{
|
|
|
|
int offX = 19;
|
|
|
|
int offY = 17;
|
|
|
|
|
2015-09-25 23:10:56 +02:00
|
|
|
final IInventory cells = this.upgradeable.getInventoryByName( "cells" );
|
2015-03-22 11:07:25 +01:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
for( int y = 0; y < 3; y++ )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
for( int x = 0; x < 2; x++ )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-03-22 11:07:25 +01:00
|
|
|
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
|
|
|
}
|
2015-03-22 11:07:25 +01:00
|
|
|
|
|
|
|
offX = 122;
|
|
|
|
offY = 17;
|
2015-04-03 08:54:31 +02:00
|
|
|
for( int y = 0; y < 3; y++ )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
for( int x = 0; x < 2; x++ )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-03-22 11:07:25 +01:00
|
|
|
this.addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
|
|
|
}
|
2015-03-22 11:07:25 +01:00
|
|
|
|
2015-09-25 23:10:56 +02:00
|
|
|
final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
2015-03-22 11:07:25 +01:00
|
|
|
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
|
|
|
|
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
|
|
|
|
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
|
|
|
|
}
|
|
|
|
|
2014-05-07 07:22:42 +02:00
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
protected boolean supportCapacity()
|
2014-05-07 07:22:42 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return false;
|
2014-05-07 07:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int availableUpgrades()
|
|
|
|
{
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void detectAndSendChanges()
|
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
2014-05-07 07:22:42 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( Platform.isServer() )
|
2014-05-07 07:22:42 +02:00
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.opMode = (OperationMode) this.upgradeable.getConfigManager().getSetting( Settings.OPERATION_MODE );
|
2014-09-28 11:47:17 +02:00
|
|
|
this.fMode = (FullnessMode) this.upgradeable.getConfigManager().getSetting( Settings.FULLNESS_MODE );
|
|
|
|
this.rsMode = (RedstoneMode) this.upgradeable.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
|
2014-05-07 07:22:42 +02:00
|
|
|
}
|
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
this.standardDetectAndSendChanges();
|
2014-05-07 07:22:42 +02:00
|
|
|
}
|
|
|
|
}
|