Modified factory-capable machine side data to match that of factories, allowing for configuration preservation

This commit is contained in:
aidancbrady 2016-03-05 19:33:02 -05:00
parent b13d8ee1ab
commit d77de295f2
4 changed files with 39 additions and 15 deletions

View file

@ -68,11 +68,11 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", 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("Extra", EnumColor.PURPLE, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", 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("Energy", 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("Extra", EnumColor.PURPLE, new int[] {1}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 4, 0, 3}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 1, 0, 3, 0, 2});
configComponent.setInputConfig(TransmissionType.ENERGY); configComponent.setInputConfig(TransmissionType.ENERGY);
gasTank = new GasTank(MAX_GAS); gasTank = new GasTank(MAX_GAS);
@ -86,7 +86,7 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
upgradeComponent.setSupported(Upgrade.MUFFLING); upgradeComponent.setSupported(Upgrade.MUFFLING);
ejectorComponent = new TileComponentEjector(this); ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(3)); ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
} }
public void upgrade(RecipeType type) public void upgrade(RecipeType type)
@ -120,10 +120,16 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
factory.upgradeComponent.readFrom(upgradeComponent); factory.upgradeComponent.readFrom(upgradeComponent);
factory.upgradeComponent.setUpgradeSlot(0); factory.upgradeComponent.setUpgradeSlot(0);
factory.ejectorComponent.readFrom(ejectorComponent); factory.ejectorComponent.readFrom(ejectorComponent);
factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(4)); factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(2));
factory.recipeType = type; factory.recipeType = type;
factory.upgradeComponent.setSupported(Upgrade.GAS, type.fuelEnergyUpgrades()); factory.upgradeComponent.setSupported(Upgrade.GAS, type.fuelEnergyUpgrades());
for(TransmissionType transmission : configComponent.transmissions)
{
factory.configComponent.setConfig(transmission, configComponent.getConfig(transmission));
factory.configComponent.setEjecting(transmission, configComponent.isEjecting(transmission));
}
//Advanced Machine //Advanced Machine
factory.gasTank.setGas(gasTank.getGas()); factory.gasTank.setGas(gasTank.getGas());

View file

@ -38,12 +38,17 @@ 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("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {0}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", 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("Energy", 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("Output", EnumColor.DARK_BLUE, new int[] {2})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 0, 0, 3}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {3, 1, 0, 0, 0, 2});
configComponent.setInputConfig(TransmissionType.ENERGY); configComponent.setInputConfig(TransmissionType.ENERGY);
inventory = new ItemStack[4]; inventory = new ItemStack[4];
@ -52,7 +57,7 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
upgradeComponent.setSupported(Upgrade.MUFFLING); upgradeComponent.setSupported(Upgrade.MUFFLING);
ejectorComponent = new TileComponentEjector(this); ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(3)); ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
} }
public void upgrade(RecipeType type) public void upgrade(RecipeType type)
@ -86,10 +91,16 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
factory.upgradeComponent.readFrom(upgradeComponent); factory.upgradeComponent.readFrom(upgradeComponent);
factory.upgradeComponent.setUpgradeSlot(0); factory.upgradeComponent.setUpgradeSlot(0);
factory.ejectorComponent.readFrom(ejectorComponent); factory.ejectorComponent.readFrom(ejectorComponent);
factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(4)); factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(2));
factory.recipeType = type; factory.recipeType = type;
factory.upgradeComponent.setSupported(Upgrade.GAS, type.fuelEnergyUpgrades()); factory.upgradeComponent.setSupported(Upgrade.GAS, type.fuelEnergyUpgrades());
for(TransmissionType transmission : configComponent.transmissions)
{
factory.configComponent.setConfig(transmission, configComponent.getConfig(transmission));
factory.configComponent.setEjecting(transmission, configComponent.isEjecting(transmission));
}
factory.inventory[5] = inventory[0]; factory.inventory[5] = inventory[0];
factory.inventory[1] = inventory[1]; factory.inventory[1] = inventory[1];
factory.inventory[5+3] = inventory[2]; factory.inventory[5+3] = inventory[2];

View file

@ -136,11 +136,12 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY, TransmissionType.GAS); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY, TransmissionType.GAS);
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", 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("Input", 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("Output", EnumColor.DARK_BLUE, new int[] {8, 9, 10}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 3, 0, 2, 1, 0}); configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 0, 0, 3, 1, 2});
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY)); 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.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {0}));
@ -153,7 +154,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
upgradeComponent.setSupported(Upgrade.MUFFLING); upgradeComponent.setSupported(Upgrade.MUFFLING);
ejectorComponent = new TileComponentEjector(this); ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(4)); ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
} }
public TileEntityFactory(FactoryTier type, MachineType machine) public TileEntityFactory(FactoryTier type, MachineType machine)

View file

@ -89,12 +89,12 @@ 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("None", EnumColor.GREY, InventoryUtils.EMPTY)); configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Infuse", EnumColor.PURPLE, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {2})); configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", 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("Output", 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("Energy", EnumColor.DARK_GREEN, new int[] {4}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Infuse", EnumColor.PURPLE, new int[] {1}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {1, 0, 0, 4, 2, 3}); configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 0, 0, 3, 1, 2});
configComponent.setInputConfig(TransmissionType.ENERGY); configComponent.setInputConfig(TransmissionType.ENERGY);
inventory = new ItemStack[5]; inventory = new ItemStack[5];
@ -103,7 +103,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
upgradeComponent.setSupported(Upgrade.MUFFLING); upgradeComponent.setSupported(Upgrade.MUFFLING);
ejectorComponent = new TileComponentEjector(this); ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(3)); ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
} }
@Override @Override
@ -228,10 +228,16 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
factory.upgradeComponent.readFrom(upgradeComponent); factory.upgradeComponent.readFrom(upgradeComponent);
factory.upgradeComponent.setUpgradeSlot(0); factory.upgradeComponent.setUpgradeSlot(0);
factory.ejectorComponent.readFrom(ejectorComponent); factory.ejectorComponent.readFrom(ejectorComponent);
factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(4)); factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(2));
factory.recipeType = type; factory.recipeType = type;
factory.upgradeComponent.setSupported(Upgrade.GAS, type.fuelEnergyUpgrades()); factory.upgradeComponent.setSupported(Upgrade.GAS, type.fuelEnergyUpgrades());
for(TransmissionType transmission : configComponent.transmissions)
{
factory.configComponent.setConfig(transmission, configComponent.getConfig(transmission));
factory.configComponent.setEjecting(transmission, configComponent.isEjecting(transmission));
}
//Infuser //Infuser
factory.infuseStored.amount = infuseStored.amount; factory.infuseStored.amount = infuseStored.amount;
factory.infuseStored.type = infuseStored.type; factory.infuseStored.type = infuseStored.type;