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-02-18 06:51:31 +01:00
|
|
|
package appeng.container.implementations;
|
|
|
|
|
2014-11-28 04:36:46 +01:00
|
|
|
|
2014-02-18 06:51:31 +01:00
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import net.minecraft.inventory.IInventory;
|
2014-11-28 04:36:46 +01:00
|
|
|
|
2014-02-18 06:51:31 +01:00
|
|
|
import appeng.api.config.FuzzyMode;
|
|
|
|
import appeng.api.config.SecurityPermissions;
|
|
|
|
import appeng.api.config.Settings;
|
|
|
|
import appeng.api.config.Upgrades;
|
|
|
|
import appeng.container.slot.OptionalSlotFakeTypeOnly;
|
|
|
|
import appeng.container.slot.SlotFakeTypeOnly;
|
|
|
|
import appeng.container.slot.SlotRestrictedInput;
|
|
|
|
import appeng.parts.automation.PartFormationPlane;
|
|
|
|
import appeng.util.Platform;
|
|
|
|
|
|
|
|
public class ContainerFormationPlane extends ContainerUpgradeable
|
|
|
|
{
|
|
|
|
|
2014-09-29 09:54:34 +02:00
|
|
|
final PartFormationPlane storageBus;
|
2014-02-18 06:51:31 +01:00
|
|
|
|
|
|
|
public ContainerFormationPlane(InventoryPlayer ip, PartFormationPlane te) {
|
|
|
|
super( ip, te );
|
2014-12-29 15:13:47 +01:00
|
|
|
this.storageBus = te;
|
2014-02-18 06:51:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected int getHeight()
|
|
|
|
{
|
|
|
|
return 251;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int availableUpgrades()
|
|
|
|
{
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean supportCapacity()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isSlotEnabled(int idx)
|
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
2014-02-18 06:51:31 +01:00
|
|
|
|
|
|
|
return upgrades > idx;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void setupConfig()
|
|
|
|
{
|
|
|
|
int xo = 8;
|
|
|
|
int yo = 23 + 6;
|
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
IInventory config = this.upgradeable.getInventoryByName( "config" );
|
2014-02-18 06:51:31 +01:00
|
|
|
for (int y = 0; y < 7; y++)
|
|
|
|
{
|
|
|
|
for (int x = 0; x < 9; x++)
|
|
|
|
{
|
|
|
|
if ( y < 2 )
|
2014-12-29 15:13:47 +01:00
|
|
|
this.addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
2014-02-18 06:51:31 +01:00
|
|
|
else
|
2014-12-29 15:13:47 +01:00
|
|
|
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( config, this, y * 9 + x, xo, yo, x, y, y - 2 ) );
|
2014-02-18 06:51:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
|
|
|
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() );
|
|
|
|
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer )).setNotDraggable() );
|
|
|
|
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer )).setNotDraggable() );
|
2014-02-18 06:51:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void detectAndSendChanges()
|
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
2014-02-18 06:51:31 +01:00
|
|
|
|
|
|
|
if ( Platform.isServer() )
|
|
|
|
{
|
2014-09-28 11:47:17 +02:00
|
|
|
this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
2014-02-18 06:51:31 +01:00
|
|
|
}
|
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
this.standardDetectAndSendChanges();
|
2014-02-18 06:51:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|