Add Upgrade Features to Interface, and add Buttons to Interface and Export Bus o alter crafting behavior.

This commit is contained in:
AlgorithmX2
2014-07-04 20:59:50 -05:00
parent 14187dc799
commit fa542c7d15
10 changed files with 176 additions and 37 deletions
@@ -2,7 +2,10 @@ package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.SecurityPermissions;
import appeng.container.AEBaseContainer;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.api.util.IConfigManager;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotNormal;
import appeng.container.slot.SlotRestrictedInput;
@@ -10,25 +13,50 @@ import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
public class ContainerInterface extends AEBaseContainer
public class ContainerInterface extends ContainerUpgradeable
{
DualityInterface myte;
DualityInterface myDuality;
@GuiSync(3)
public YesNo bMode = YesNo.NO;
public ContainerInterface(InventoryPlayer ip, IInterfaceHost te) {
super( ip, te.getInterfaceDuality().getTile(), te.getInterfaceDuality().getPart() );
myte = te.getInterfaceDuality();
super( ip, te.getInterfaceDuality().getHost() );
myDuality = te.getInterfaceDuality();
for (int x = 0; x < 9; x++)
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, myte.getPatterns(), x, 8 + 18 * x, 90 + 7 ) );
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7 ) );
for (int x = 0; x < 8; x++)
addSlotToContainer( new SlotFake( myte.getConfig(), x, 17 + 18 * x, 35 ) );
addSlotToContainer( new SlotFake( myDuality.getConfig(), x, 17 + 18 * x, 35 ) );
for (int x = 0; x < 8; x++)
addSlotToContainer( new SlotNormal( myte.getStorage(), x, 17 + 18 * x, 35 + 18 ) );
addSlotToContainer( new SlotNormal( myDuality.getStorage(), x, 17 + 18 * x, 35 + 18 ) );
bindPlayerInventory( ip, 0, 211 - /* height of playerinventory */82 );
}
@Override
protected int getHeight()
{
return 211;
}
@Override
protected void setupConfig()
{
setupUpgrades();
}
protected void loadSettingsFromHost(IConfigManager cm)
{
this.bMode = (YesNo) cm.getSetting( Settings.BLOCK );
}
public int availableUpgrades()
{
return 1;
}
@Override
@@ -10,8 +10,10 @@ import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.api.config.YesNo;
import appeng.api.implementations.IUpgradeableHost;
import appeng.api.parts.IPart;
import appeng.api.util.IConfigManager;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.IOptionalSlotHost;
@@ -84,11 +86,8 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
bindPlayerInventory( ip, 0, getHeight() - /* height of playerinventory */82 );
}
protected void setupConfig()
protected void setupUpgrades()
{
int x = 80;
int y = 40;
IInventory upgrades = myte.getInventoryByName( "upgrades" );
if ( availableUpgrades() > 0 )
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() );
@@ -98,6 +97,13 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2 )).setNotDraggable() );
if ( availableUpgrades() > 3 )
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() );
}
protected void setupConfig()
{
int x = 80;
int y = 40;
setupUpgrades();
IInventory inv = myte.getInventoryByName( "config" );
addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
@@ -137,6 +143,9 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
@GuiSync(1)
public FuzzyMode fzMode = FuzzyMode.IGNORE_ALL;
@GuiSync(2)
public YesNo cMode = YesNo.NO;
public void checkToolbox()
{
if ( hasToolbox() )
@@ -165,8 +174,8 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
if ( Platform.isServer() )
{
this.fzMode = (FuzzyMode) this.myte.getConfigManager().getSetting( Settings.FUZZY_MODE );
this.rsMode = (RedstoneMode) this.myte.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
IConfigManager cm = this.myte.getConfigManager();
loadSettingsFromHost( cm );
}
checkToolbox();
@@ -184,6 +193,13 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
standardDetectAndSendChanges();
}
protected void loadSettingsFromHost(IConfigManager cm)
{
this.fzMode = (FuzzyMode) cm.getSetting( Settings.FUZZY_MODE );
this.cMode = (YesNo) cm.getSetting( Settings.CRAFT_ONLY );
this.rsMode = (RedstoneMode) cm.getSetting( Settings.REDSTONE_CONTROLLED );
}
protected void standardDetectAndSendChanges()
{
super.detectAndSendChanges();