Chemical Crystallizer now accepts upgrades
This commit is contained in:
parent
65a8633441
commit
171c9767e0
9 changed files with 57 additions and 54 deletions
|
@ -52,13 +52,14 @@ 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 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() {
|
||||
@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, "GuiChemicalCrystallizer.png")));
|
||||
|
|
|
@ -95,11 +95,6 @@ public class GuiChemicalDissolutionChamber extends GuiMekanism
|
|||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int displayInt;
|
||||
|
||||
displayInt = tileEntity.getScaledProgress(48);
|
||||
drawTexturedModalRect(guiWidth + 64, guiHeight + 40, 176, 63, displayInt, 8);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,11 +87,6 @@ public class GuiChemicalOxidizer extends GuiMekanism
|
|||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
displayInt = tileEntity.getScaledProgress(48);
|
||||
drawTexturedModalRect(guiWidth + 64, guiHeight + 40, 176, 63, displayInt + 1, 8);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,14 +91,9 @@ public class GuiMetallurgicInfuser extends GuiMekanism
|
|||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
displayInt = tileEntity.getScaledProgress(32);
|
||||
drawTexturedModalRect(guiWidth + 72, guiHeight + 47, 176, 52, displayInt + 1, 8);
|
||||
|
||||
if(tileEntity.type != null)
|
||||
{
|
||||
displayInt = tileEntity.getScaledInfuseLevel(52);
|
||||
int displayInt = tileEntity.getScaledInfuseLevel(52);
|
||||
mc.renderEngine.bindTexture(tileEntity.type.texture);
|
||||
drawTexturedModalRect(guiWidth + 7, guiHeight + 17 + 52 - displayInt, tileEntity.type.texX, tileEntity.type.texY + 52 - displayInt, 4, displayInt);
|
||||
}
|
||||
|
|
|
@ -204,16 +204,6 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scaled progress level for the GUI.
|
||||
* @param i - multiplier
|
||||
* @return
|
||||
*/
|
||||
public int getScaledProgress(int i)
|
||||
{
|
||||
return operatingTicks*i / MekanismUtils.getTicks(this, TICKS_REQUIRED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scaled progress level for the GUI.
|
||||
* @return
|
||||
|
|
|
@ -19,12 +19,14 @@ import mekanism.common.IActiveState;
|
|||
import mekanism.common.IEjector;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.tile.component.TileComponentEjector;
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -36,7 +38,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IInvConfiguration
|
||||
public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IInvConfiguration, IUpgradeTile
|
||||
{
|
||||
public static final int MAX_GAS = 10000;
|
||||
public static final int MAX_FLUID = 10000;
|
||||
|
@ -73,6 +75,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
|
|||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
public TileComponentEjector ejectorComponent;
|
||||
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 3);
|
||||
|
||||
public TileEntityChemicalCrystallizer()
|
||||
{
|
||||
|
@ -125,21 +128,21 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
|
|||
inputTank.receive(GasTransmission.removeGas(inventory[0], null, inputTank.getNeeded()), true);
|
||||
}
|
||||
|
||||
if(canOperate() && MekanismUtils.canFunction(this) && getEnergy() >= ENERGY_USAGE)
|
||||
if(canOperate() && MekanismUtils.canFunction(this) && getEnergy() >= MekanismUtils.getEnergyPerTick(this, ENERGY_USAGE))
|
||||
{
|
||||
setActive(true);
|
||||
|
||||
if((operatingTicks+1) < TICKS_REQUIRED)
|
||||
if((operatingTicks+1) < MekanismUtils.getTicks(this, TICKS_REQUIRED))
|
||||
{
|
||||
operatingTicks++;
|
||||
setEnergy(getEnergy() - ENERGY_USAGE);
|
||||
setEnergy(getEnergy() - MekanismUtils.getEnergyPerTick(this, ENERGY_USAGE));
|
||||
}
|
||||
else if((operatingTicks+1) >= TICKS_REQUIRED)
|
||||
else if((operatingTicks+1) >= MekanismUtils.getTicks(this, TICKS_REQUIRED))
|
||||
{
|
||||
operate();
|
||||
|
||||
operatingTicks = 0;
|
||||
setEnergy(getEnergy() - ENERGY_USAGE);
|
||||
setEnergy(getEnergy() - MekanismUtils.getEnergyPerTick(this, ENERGY_USAGE));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -319,14 +322,15 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
|
|||
return inputTank != null ? inputTank.getStored()*i / MAX_GAS : 0;
|
||||
}
|
||||
|
||||
public int getScaledProgress(int i)
|
||||
{
|
||||
return operatingTicks*i / TICKS_REQUIRED;
|
||||
}
|
||||
|
||||
public double getScaledProgress()
|
||||
{
|
||||
return ((double)operatingTicks) / ((double)TICKS_REQUIRED);
|
||||
return ((double)operatingTicks) / ((double)MekanismUtils.getTicks(this, TICKS_REQUIRED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxEnergy()
|
||||
{
|
||||
return MekanismUtils.getMaxEnergy(this, MAX_ELECTRICITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -497,4 +501,42 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
|
|||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,11 +210,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
|
|||
return InventoryUtils.EMPTY;
|
||||
}
|
||||
|
||||
public int getScaledProgress(int i)
|
||||
{
|
||||
return operatingTicks*i / TICKS_REQUIRED;
|
||||
}
|
||||
|
||||
public double getScaledProgress()
|
||||
{
|
||||
return ((double)operatingTicks) / ((double)TICKS_REQUIRED);
|
||||
|
|
|
@ -194,11 +194,6 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
|
|||
return InventoryUtils.EMPTY;
|
||||
}
|
||||
|
||||
public int getScaledProgress(int i)
|
||||
{
|
||||
return operatingTicks*i / MekanismUtils.getTicks(this, TICKS_REQUIRED);
|
||||
}
|
||||
|
||||
public double getScaledProgress()
|
||||
{
|
||||
return ((double)operatingTicks) / ((double)MekanismUtils.getTicks(this, TICKS_REQUIRED));
|
||||
|
|
|
@ -318,11 +318,6 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
return infuseStored*i / MAX_INFUSE;
|
||||
}
|
||||
|
||||
public int getScaledProgress(int i)
|
||||
{
|
||||
return operatingTicks*i / MekanismUtils.getTicks(this, TICKS_REQUIRED);
|
||||
}
|
||||
|
||||
public double getScaledProgress()
|
||||
{
|
||||
return ((double)operatingTicks) / ((double)MekanismUtils.getTicks(this, TICKS_REQUIRED));
|
||||
|
|
Loading…
Reference in a new issue