Redstone Logic for Buses, and Part Image Button goodness
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.IBusCommon;
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -12,6 +16,9 @@ import appeng.container.slot.SlotFakeTypeOnly;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
{
|
||||
@@ -20,7 +27,7 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
IInventory toolbox = new AppEngInternalInventory( null, 9 );
|
||||
|
||||
public ContainerBus(InventoryPlayer ip, IBusCommon te) {
|
||||
super( ip, null );
|
||||
super( ip, null, te );
|
||||
myte = te;
|
||||
|
||||
IInventory upgrades = myte.getInventoryByName( "upgrades" );
|
||||
@@ -55,9 +62,33 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
bindPlayerInventory( ip, 0, 184 - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
public RedstoneMode rsMode = RedstoneMode.IGNORE;
|
||||
public FuzzyMode fzMode = FuzzyMode.IGNORE_ALL;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get( i );
|
||||
|
||||
if ( this.rsMode != this.myte.getConfigManager().getSetting( Settings.REDSTONE_OUTPUT ) )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 0, (int) this.myte.getConfigManager().getSetting( Settings.REDSTONE_OUTPUT ).ordinal() );
|
||||
}
|
||||
|
||||
if ( this.fzMode != this.myte.getConfigManager().getSetting( Settings.FUZZY_MODE ) )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 1, (int) this.myte.getConfigManager().getSetting( Settings.FUZZY_MODE ).ordinal() );
|
||||
}
|
||||
}
|
||||
|
||||
this.fzMode = (FuzzyMode) this.myte.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
this.rsMode = (RedstoneMode) this.myte.getConfigManager().getSetting( Settings.REDSTONE_OUTPUT );
|
||||
}
|
||||
|
||||
for (Object o : inventorySlots)
|
||||
{
|
||||
if ( o instanceof OptionalSlotFake )
|
||||
@@ -71,6 +102,19 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int idx, int value)
|
||||
{
|
||||
|
||||
if ( idx == 0 )
|
||||
this.rsMode = RedstoneMode.values()[value];
|
||||
|
||||
if ( idx == 1 )
|
||||
this.fzMode = FuzzyMode.values()[value];
|
||||
|
||||
}
|
||||
|
||||
public boolean hasToolbox()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@@ -12,7 +12,7 @@ public class ContainerChest extends AEBaseContainer
|
||||
TileChest myte;
|
||||
|
||||
public ContainerChest(InventoryPlayer ip, TileChest te) {
|
||||
super( ip, te );
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.STORAGE_CELLS, myte, 1, 80, 37 ) );
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ContainerCondenser extends AEBaseContainer
|
||||
TileCondenser myte;
|
||||
|
||||
public ContainerCondenser(InventoryPlayer ip, TileCondenser te) {
|
||||
super( ip, te );
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.TRASH, te, 0, 51, 52 ) );
|
||||
|
||||
@@ -12,7 +12,7 @@ public class ContainerDrive extends AEBaseContainer
|
||||
TileDrive myte;
|
||||
|
||||
public ContainerDrive(InventoryPlayer ip, TileDrive te) {
|
||||
super( ip, te );
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
for (int y = 0; y < 5; y++)
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ContainerGrinder extends AEBaseContainer
|
||||
TileGrinder myte;
|
||||
|
||||
public ContainerGrinder(InventoryPlayer ip, TileGrinder te) {
|
||||
super( ip, te );
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ORE, te, 0, 12, 17 ) );
|
||||
|
||||
@@ -14,14 +14,14 @@ public class ContainerInterface extends AEBaseContainer
|
||||
TileInterface myte;
|
||||
|
||||
public ContainerInterface(InventoryPlayer ip, TileInterface te) {
|
||||
super( ip, te );
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
addSlotToContainer( new SlotFake( myte.getConfig(), x, 8 + 18 * x, 28 + 7 ) );
|
||||
addSlotToContainer( new SlotFake( myte.getConfig(), x, 17 + 18 * x, 35 ) );
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
addSlotToContainer( new SlotNormal( myte, x, 26 + 18 * x, 46 + 7 ) );
|
||||
addSlotToContainer( new SlotNormal( myte, x, 17 + 18 * x, 35 + 18 ) );
|
||||
|
||||
for (int x = 0; x < 9; x++)
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, myte.getPatterns(), x, 8 + 18 * x, 90 + 7 ) );
|
||||
|
||||
@@ -10,7 +10,7 @@ public class ContainerLevelEmitter extends AEBaseContainer
|
||||
PartLevelEmitter myte;
|
||||
|
||||
public ContainerLevelEmitter(InventoryPlayer ip, PartLevelEmitter te) {
|
||||
super( ip, te.getHost().getTile() );
|
||||
super( ip, te.getHost().getTile(), te );
|
||||
myte = te;
|
||||
|
||||
// addSlotToContainer( new SlotRestrictedInput(
|
||||
|
||||
@@ -14,6 +14,7 @@ import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReciever;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -32,7 +33,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
final IItemList<IAEItemStack> items = new ItemList<IAEItemStack>();
|
||||
|
||||
public ContainerMEMonitorable(InventoryPlayer ip, IStorageMonitorable montiorable) {
|
||||
super( ip, montiorable instanceof TileEntity ? (TileEntity) montiorable : null );
|
||||
super( ip, montiorable instanceof TileEntity ? (TileEntity) montiorable : null, montiorable instanceof IPart ? (IPart) montiorable : null );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
TileEntity myte;
|
||||
|
||||
public ContainerNetworkStatus(InventoryPlayer ip, TileEntity te) {
|
||||
super( ip, (TileEntity) te );
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
// addSlotToContainer( new SlotRestrictedInput(
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ContainerSpatialIOPort extends AEBaseContainer
|
||||
TileSpatialIOPort myte;
|
||||
|
||||
public ContainerSpatialIOPort(InventoryPlayer ip, TileSpatialIOPort te) {
|
||||
super( ip, te );
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.SPATIAL_STORAGE_CELLS, te, 0, 71, 14 ) );
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ContainerVibrationChamber extends AEBaseContainer
|
||||
TileVibrationChamber myte;
|
||||
|
||||
public ContainerVibrationChamber(InventoryPlayer ip, TileVibrationChamber te) {
|
||||
super( ip, te );
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.FUEL, te, 0, 80, 37 ) );
|
||||
|
||||
Reference in New Issue
Block a user