More configuration work

This commit is contained in:
Aidan C. Brady 2015-03-08 13:27:34 -05:00
parent 1f59f8ca1d
commit 8ce105d95f
14 changed files with 132 additions and 84 deletions

View file

@ -1,30 +1,54 @@
package mekanism.common; package mekanism.common;
import mekanism.api.EnumColor; import mekanism.api.EnumColor;
import mekanism.common.util.MekanismUtils;
public class SideData public class SideData
{ {
/** The color of this SideData */ /** The color of this SideData */
public EnumColor color; public EnumColor color;
/** The name of this SideData */
public String name;
/** Int[] of available side slots */ /** Int[] of available side slots, can be used for items, gases, or items */
public int[] availableSlots; public int[] availableSlots;
/** EnergyState representing this SideData */ /** EnergyState representing this SideData */
public EnergyState energyState; public EnergyState energyState;
public SideData(EnumColor colour, int[] slots) public SideData(String n, EnumColor colour, int[] slots)
{ {
name = n;
color = colour; color = colour;
availableSlots = slots; availableSlots = slots;
} }
public SideData(EnumColor colour, EnergyState state) public SideData(String n, EnumColor colour, EnergyState state)
{ {
name = n;
color = colour; color = colour;
energyState = state; energyState = state;
} }
public String localize()
{
return MekanismUtils.localize("sideData." + name);
}
public boolean hasSlot(int slot)
{
for(int i : availableSlots)
{
if(i == slot)
{
return true;
}
}
return false;
}
public static enum EnergyState public static enum EnergyState
{ {
INPUT, INPUT,

View file

@ -70,14 +70,13 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_RED, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {0}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.PURPLE, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {2})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {3})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {3}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.ORANGE, new int[] {4}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 4, 5, 3}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 4, 0, 3});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();
gasTank = new GasTank(MAX_GAS); gasTank = new GasTank(MAX_GAS);
@ -125,7 +124,7 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
factory.upgradeComponent.setUpgradeSlot(0); factory.upgradeComponent.setUpgradeSlot(0);
factory.upgradeComponent.tileEntity = factory; factory.upgradeComponent.tileEntity = factory;
factory.ejectorComponent = ejectorComponent; factory.ejectorComponent = ejectorComponent;
factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(5); factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(4);
factory.ejectorComponent.tileEntity = factory; factory.ejectorComponent.tileEntity = factory;
factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length]; factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length];
factory.recipeType = type; factory.recipeType = type;

View file

@ -18,17 +18,16 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.ORANGE, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.PURPLE, new int[] {4})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {5, 6, 7, 8, 9}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_RED, new int[] {5, 6, 7, 8, 9})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {10, 11, 12, 13, 14}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {10, 11, 12, 13, 14}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {5, 4, 0, 3, 2, 1}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 3, 0, 2, 1, 0});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();
upgradeComponent = new TileComponentUpgrade(this, 0); upgradeComponent = new TileComponentUpgrade(this, 0);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(5)); ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(4));
} }
} }

View file

@ -31,13 +31,12 @@ public abstract class TileEntityChanceMachine<RECIPE extends ChanceMachineRecipe
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_RED, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {0}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {2, 4})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2, 4}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.ORANGE, new int[] {3}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 0, 4, 3}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 0, 0, 3});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();
inventory = new ItemStack[5]; inventory = new ItemStack[5];

View file

@ -88,10 +88,10 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.PURPLE, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Gas", EnumColor.PURPLE, new int[] {0}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {2})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {2}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {0, 3, 0, 0, 1, 2}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {0, 3, 0, 0, 1, 2});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();

View file

@ -2,6 +2,7 @@ package mekanism.common.tile;
import java.util.Map; import java.util.Map;
import mekanism.api.EnumColor;
import mekanism.api.MekanismConfig.usage; import mekanism.api.MekanismConfig.usage;
import mekanism.api.gas.Gas; import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasRegistry;
@ -10,12 +11,14 @@ import mekanism.api.gas.GasTransmission;
import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.IGasItem; import mekanism.api.gas.IGasItem;
import mekanism.api.gas.ITubeConnection; import mekanism.api.gas.ITubeConnection;
import mekanism.api.transmitters.TransmissionType;
import mekanism.common.MekanismBlocks; import mekanism.common.MekanismBlocks;
import mekanism.common.SideData;
import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.InjectionRecipe; import mekanism.common.recipe.machines.InjectionRecipe;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@ -25,6 +28,11 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
public TileEntityChemicalInjectionChamber() public TileEntityChemicalInjectionChamber()
{ {
super("injection", "ChemicalInjectionChamber", usage.chemicalInjectionChamberUsage, 1, 200, MachineType.CHEMICAL_INJECTION_CHAMBER.baseEnergy); super("injection", "ChemicalInjectionChamber", usage.chemicalInjectionChamberUsage, 1, 200, MachineType.CHEMICAL_INJECTION_CHAMBER.baseEnergy);
configComponent.addSupported(TransmissionType.GAS);
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {0}));
configComponent.fillConfig(TransmissionType.GAS, 1);
} }
@Override @Override
@ -47,7 +55,7 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
@Override @Override
public int receiveGas(ForgeDirection side, GasStack stack, boolean doTransfer) public int receiveGas(ForgeDirection side, GasStack stack, boolean doTransfer)
{ {
if(isValidGas(stack.getGas())) if(canReceiveGas(side, stack.getGas()))
{ {
return gasTank.receive(stack, doTransfer); return gasTank.receive(stack, doTransfer);
} }
@ -58,7 +66,12 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {
return isValidGas(type); if(configComponent.getOutput(TransmissionType.GAS, side.ordinal(), facing).hasSlot(0))
{
return isValidGas(type);
}
return false;
} }
@Override @Override
@ -83,7 +96,7 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
@Override @Override
public boolean canTubeConnect(ForgeDirection side) public boolean canTubeConnect(ForgeDirection side)
{ {
return true; return configComponent.getOutput(TransmissionType.GAS, side.ordinal(), facing).hasSlot(0);
} }
@Override @Override

View file

@ -10,7 +10,6 @@ import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks; import mekanism.common.MekanismBlocks;
import mekanism.common.MekanismItems; import mekanism.common.MekanismItems;
import mekanism.common.SideData; import mekanism.common.SideData;
import mekanism.common.SideData.EnergyState;
import mekanism.common.Upgrade; import mekanism.common.Upgrade;
import mekanism.common.base.IFactory.RecipeType; import mekanism.common.base.IFactory.RecipeType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.network.PacketTileEntity.TileEntityMessage;
@ -49,13 +48,12 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_RED, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {0}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {2})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.ORANGE, new int[] {3}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 0, 4, 3}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 0, 0, 3});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();
inventory = new ItemStack[4]; inventory = new ItemStack[4];
@ -98,7 +96,7 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
factory.upgradeComponent.setUpgradeSlot(0); factory.upgradeComponent.setUpgradeSlot(0);
factory.upgradeComponent.tileEntity = factory; factory.upgradeComponent.tileEntity = factory;
factory.ejectorComponent = ejectorComponent; factory.ejectorComponent = ejectorComponent;
factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(5); factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(4);
factory.ejectorComponent.tileEntity = factory; factory.ejectorComponent.tileEntity = factory;
factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length]; factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length];
factory.recipeType = type; factory.recipeType = type;

View file

@ -18,17 +18,16 @@ public class TileEntityEliteFactory extends TileEntityFactory
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.ORANGE, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.PURPLE, new int[] {4})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {5, 6, 7, 8, 9, 10, 11}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_RED, new int[] {5, 6, 7, 8, 9, 10, 11})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {12, 13, 14, 15, 16, 17, 18}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {12, 13, 14, 15, 16, 17, 18}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {5, 4, 0, 3, 2, 1}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 3, 0, 2, 1, 0});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();
upgradeComponent = new TileComponentUpgrade(this, 0); upgradeComponent = new TileComponentUpgrade(this, 0);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(5)); ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(4));
} }
} }

View file

@ -121,18 +121,17 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.ORANGE, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.PURPLE, new int[] {4})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {5, 6, 7}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_RED, new int[] {5, 6, 7})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {8, 9, 10}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {8, 9, 10}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {5, 4, 0, 3, 2, 1}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 3, 0, 2, 1, 0});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();
upgradeComponent = new TileComponentUpgrade(this, 0); upgradeComponent = new TileComponentUpgrade(this, 0);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(5)); ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(4));
} }
public TileEntityFactory(FactoryTier type, MachineType machine) public TileEntityFactory(FactoryTier type, MachineType machine)
@ -191,7 +190,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
factory.upgradeComponent.tileEntity = factory; factory.upgradeComponent.tileEntity = factory;
factory.ejectorComponent = ejectorComponent; factory.ejectorComponent = ejectorComponent;
factory.ejectorComponent.tileEntity = factory; factory.ejectorComponent.tileEntity = factory;
factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(5); factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(4);
factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length]; factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length];
for(int i = 0; i < tier.processes+5; i++) for(int i = 0; i < tier.processes+5; i++)

View file

@ -92,14 +92,13 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.ORANGE, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Infuse", EnumColor.PURPLE, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.PURPLE, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {2}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_RED, new int[] {2})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {3}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {3})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {4}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {4}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 5, 3, 4}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {1, 0, 0, 4, 2, 3});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();
inventory = new ItemStack[5]; inventory = new ItemStack[5];

View file

@ -61,11 +61,10 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_RED, new int[] {0})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {0}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_GREEN, new int[] {1})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.DARK_BLUE, new int[] {2})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
configComponent.addOutput(TransmissionType.ITEM, new SideData(EnumColor.ORANGE, new int[] {3}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 0, 0, 3}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 0, 0, 3});
configComponent.setInputEnergyConfig(); configComponent.setInputEnergyConfig();

View file

@ -3,7 +3,6 @@ package mekanism.common.tile.component;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -33,19 +32,24 @@ public class TileComponentConfig implements ITileComponent
public TileComponentConfig(TileEntityContainerBlock tile, TransmissionType... types) public TileComponentConfig(TileEntityContainerBlock tile, TransmissionType... types)
{ {
tileEntity = tile; tileEntity = tile;
transmissions = Arrays.asList(types);
//Populate SideData list with empty arrays for(TransmissionType type : types)
for(TransmissionType transmission : types)
{ {
sideOutputs.put(transmission.ordinal(), new ArrayList<SideData>()); addSupported(type);
ejecting.put(transmission.ordinal(), false);
canEject.put(transmission.ordinal(), true);
} }
tile.components.add(this); tile.components.add(this);
} }
public void addSupported(TransmissionType type)
{
transmissions.add(type);
sideOutputs.put(type.ordinal(), new ArrayList<SideData>());
ejecting.put(type.ordinal(), false);
canEject.put(type.ordinal(), true);
}
public EnumSet<ForgeDirection> getSidesForData(TransmissionType type, int facing, int dataIndex) public EnumSet<ForgeDirection> getSidesForData(TransmissionType type, int facing, int dataIndex)
{ {
EnumSet<ForgeDirection> ret = EnumSet.noneOf(ForgeDirection.class); EnumSet<ForgeDirection> ret = EnumSet.noneOf(ForgeDirection.class);
@ -71,19 +75,26 @@ public class TileComponentConfig implements ITileComponent
return canEject.get(type.ordinal()); return canEject.get(type.ordinal());
} }
public void fillConfig(TransmissionType type, int data)
{
byte sideData = (byte)data;
setConfig(type, new byte[] {sideData, sideData, sideData, sideData, sideData, sideData});
}
public void setIOEnergyConfig() public void setIOEnergyConfig()
{ {
addOutput(TransmissionType.ENERGY, new SideData(EnumColor.GREY, EnergyState.OFF)); addOutput(TransmissionType.ENERGY, new SideData("None", EnumColor.GREY, EnergyState.OFF));
addOutput(TransmissionType.ENERGY, new SideData(EnumColor.DARK_GREEN, EnergyState.INPUT)); addOutput(TransmissionType.ENERGY, new SideData("Input", EnumColor.DARK_GREEN, EnergyState.INPUT));
addOutput(TransmissionType.ENERGY, new SideData(EnumColor.DARK_RED, EnergyState.OUTPUT)); addOutput(TransmissionType.ENERGY, new SideData("Output", EnumColor.DARK_RED, EnergyState.OUTPUT));
setConfig(TransmissionType.ENERGY, new byte[] {1, 1, 2, 1, 1, 1}); setConfig(TransmissionType.ENERGY, new byte[] {1, 1, 2, 1, 1, 1});
} }
public void setInputEnergyConfig() public void setInputEnergyConfig()
{ {
addOutput(TransmissionType.ENERGY, new SideData(EnumColor.GREY, EnergyState.OFF)); addOutput(TransmissionType.ENERGY, new SideData("None", EnumColor.GREY, EnergyState.OFF));
addOutput(TransmissionType.ENERGY, new SideData(EnumColor.DARK_GREEN, EnergyState.INPUT)); addOutput(TransmissionType.ENERGY, new SideData("Input", EnumColor.DARK_GREEN, EnergyState.INPUT));
setConfig(TransmissionType.ENERGY, new byte[] {1, 1, 1, 1, 1, 1}); setConfig(TransmissionType.ENERGY, new byte[] {1, 1, 1, 1, 1, 1});
setCanEject(TransmissionType.ENERGY, false); setCanEject(TransmissionType.ENERGY, false);

View file

@ -601,7 +601,7 @@ public final class MekanismUtils
TileEntity tile = (TileEntity)config; TileEntity tile = (TileEntity)config;
Coord4D coord = Coord4D.get(tile).getFromSide(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, config.getOrientation()))); Coord4D coord = Coord4D.get(tile).getFromSide(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, config.getOrientation())));
tile.getWorldObj().notifyBlockOfNeighborChange(coord.xCoord, coord.yCoord, coord.zCoord, tile.getBlockType()); tile.markDirty();
} }
/** /**
@ -627,7 +627,7 @@ public final class MekanismUtils
TileEntity tile = (TileEntity)config; TileEntity tile = (TileEntity)config;
Coord4D coord = Coord4D.get(tile).getFromSide(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, config.getOrientation()))); Coord4D coord = Coord4D.get(tile).getFromSide(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, config.getOrientation())));
tile.getWorldObj().notifyBlockOfNeighborChange(coord.xCoord, coord.yCoord, coord.zCoord, tile.getBlockType()); tile.markDirty();
} }
/** /**

View file

@ -680,6 +680,15 @@ tooltip.OsmiumOre=A strong mineral that can be found !nat nearly any height in t
tooltip.CopperOre=A common, conductive material that !ncan be used in the production of !nwires. Its ability to withstand !nhigh heats also makes it essential !nto advanced machinery. tooltip.CopperOre=A common, conductive material that !ncan be used in the production of !nwires. Its ability to withstand !nhigh heats also makes it essential !nto advanced machinery.
tooltip.TinOre=A lightweight, yet sturdy, conductive !nmaterial that is found slightly less !ncommonly than Copper. tooltip.TinOre=A lightweight, yet sturdy, conductive !nmaterial that is found slightly less !ncommonly than Copper.
//Side data
sideData.None=None
sideData.Input=Input
sideData.Output=Output
sideData.Energy=Energy
sideData.Gas=Gas
sideData.Extra=Extra
sideData.Infuse=Infuse
//Redstone control //Redstone control
control.disabled=Disabled control.disabled=Disabled
control.high=High control.high=High