Chemical Dissolution Chamber now can accept upgrades
This commit is contained in:
parent
60b226600f
commit
ee00c5a22b
5 changed files with 84 additions and 16 deletions
|
@ -52,7 +52,7 @@ public class GuiChemicalCrystallizer extends GuiMekanism
|
|||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
|
||||
guiElements.add(new GuiUpgradeManagement(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
|
||||
guiElements.add(new GuiUpgradeManagement(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"), 160, 23));
|
||||
guiElements.add(new GuiConfigurationTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
|
||||
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
||||
|
|
|
@ -32,11 +32,12 @@ public class GuiChemicalDissolutionChamber extends GuiMekanism
|
|||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalDissolutionChamber.png")));
|
||||
guiElements.add(new GuiUpgradeManagement(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalDissolutionChamber.png")));
|
||||
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
||||
@Override
|
||||
public List<String> getInfo()
|
||||
{
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.ENERGY_USAGE);
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(MekanismUtils.getEnergyPerTick(tileEntity, tileEntity.ENERGY_USAGE));
|
||||
return ListUtils.asList("Using: " + multiplier + "/t", "Needed: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
|
||||
}
|
||||
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalDissolutionChamber.png")));
|
||||
|
|
|
@ -1277,9 +1277,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
CHEMICAL_INJECTION_CHAMBER(Mekanism.MachineBlock2, 3, "ChemicalInjectionChamber", 31, Mekanism.chemicalInjectionChamberUsage*400, TileEntityChemicalInjectionChamber.class, true, false, true),
|
||||
ELECTROLYTIC_SEPARATOR(Mekanism.MachineBlock2, 4, "ElectrolyticSeparator", 32, 400000, TileEntityElectrolyticSeparator.class, true, true, false),
|
||||
PRECISION_SAWMILL(Mekanism.MachineBlock2, 5, "PrecisionSawmill", 34, Mekanism.precisionSawmillUsage*400, TileEntityPrecisionSawmill.class, true, false, true),
|
||||
CHEMICAL_DISSOLUTION_CHAMBER(Mekanism.MachineBlock2, 6, "ChemicalDissolutionChamber", 35, 20000, TileEntityChemicalDissolutionChamber.class, true, true, false),
|
||||
CHEMICAL_DISSOLUTION_CHAMBER(Mekanism.MachineBlock2, 6, "ChemicalDissolutionChamber", 35, 20000, TileEntityChemicalDissolutionChamber.class, true, true, true),
|
||||
CHEMICAL_WASHER(Mekanism.MachineBlock2, 7, "ChemicalWasher", 36, 20000, TileEntityChemicalWasher.class, true, true, false),
|
||||
CHEMICAL_CRYSTALLIZER(Mekanism.MachineBlock2, 8, "ChemicalCrystallizer", 37, 20000, TileEntityChemicalCrystallizer.class, true, true, false),
|
||||
CHEMICAL_CRYSTALLIZER(Mekanism.MachineBlock2, 8, "ChemicalCrystallizer", 37, 20000, TileEntityChemicalCrystallizer.class, true, true, true),
|
||||
SEISMIC_VIBRATOR(Mekanism.MachineBlock2, 9, "SeismicVibrator", 39, 20000, TileEntitySeismicVibrator.class, true, true, false),
|
||||
PRESSURIZED_REACTION_CHAMBER(Mekanism.MachineBlock2, 10, "PressurizedReactionChamber", 40, 20000, TileEntityPRC.class, true, true, false),
|
||||
PORTABLE_TANK(Mekanism.MachineBlock2, 11, "PortableTank", 41, 0, TileEntityPortableTank.class, false, true, false),
|
||||
|
|
|
@ -2,7 +2,9 @@ package mekanism.common.inventory.container;
|
|||
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
|
||||
import mekanism.common.inventory.slot.SlotMachineUpgrade;
|
||||
import mekanism.common.inventory.slot.SlotStorageTank;
|
||||
import mekanism.common.item.ItemMachineUpgrade;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.tile.TileEntityChemicalDissolutionChamber;
|
||||
|
@ -24,6 +26,7 @@ public class ContainerChemicalDissolutionChamber extends Container
|
|||
addSlotToContainer(new Slot(tentity, 1, 26, 36));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, 2, 155, 25));
|
||||
addSlotToContainer(new SlotDischarge(tentity, 3, 155, 5));
|
||||
addSlotToContainer(new SlotMachineUpgrade(tentity, 4, 180, 11));
|
||||
|
||||
int slotY;
|
||||
|
||||
|
@ -80,7 +83,7 @@ public class ContainerChemicalDissolutionChamber extends Container
|
|||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -97,7 +100,7 @@ public class ContainerChemicalDissolutionChamber extends Container
|
|||
}
|
||||
else if(slotID == 3)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -116,29 +119,45 @@ public class ContainerChemicalDissolutionChamber extends Container
|
|||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
|
||||
{
|
||||
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3 && slotID != 4)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 4, 5, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(slotID >= 4 && slotID <= 30)
|
||||
if(slotID >= 5 && slotID <= 31)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
|
||||
if(!mergeItemStack(slotStack, 32, inventorySlots.size(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(slotID > 31)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 4, 30, false))
|
||||
if(!mergeItemStack(slotStack, 5, 31, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -16,11 +16,13 @@ import mekanism.api.gas.ITubeConnection;
|
|||
import mekanism.client.sound.IHasSound;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -29,7 +31,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IGasHandler
|
||||
public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IGasHandler, IUpgradeTile
|
||||
{
|
||||
public GasTank injectTank = new GasTank(MAX_GAS);
|
||||
public GasTank outputTank = new GasTank(MAX_GAS);
|
||||
|
@ -53,13 +55,15 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
|
|||
public int TICKS_REQUIRED = 100;
|
||||
|
||||
public final double ENERGY_USAGE = Mekanism.chemicalDissolutionChamberUsage;
|
||||
|
||||
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 3);
|
||||
|
||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
public TileEntityChemicalDissolutionChamber()
|
||||
{
|
||||
super("ChemicalDissolutionChamber", MachineType.CHEMICAL_DISSOLUTION_CHAMBER.baseEnergy);
|
||||
inventory = new ItemStack[4];
|
||||
inventory = new ItemStack[5];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -107,12 +111,12 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
|
|||
|
||||
boolean changed = false;
|
||||
|
||||
if(canOperate() && getEnergy() >= ENERGY_USAGE && injectTank.getStored() >= INJECT_USAGE && MekanismUtils.canFunction(this))
|
||||
if(canOperate() && getEnergy() >= MekanismUtils.getEnergyPerTick(this, ENERGY_USAGE) && injectTank.getStored() >= INJECT_USAGE && MekanismUtils.canFunction(this))
|
||||
{
|
||||
setActive(true);
|
||||
setEnergy(getEnergy() - ENERGY_USAGE);
|
||||
setEnergy(getEnergy() - MekanismUtils.getEnergyPerTick(this, ENERGY_USAGE));
|
||||
|
||||
if(operatingTicks < TICKS_REQUIRED)
|
||||
if(operatingTicks < MekanismUtils.getTicks(this, TICKS_REQUIRED))
|
||||
{
|
||||
operatingTicks++;
|
||||
injectTank.draw(INJECT_USAGE, true);
|
||||
|
@ -321,6 +325,12 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
|
|||
{
|
||||
return i != 0 && i != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxEnergy()
|
||||
{
|
||||
return MekanismUtils.getMaxEnergy(this, MAX_ELECTRICITY);
|
||||
}
|
||||
|
||||
public int getScaledInjectGasLevel(int i)
|
||||
{
|
||||
|
@ -423,4 +433,42 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.energyMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.energyMultiplier = multiplier;
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.speedMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.speedMultiplier = multiplier;
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentUpgrade getComponent()
|
||||
{
|
||||
return upgradeComponent;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue