aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2021-01-01 19:47:10 +0100
committerbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2021-01-01 19:47:10 +0100
commit28fb22fb1375643323e460f08b7d80e1feccb146 (patch)
treea7de8f11a61d7e928b02d860672fbc9848f1d019 /src/main/java/com
parent2769ac5af8aad469a20ad54a3873ed505b99be6a (diff)
downloadGT5-Unofficial-28fb22fb1375643323e460f08b7d80e1feccb146.tar.gz
GT5-Unofficial-28fb22fb1375643323e460f08b7d80e1feccb146.tar.bz2
GT5-Unofficial-28fb22fb1375643323e460f08b7d80e1feccb146.zip
Round Up Replacement-Multiblocks
Former-commit-id: d8a462662ba20d2644572e19fb253751b8a8435e
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java1
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java368
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java102
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement_Coils.java25
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java160
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java76
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java152
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java144
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java83
9 files changed, 721 insertions, 390 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java
index 301e25cd40..228df30f2d 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java
@@ -83,6 +83,7 @@ public class BartWorksCrossmod {
new TT_ImplosionCompressor(null,null);
new TT_ElectronicBlastFurnace(null,null);
new TT_MultiSmelter(null,null);
+ new BW_TT_HeatExchanger(null, null);
}
}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java
new file mode 100644
index 0000000000..9643bd942d
--- /dev/null
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java
@@ -0,0 +1,368 @@
+package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement;
+
+import com.github.technus.tectech.mechanics.structure.IStructureDefinition;
+import com.github.technus.tectech.mechanics.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+import java.util.Collection;
+
+import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADV_STR_CHECK;
+import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.TT_BLUEPRINT;
+import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
+
+public class BW_TT_HeatExchanger extends TT_Abstract_GT_Replacement {
+ public static float penalty_per_config = 0.015f; // penalize 1.5% efficiency per circuitry level (1-25)
+
+ private GT_MetaTileEntity_Hatch_Input mInputHotFluidHatch;
+ private GT_MetaTileEntity_Hatch_Output mOutputColdFluidHatch;
+ private boolean superheated = false;
+ private int superheated_threshold = 0;
+ private float water;
+ private byte blocks = 0;
+
+ public BW_TT_HeatExchanger(Object unused, Object unused2) {
+ super(1154, "multimachine.heatexchanger", "Large Heat Exchanger");
+ }
+
+ public BW_TT_HeatExchanger(String aName) {
+ super(aName);
+ }
+
+ private static final byte TEXTURE_INDEX = 50;
+ private static final byte SOLID_CASING_META = 2;
+ private static final byte PIPE_CASING_META = 14;
+ private static final IStructureDefinition<BW_TT_HeatExchanger> STRUCTURE_DEFINITION = StructureDefinition
+ .<BW_TT_HeatExchanger>builder()
+ .addShape("main",
+ transpose(new String[][]{
+ {"AAA", "ACA", "AAA"},
+ {"AAA", "ABA", "AAA"},
+ {"AAA", "ABA", "AAA"},
+ {"A~A", "ADA", "AAA"}
+ })
+ ).addElement(
+ 'A',
+ ofChain(
+ ofHatchAdder(
+ BW_TT_HeatExchanger::addClassicToMachineList, TEXTURE_INDEX,
+ GregTech_API.sBlockCasings4, SOLID_CASING_META
+ ),
+ onElementPass(
+ x -> ++x.blocks,
+ ofBlock(
+ GregTech_API.sBlockCasings4, SOLID_CASING_META
+ )
+ )
+ )
+
+ ).addElement(
+ 'B',
+ ofBlock(
+ GregTech_API.sBlockCasings2, PIPE_CASING_META,
+ GregTech_API.sBlockCasings2, PIPE_CASING_META
+ )
+ ).addElement(
+ 'C',
+ ofHatchAdder(
+ BW_TT_HeatExchanger::addColdFluidOutputToMachineList,TEXTURE_INDEX,
+ 1
+ )
+ ).addElement(
+ 'D',
+ ofHatchAdder(
+ BW_TT_HeatExchanger::addHotFluidInputToMachineList,TEXTURE_INDEX,
+ 2
+ )
+ )
+ .build();
+
+ @Override
+ public IStructureDefinition<BW_TT_HeatExchanger> getStructure_EM() {
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
+ this.blocks = 0;
+ return this.structureCheck_EM("main", 1, 3, 0) && this.blocks >= 20;
+ }
+
+ private final static String[] desc = new String[]{
+ "Heat Exchanger",
+ "Controller Block for the Large Heat Exchanger",
+ "Inputs are Hot Fluids and Distilled Water",
+ "Outputs Cold Fluids and SH Steam/Steam",
+ "Requires an additional Input and Output Hatch anywhere!",
+ ADV_STR_CHECK,
+ TT_BLUEPRINT
+ };
+
+ public String[] getDescription() {
+ return desc;
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ superheated = aNBT.getBoolean("superheated");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("superheated", superheated);
+ super.saveNBTData(aNBT);
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][50]};
+ }
+
+ private void checkRecipeClassic(float efficiency){
+ int fluidAmountToConsume = mInputHotFluidHatch.getFluidAmount();
+ float steam_output_multiplier = 20f; // default: multiply output by 4 * 10 (boosted x5)
+ boolean do_lava = false;
+ // If we're working with lava, adjust the threshold and multipliers accordingly.
+ if (GT_ModHandler.isLava(mInputHotFluidHatch.getFluid())) {
+ steam_output_multiplier /= 5f; // lava is not boosted
+ superheated_threshold /= 4f; // unchanged
+ do_lava = true;
+ } else if (mInputHotFluidHatch.getFluid().isFluidEqual(FluidRegistry.getFluidStack("ic2hotcoolant", 1))) {
+ steam_output_multiplier /= 2f; // was boosted x2 on top of x5 -> total x10 -> nerf with this code back to 5x
+ superheated_threshold /= 5f; // 10x smaller since the Hot Things production in reactor is the same.
+ }
+
+ superheated = fluidAmountToConsume >= superheated_threshold; // set the internal superheated flag if we have enough hot fluid. Used in the onRunningTick method.
+ fluidAmountToConsume = Math.min(fluidAmountToConsume, superheated_threshold * 2); // Don't consume too much hot fluid per second
+ mInputHotFluidHatch.drain(fluidAmountToConsume, true);
+ this.mMaxProgresstime = 20;
+ this.mEUt = (int) (fluidAmountToConsume * steam_output_multiplier * efficiency);
+ if (do_lava) {
+ mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2pahoehoelava", fluidAmountToConsume), true);
+ } else {
+ mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2coolant", fluidAmountToConsume), true);
+ }
+ this.mEfficiencyIncrease = 80;
+ }
+
+ Materials last = null;
+
+ private void checkRecipe_Additions(float efficiency){
+ Materials m = null;
+ if (last == null || !mInputHotFluidHatch.getFluid().isFluidEqual(last.getPlasma(1))) {
+ for (Materials materials : Materials.values()) {
+ if (mInputHotFluidHatch.getFluid().isFluidEqual(materials.getPlasma(1))) {
+ last = m = materials;
+ break;
+ }
+ else if (mInputHotFluidHatch.getFluid().isFluidEqual(materials.getMolten(1))){
+ GT_Log.exp.println(this.mName + " had Molten Metal Injected!");
+ explodeMultiblock(); // Generate crater
+ return;
+ }
+ }
+ }
+ else
+ m = last;
+
+ if (m == null)
+ return;
+
+ int heat = getFuelValue(mInputHotFluidHatch.getFluid(), (int) (100 * efficiency));
+
+ superheated_threshold /= 4f;
+
+ superheated = heat >= superheated_threshold; // set the internal superheated flag if we have enough hot fluid. Used in the onRunningTick method.
+
+ mInputHotFluidHatch.drain(1, true);
+ this.mMaxProgresstime = 20;
+ this.mEUt = heat;
+ mOutputColdFluidHatch.fill(m.getMolten(1), true);
+ this.mEfficiencyIncrease = 80;
+ }
+
+ private int getFuelValue(FluidStack aLiquid, int efficency) {
+ if (aLiquid == null || getRecipes() == null)
+ return 0;
+ FluidStack tLiquid;
+ Collection<GT_Recipe> tRecipeList = getRecipes().mRecipeList;
+ if (tRecipeList == null)
+ return 0;
+ for (GT_Recipe tFuel : tRecipeList) {
+ tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true);
+ if (tLiquid == null) {
+ continue;
+ }
+ if (!aLiquid.isFluidEqual(tLiquid)) {
+ continue;
+ }
+ long val = (long) tFuel.mSpecialValue * efficency / 100;
+ if (val > Integer.MAX_VALUE) {
+ throw new ArithmeticException("Integer LOOPBACK!");
+ }
+ return (int) val;
+ }
+ return 0;
+ }
+
+ private GT_Recipe.GT_Recipe_Map getRecipes() {
+ return GT_Recipe.GT_Recipe_Map.sPlasmaFuels;
+ }
+
+ public boolean checkRecipe_EM(ItemStack aStack) {
+ if (mInputHotFluidHatch.getFluid() == null)
+ return true;
+ FluidStack fluid = mInputHotFluidHatch.getFluid(); // how much fluid is in hatch
+ superheated_threshold = 4000; // default: must have 4000L per second to generate superheated steam
+ float efficiency = calculateEfficiency();
+
+ if (GT_ModHandler.isLava(fluid) || fluid.isFluidEqual(FluidRegistry.getFluidStack("ic2hotcoolant", 1)))
+ checkRecipeClassic(efficiency);
+ else
+ checkRecipe_Additions(efficiency);
+
+ return true;
+ }
+
+ private float calculateEfficiency(){
+ float defaultEff = 1f; // default: operate at 100% efficiency with no integrated circuitry
+ float penalty; // penalty to apply to output based on circuitry level (1-25).
+ int shs_reduction_per_config = 150; // reduce threshold 150L/s per circuitry level (1-25)
+
+ // Do we have an integrated circuit?
+ if (mInventory[1] == null || mInventory[1].getItem() != GT_Utility.getIntegratedCircuit(0).getItem())
+ return defaultEff;
+
+ //valid configuration?
+ int circuit_config = mInventory[1].getItemDamage();
+ if (circuit_config < 1 || circuit_config > 25)
+ return defaultEff;
+
+ // If so, apply the penalty and reduced threshold.
+ penalty = (circuit_config - 1) * penalty_per_config;
+ superheated_threshold -= (shs_reduction_per_config * (circuit_config - 1));
+ return defaultEff - penalty;
+ }
+
+ private int useWater(float input) {
+ water = water + input;
+ int usage = (int) water;
+ water = water - usage;
+ return usage;
+ }
+
+ public boolean onRunningTick(ItemStack aStack) {
+ if (this.mEUt <= 0) {
+ return false;
+ }
+ int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 100_00L); // APPROXIMATELY how much steam to generate.
+ if (tGeneratedEU <= 0) {
+ return false;
+ }
+
+ if (superheated)
+ tGeneratedEU /= 2; // We produce half as much superheated steam if necessary
+
+ int distilledConsumed = useWater(tGeneratedEU / 160f); // how much distilled water to consume
+ //tGeneratedEU = distilledConsumed * 160; // EXACTLY how much steam to generate, producing a perfect 1:160 ratio with distilled water consumption
+
+ FluidStack distilledStack = GT_ModHandler.getDistilledWater(distilledConsumed);
+ if (depleteInput(distilledStack)) // Consume the distilled water
+ {
+ if (superheated) {
+ addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", tGeneratedEU)); // Generate superheated steam
+ } else {
+ addOutput(GT_ModHandler.getSteam(tGeneratedEU)); // Generate regular steam
+ }
+ } else {
+ GT_Log.exp.println(this.mName + " had no more Distilled water!");
+ explodeMultiblock(); // Generate crater
+ return false;
+ }
+ return true;
+ }
+
+
+ public boolean addColdFluidOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null)
+ return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output)) {
+ return false;
+ }
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ mOutputColdFluidHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity;
+ return true;
+ }
+
+ public boolean addHotFluidInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)) {
+ return false;
+ }
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ mInputHotFluidHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity;
+ mInputHotFluidHatch.mRecipeMap = null;
+ return true;
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new BW_TT_HeatExchanger(this.mName);
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[]{
+ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " +
+ EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " +
+ EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s",
+ StatCollector.translateToLocal("GT5U.multiblock.usage") + " " + StatCollector.translateToLocal("GT5U.LHE.steam") + ": " +
+ (superheated ? EnumChatFormatting.RED : EnumChatFormatting.YELLOW) + (superheated ? -2 * mEUt : -mEUt) + EnumChatFormatting.RESET + " EU/t",
+ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " +
+ EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET +
+ " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
+ EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %",
+ StatCollector.translateToLocal("GT5U.LHE.superheated") + ": " + (superheated ? EnumChatFormatting.RED : EnumChatFormatting.BLUE) + superheated + EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.LHE.superheated") + " " + StatCollector.translateToLocal("GT5U.LHE.threshold") + ": " + EnumChatFormatting.GREEN + superheated_threshold + EnumChatFormatting.RESET
+ };
+ }
+
+ @Override
+ public void construct(ItemStack itemStack, boolean b) {
+ this.structureBuild_EM("main", 1,3,0, b, itemStack);
+ }
+
+ private static final String[] sfStructureDescription = new String[] {
+ "1 - Cold Fluid Output",
+ "2 - Hot Fluid Input",
+ "Needs an additional Output Hatch",
+ "Needs an additional Input Hatch"
+ };
+
+ @Override
+ public String[] getStructureDescription(ItemStack itemStack) {
+ return sfStructureDescription;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java
new file mode 100644
index 0000000000..8486234619
--- /dev/null
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java
@@ -0,0 +1,102 @@
+package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement;
+
+import com.github.technus.tectech.mechanics.constructable.IConstructable;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+public abstract class TT_Abstract_GT_Replacement extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable {
+
+ protected TT_Abstract_GT_Replacement(int newId, String aName, String aNameRegional) {
+ super(32765, aName, aNameRegional);
+ GregTech_API.METATILEENTITIES[32765] = null;
+ GregTech_API.METATILEENTITIES[newId] = this;
+ }
+
+ protected TT_Abstract_GT_Replacement(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", ePowerPass,false,true);
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, ePowerPass, false, true);
+ }
+
+ @Override
+ protected boolean cyclicUpdate_EM() {
+ return false;
+ }
+
+ @Override
+ public boolean isMachineBlockUpdateRecursive() {
+ return true;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ private static final String[] sfStructureDescription = new String[] {"1 - Muffler"};
+
+ @Override
+ public String[] getStructureDescription(ItemStack itemStack) {
+ return sfStructureDescription;
+ }
+
+ public final boolean addEBFInputsBottom(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null)
+ return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch)
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ else
+ return false;
+
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus)
+ return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus)
+ return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output)
+ return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)
+ return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy)
+ return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance)
+ return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti)
+ return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti)
+ return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity);
+ return false;
+ }
+}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement_Coils.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement_Coils.java
new file mode 100644
index 0000000000..868d432eb3
--- /dev/null
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement_Coils.java
@@ -0,0 +1,25 @@
+package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement;
+
+import com.github.bartimaeusnek.crossmod.tectech.helper.IHasCoils;
+import gregtech.api.enums.HeatingCoilLevel;
+
+public abstract class TT_Abstract_GT_Replacement_Coils extends TT_Abstract_GT_Replacement implements IHasCoils {
+ protected TT_Abstract_GT_Replacement_Coils(int newId, String aName, String aNameRegional) {
+ super(newId, aName, aNameRegional);
+ }
+
+ protected TT_Abstract_GT_Replacement_Coils(String aName) {
+ super(aName);
+ }
+ protected HeatingCoilLevel heatingCoilLevel = HeatingCoilLevel.None;
+
+ @Override
+ public void setCoilHeat(HeatingCoilLevel coilMeta) {
+ heatingCoilLevel = coilMeta;
+ }
+
+ @Override
+ public HeatingCoilLevel getCoilHeat() {
+ return heatingCoilLevel;
+ }
+}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java
index 600df60ddc..f2ee015f50 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java
@@ -22,7 +22,6 @@
package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement;
-import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference;
import com.github.bartimaeusnek.crossmod.tectech.helper.CoilAdder;
import com.github.bartimaeusnek.crossmod.tectech.helper.IHasCoils;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
@@ -30,8 +29,6 @@ import com.github.technus.tectech.mechanics.structure.IStructureDefinition;
import com.github.technus.tectech.mechanics.structure.StructureDefinition;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture;
import com.google.common.collect.ImmutableSet;
@@ -39,8 +36,6 @@ import gregtech.api.GregTech_API;
import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
-import gregtech.api.gui.GT_Container_MultiMachine;
-import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -48,13 +43,12 @@ import gregtech.api.interfaces.tileentity.ITurnable;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.*;
import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.Set;
@@ -62,20 +56,18 @@ import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADV_S
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.TT_BLUEPRINT;
import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.enums.GT_Values.VN;
-public class TT_ElectronicBlastFurnace extends GT_MetaTileEntity_MultiblockBase_EM implements IHasCoils, IConstructable {
+public class TT_ElectronicBlastFurnace extends TT_Abstract_GT_Replacement_Coils {
public TT_ElectronicBlastFurnace(Object unused, Object unused2) {
- super(32765, "multimachine.blastfurnace", "Electric Blast Furnace");
- GregTech_API.METATILEENTITIES[32765] = null;
- GregTech_API.METATILEENTITIES[1000] = this;
+ super(1000, "multimachine.blastfurnace", "Electric Blast Furnace");
}
private TT_ElectronicBlastFurnace(String aName) {
super(aName);
}
- private HeatingCoilLevel heatingCoilLevel = HeatingCoilLevel.None;
private int mHeatingCapacity = 0;
private static final byte TEXTURE_INDEX = 11;
@@ -142,11 +134,6 @@ public class TT_ElectronicBlastFurnace extends GT_MetaTileEntity_MultiblockBase_
this.structureBuild_EM("main", 1,3,0, b, itemStack);
}
- @Override
- protected boolean cyclicUpdate_EM() {
- return false;
- }
-
public final boolean addEBFInputsTop(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null)
return false;
@@ -195,48 +182,24 @@ public class TT_ElectronicBlastFurnace extends GT_MetaTileEntity_MultiblockBase_
return false;
}
- public final boolean addEBFInputsBottom(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null)
- return false;
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch)
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- else
- return false;
-
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus)
- return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus)
- return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output)
- return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)
- return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy)
- return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance)
- return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti)
- return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti)
- return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity);
- return false;
- }
+ private static final int pollutionPerTick = 20;
+
+ private final static String[] desc = new String[]{
+ "Blast Furnace",
+ "Controller block for the Electric Blast Furnace",
+ "You can use some fluids to reduce recipe time. Place the circuit in the Input Bus",
+ "Each 900K over the min. Heat required multiplies EU/t by 0.95",
+ "Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal",
+ "Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%",
+ "Additionally gives +100K for every tier past MV",
+ "Creates up to: " + 20 * pollutionPerTick + " Pollution per Second",
+ ADV_STR_CHECK,
+ TT_BLUEPRINT
+ };
@Override
public String[] getDescription() {
- return new String[]{
- "Blast Furnace",
- "Controller block for the Electric Blast Furnace",
- "You can use some fluids to reduce recipe time. Place the circuit in the Input Bus",
- "Each 900K over the min. Heat required multiplies EU/t by 0.95",
- "Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal",
- "Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%",
- "Additionally gives +100K for every tier past MV",
- "Creates up to: " + 20 * getPollutionPerTick(null) + " Pollution per Second",
- ADV_STR_CHECK,
- TT_BLUEPRINT
- };
+ return desc;
}
@Override
@@ -248,31 +211,6 @@ public class TT_ElectronicBlastFurnace extends GT_MetaTileEntity_MultiblockBase_
}
@Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",false,false,true);
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false, true);
- }
-
- @Override
- public void setCoilHeat(HeatingCoilLevel coilMeta) {
- this.heatingCoilLevel = coilMeta;
- }
-
- @Override
- public HeatingCoilLevel getCoilHeat() {
- return heatingCoilLevel;
- }
-
- @Override
- public String[] getStructureDescription(ItemStack itemStack) {
- return new String[0];
- }
-
- @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
return new TT_ElectronicBlastFurnace(this.mName);
}
@@ -366,32 +304,56 @@ public class TT_ElectronicBlastFurnace extends GT_MetaTileEntity_MultiblockBase_
}
@Override
- public boolean isMachineBlockUpdateRecursive() {
- return true;
- }
+ public String[] getInfoData() {
+ int mPollutionReduction = 0;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+ mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
+ }
- @Override
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
+ long storedEnergy = 0;
+ long maxEnergy = 0;
+ for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+ storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
+ }
- @Override
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
+ return new String[]{
+ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " +
+ EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s",
+ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU",
+ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + -mEUt + EnumChatFormatting.RESET + " EU/t",
+ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + getMaxInputVoltage() + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " +
+ EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " +
+ EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET +
+ " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
+ EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %",
+ StatCollector.translateToLocal("GT5U.EBF.heat") + ": " +
+ EnumChatFormatting.GREEN + mHeatingCapacity + EnumChatFormatting.RESET + " K",
+ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"
+ };
}
@Override
public int getPollutionPerTick(ItemStack aStack) {
- return 20;
+ return pollutionPerTick;
}
- @Override
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
+ private static final String[] sfStructureDescription = new String[] {
+ "0 - Air",
+ "1 - Muffler",
+ "Required: Output Bus, Input Bus, Energy Hatch, Maintenance Hatch",
+ "Optional: Input Hatch, Output Hatch at Bottom, Output Hatch at top to regain CO/CO2/SO2"
+ };
@Override
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
+ public String[] getStructureDescription(ItemStack itemStack) {
+ return sfStructureDescription;
}
+
}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java
index 18b5e52bcf..ade1cca05a 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java
@@ -57,23 +57,16 @@ import java.util.List;
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.*;
import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
-public class TT_ImplosionCompressor extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable {
+public class TT_ImplosionCompressor extends TT_Abstract_GT_Replacement {
public TT_ImplosionCompressor(Object unused, Object unused2) {
- super(32765, "multimachine.implosioncompressor", "Implosion Compressor");
- GregTech_API.METATILEENTITIES[32765] = null;
- GregTech_API.METATILEENTITIES[1001] = this;
+ super(1001, "multimachine.implosioncompressor", "Implosion Compressor");
}
private TT_ImplosionCompressor(String aName) {
super(aName);
}
- @Override
- protected boolean cyclicUpdate_EM() {
- return false;
- }
-
private byte blocks = 0;
private static final byte TEXTURE_INDEX = 16;
@@ -92,17 +85,17 @@ public class TT_ImplosionCompressor extends GT_MetaTileEntity_MultiblockBase_EM
).addElement(
'V',
ofChain(
- ofHatchAdder(
- TT_ImplosionCompressor::addImplosionHatches,
- TEXTURE_INDEX,
- 1
- ),
onElementPass(
x -> ++x.blocks,
ofBlocksMap(
BLOCKS.asMap(),GregTech_API.sBlockCasings2,
0
)
+ ),
+ ofHatchAdder(
+ TT_ImplosionCompressor::addImplosionHatches,
+ TEXTURE_INDEX,
+ 1
)
)
).build();
@@ -155,25 +148,24 @@ public class TT_ImplosionCompressor extends GT_MetaTileEntity_MultiblockBase_EM
}
@Override
- public String[] getStructureDescription(ItemStack itemStack) {
- return new String[0];
- }
-
- @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
return new TT_ImplosionCompressor(this.mName);
}
+ private static final int pollutionPerTick = 500;
+
+ private final static String[] desc = new String[]{
+ "Implosion Compressor",
+ "Explosions are fun",
+ "Controller block for the Implosion Compressor",
+ "Creates up to: " + 20 * pollutionPerTick + " Pollution per Second",
+ ADV_STR_CHECK,
+ TT_BLUEPRINT
+ };
+
@Override
public String[] getDescription() {
- return new String[]{
- "Implosion Compressor",
- "Explosions are fun",
- "Controller block for the Implosion Compressor",
- "Creates up to: " + 20 * getPollutionPerTick(null) + " Pollution per Second",
- ADV_STR_CHECK,
- TT_BLUEPRINT
- };
+ return desc;
}
@Override
@@ -185,16 +177,6 @@ public class TT_ImplosionCompressor extends GT_MetaTileEntity_MultiblockBase_EM
}
@Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",false,false,true);
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false, true);
- }
-
- @Override
public IStructureDefinition<TT_ImplosionCompressor> getStructure_EM() {
return STRUCTURE_DEFINITION;
}
@@ -249,22 +231,18 @@ public class TT_ImplosionCompressor extends GT_MetaTileEntity_MultiblockBase_EM
}
@Override
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- @Override
public int getPollutionPerTick(ItemStack aStack) {
- return 500;
+ return pollutionPerTick;
}
- @Override
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
+ private static final String[] sfStructureDescription = new String[] {
+ "0 - Air",
+ "Required: Muffler Hatch, Output Bus, Input Bus, Energy Hatch, Maintenance Hatch"
+ };
@Override
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
+ public String[] getStructureDescription(ItemStack itemStack) {
+ return sfStructureDescription;
}
+
}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java
index 8ebe821e71..392b72a429 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java
@@ -50,6 +50,8 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
@@ -57,23 +59,21 @@ import java.util.ArrayList;
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADV_STR_CHECK;
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.TT_BLUEPRINT;
import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
+import static gregtech.api.enums.GT_Values.VN;
-public class TT_MultiSmelter extends GT_MetaTileEntity_MultiblockBase_EM implements IHasCoils, IConstructable {
+public class TT_MultiSmelter extends TT_Abstract_GT_Replacement_Coils {
private int mLevel;
private int mCostDiscount;
public TT_MultiSmelter(Object unused, Object unused2) {
- super(32765, "multimachine.multifurnace", "Multi Smelter");
- GregTech_API.METATILEENTITIES[32765] = null;
- GregTech_API.METATILEENTITIES[1003] = this;
+ super(1003, "multimachine.multifurnace", "Multi Smelter");
}
private TT_MultiSmelter(String aName) {
super(aName);
}
- private HeatingCoilLevel coilMeta = HeatingCoilLevel.None;
private static final byte TEXTURE_INDEX = 11;
private static final IStructureDefinition<TT_MultiSmelter> STRUCTURE_DEFINITION = StructureDefinition
.<TT_MultiSmelter>builder()
@@ -101,39 +101,23 @@ public class TT_MultiSmelter extends GT_MetaTileEntity_MultiblockBase_EM impleme
).addElement(
'B',
ofHatchAdderOptional(
- TT_MultiSmelter::addHatchesBottom, TEXTURE_INDEX,
+ TT_MultiSmelter::addEBFInputsBottom, TEXTURE_INDEX,
GregTech_API.sBlockCasings1, TEXTURE_INDEX,
GregTech_API.sBlockCasings1, TEXTURE_INDEX
)
)
.build();
- public final boolean addHatchesBottom(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null)
- return false;
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch)
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- else
- return false;
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus)
- return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus)
- return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output)
- return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)
- return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy)
- return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance)
- return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti)
- return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity);
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti)
- return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity);
- return false;
+ private static final String[] sfStructureDescription = new String[] {
+ "0 - Air",
+ "1 - Muffler",
+ "Required: Output Bus, Input Bus, Energy Hatch, Maintenance Hatch",
+ };
+
+ @Override
+ public String[] getStructureDescription(ItemStack itemStack) {
+ return sfStructureDescription;
}
@Override
@@ -166,22 +150,21 @@ public class TT_MultiSmelter extends GT_MetaTileEntity_MultiblockBase_EM impleme
this.structureBuild_EM("main", 1,2,0, b, itemStack);
}
- @Override
- protected boolean cyclicUpdate_EM() {
- return false;
- }
+ private static final int pollutionPerTick = 20;
+
+ private final static String[] desc = new String[]{
+ "Furnace",
+ "Controller Block for the Multi Smelter",
+ "Smelts up to 8-128 items at once",
+ "Items smelted increases with coil tier",
+ "Creates up to: " + 20 * pollutionPerTick + " Pollution per Second",
+ ADV_STR_CHECK,
+ TT_BLUEPRINT
+ };
@Override
public String[] getDescription() {
- return new String[]{
- "Furnace",
- "Controller Block for the Multi Smelter",
- "Smelts up to 8-128 items at once",
- "Items smelted increases with coil tier",
- "Creates up to: " + 20 * getPollutionPerTick(null) + " Pollution per Second",
- ADV_STR_CHECK,
- TT_BLUEPRINT
- };
+ return desc;
}
@Override
@@ -193,31 +176,6 @@ public class TT_MultiSmelter extends GT_MetaTileEntity_MultiblockBase_EM impleme
}
@Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",false,false,true);
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false, true);
- }
-
- @Override
- public void setCoilHeat(HeatingCoilLevel coilMeta) {
- this.coilMeta = coilMeta;
- }
-
- @Override
- public HeatingCoilLevel getCoilHeat() {
- return coilMeta;
- }
-
- @Override
- public String[] getStructureDescription(ItemStack itemStack) {
- return new String[0];
- }
-
- @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
return new TT_MultiSmelter(this.mName);
}
@@ -275,32 +233,44 @@ public class TT_MultiSmelter extends GT_MetaTileEntity_MultiblockBase_EM impleme
}
@Override
- public boolean isMachineBlockUpdateRecursive() {
- return true;
- }
-
- @Override
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
-
- @Override
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- @Override
public int getPollutionPerTick(ItemStack aStack) {
- return 20;
+ return pollutionPerTick;
}
@Override
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
+ public String[] getInfoData() {
+ int mPollutionReduction=0;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches)
+ if (isValidMetaTileEntity(tHatch))
+ mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
+
+ long storedEnergy=0;
+ long maxEnergy=0;
+ for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)
+ if (isValidMetaTileEntity(tHatch)) {
+ storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
+ }
- @Override
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
+ return new String[]{
+ StatCollector.translateToLocal("GT5U.multiblock.Progress")+": "+
+ EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET +" s / "+
+ EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET +" s",
+ StatCollector.translateToLocal("GT5U.multiblock.energy")+": "+
+ EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET +" EU",
+ StatCollector.translateToLocal("GT5U.multiblock.usage")+": "+
+ EnumChatFormatting.RED + -mEUt + EnumChatFormatting.RESET + " EU/t",
+ StatCollector.translateToLocal("GT5U.multiblock.mei")+": "+
+ EnumChatFormatting.YELLOW+ getMaxInputVoltage() +EnumChatFormatting.RESET+" EU/t(*2A) "+StatCollector.translateToLocal("GT5U.machines.tier")+": "+
+ EnumChatFormatting.YELLOW+VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.multiblock.problems")+": "+
+ EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+
+ " "+StatCollector.translateToLocal("GT5U.multiblock.efficiency")+": "+
+ EnumChatFormatting.YELLOW+ mEfficiency / 100.0F +EnumChatFormatting.RESET + " %",
+ StatCollector.translateToLocal("GT5U.MS.multismelting")+": "+
+ EnumChatFormatting.GREEN+mLevel*8+EnumChatFormatting.RESET+" Discount: (EU/t) / "+EnumChatFormatting.GREEN+mCostDiscount+EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"
+ };
}
} \ No newline at end of file
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java
index 3e5dcc5553..aef58cc590 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java
@@ -59,87 +59,86 @@ import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADV_S
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.TT_BLUEPRINT;
import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
-public class TT_OilCrackingUnit extends GT_MetaTileEntity_MultiblockBase_EM implements IHasCoils, IConstructable {
+public class TT_OilCrackingUnit extends TT_Abstract_GT_Replacement_Coils {
public TT_OilCrackingUnit(Object unused, Object unused2) {
- super(32765, "multimachine.cracker", "Oil Cracking Unit");
- GregTech_API.METATILEENTITIES[32765] = null;
- GregTech_API.METATILEENTITIES[1160] = this;
+ super(1160, "multimachine.cracker", "Oil Cracking Unit");
}
private TT_OilCrackingUnit(String aName) {
super(aName);
}
- private HeatingCoilLevel coilMeta = HeatingCoilLevel.None;
-
- @Override
- public void setCoilHeat(HeatingCoilLevel coilMeta) {
- this.coilMeta = coilMeta;
- }
-
- @Override
- public HeatingCoilLevel getCoilHeat() {
- return coilMeta;
- }
-
private byte blocks = 0;
private static final byte TEXTURE_INDEX = 49;
- @Override
- protected boolean cyclicUpdate_EM() {
- return false;
- }
-
private static final IStructureDefinition<TT_OilCrackingUnit> STRUCTURE_DEFINITION = StructureDefinition.<TT_OilCrackingUnit>builder().addShape("main",
transpose(new String[][]{
{"ABABA","ABGBA","ABABA"},
{"AB~BA","E---F","ABABA"},
- {"ABCBA","ABABA","ABABA"}
+ {"ABABA","ABABA","ABABA"}
})
).addElement(
'A',
- onElementPass(
- x -> ++x.blocks,ofBlock(
- GregTech_API.sBlockCasings4,
- 1
+ ofChain(
+ onElementPass(
+ x -> ++x.blocks,
+ ofBlock(
+ GregTech_API.sBlockCasings4,
+ 1
+ )
+ ),
+ ofHatchAdder(
+ TT_OilCrackingUnit::addClassicMaintenanceToMachineList,
+ TEXTURE_INDEX,
+ 1
+ ),
+ ofHatchAdder(
+ TT_OilCrackingUnit::addEnergyIOToMachineList,
+ TEXTURE_INDEX,
+ 1
)
)
).addElement(
'B',
CoilAdder.getINSTANCE()
).addElement(
- 'C',
- ofHatchAdder(
- GT_MetaTileEntity_MultiblockBase_EM::addClassicMaintenanceToMachineList,
- TEXTURE_INDEX,
- 1
- )
- ).addElement(
'E',
ofHatchAdder(
TT_OilCrackingUnit::addInputFluidHatch,
TEXTURE_INDEX,
- 2
+ 1
)
).addElement(
'F',
ofHatchAdder(
TT_OilCrackingUnit::addOutputFluidHatch,
TEXTURE_INDEX,
- 3
+ 2
)
).addElement(
'G',
ofHatchAdder(
TT_OilCrackingUnit::addMiddleFluidHatch,
TEXTURE_INDEX,
- 4
+ 1
)
).build();
- GT_MetaTileEntity_Hatch_Input middleFluidHatch;
+ private static final String[] sfStructureDescription = new String[] {
+ "0 - Air",
+ "1 - Input Hatch",
+ "2 - Output Hatch",
+ "Required: Maintenance Hatch, Energy Hatch"
+ };
+
+ @Override
+ public String[] getStructureDescription(ItemStack itemStack) {
+ return sfStructureDescription;
+ }
+
+ private GT_MetaTileEntity_Hatch_Input middleFluidHatch;
public final boolean addMiddleFluidHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null)
@@ -158,7 +157,7 @@ public class TT_OilCrackingUnit extends GT_MetaTileEntity_MultiblockBase_EM impl
@Override
protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
- this.coilMeta = HeatingCoilLevel.None;
+ this.setCoilHeat(HeatingCoilLevel.None);
this.blocks = 0;
return this.structureCheck_EM("main", 2,1,0)
&& this.blocks >= 18;
@@ -201,18 +200,20 @@ public class TT_OilCrackingUnit extends GT_MetaTileEntity_MultiblockBase_EM impl
return new TT_OilCrackingUnit(this.mName);
}
+ private final static String[] desc = new String[]{
+ "Cracker",
+ "Controller block for the Oil Cracking Unit",
+ "Thermally cracks heavy hydrocarbons into lighter fractions",
+ "More efficient than the Chemical Reactor",
+ "Place the appropriate circuit in the controller",
+ "Gets 5% energy cost reduction per coil tier",
+ ADV_STR_CHECK,
+ TT_BLUEPRINT
+ };
+
@Override
public String[] getDescription() {
- return new String[]{
- "Cracker",
- "Controller block for the Oil Cracking Unit",
- "Thermally cracks heavy hydrocarbons into lighter fractions",
- "More efficient than the Chemical Reactor",
- "Place the appropriate circuit in the controller",
- "Gets 5% energy cost reduction per coil tier",
- ADV_STR_CHECK,
- TT_BLUEPRINT
- };
+ return desc;
}
@Override
@@ -225,16 +226,6 @@ public class TT_OilCrackingUnit extends GT_MetaTileEntity_MultiblockBase_EM impl
}
@Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",false,false,true);
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false, true);
- }
-
- @Override
public boolean checkRecipe_EM(ItemStack aStack) {
ArrayList<FluidStack> tInputList = getStoredFluids();
FluidStack[] tFluidInputs = tInputList.toArray(new FluidStack[0]);
@@ -249,7 +240,7 @@ public class TT_OilCrackingUnit extends GT_MetaTileEntity_MultiblockBase_EM impl
calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, getMaxInputVoltage());
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
- this.mEUt *= Math.pow(0.95D, this.coilMeta.getTier());
+ this.mEUt *= Math.pow(0.95D, this.getCoilHeat().getTier());
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
@@ -263,36 +254,6 @@ public class TT_OilCrackingUnit extends GT_MetaTileEntity_MultiblockBase_EM impl
}
@Override
- public boolean isMachineBlockUpdateRecursive() {
- return true;
- }
-
- @Override
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
-
- @Override
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- @Override
- public int getPollutionPerTick(ItemStack aStack) {
- return 0;
- }
-
- @Override
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
-
- @Override
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
- }
-
- @Override
public ArrayList<FluidStack> getStoredFluids() {
ArrayList<FluidStack> rList = new ArrayList<>();
@@ -319,9 +280,4 @@ public class TT_OilCrackingUnit extends GT_MetaTileEntity_MultiblockBase_EM impl
public void construct(ItemStack itemStack, boolean b) {
this.structureBuild_EM("main", 2,1,0, b, itemStack);
}
-
- @Override
- public String[] getStructureDescription(ItemStack itemStack) {
- return new String[0];
- }
}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java
index 6b9eb89563..273ddc7efd 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java
@@ -54,16 +54,9 @@ import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADV_S
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.TT_BLUEPRINT;
import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
-public class TT_VacuumFreezer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable {
+public class TT_VacuumFreezer extends TT_Abstract_GT_Replacement {
public TT_VacuumFreezer(Object unused, Object unused2) {
- super(32765, "multimachine.vacuumfreezer", "Vacuum Freezer");
- GregTech_API.METATILEENTITIES[32765] = null;
- GregTech_API.METATILEENTITIES[1002] = this;
- }
-
- @Override
- protected boolean cyclicUpdate_EM() {
- return false;
+ super(1002, "multimachine.vacuumfreezer", "Vacuum Freezer");
}
private TT_VacuumFreezer(String aName) {
@@ -80,17 +73,17 @@ public class TT_VacuumFreezer extends GT_MetaTileEntity_MultiblockBase_EM implem
).addElement(
'V',
ofChain(
- ofHatchAdder(
- TT_VacuumFreezer::addVacuumFreezerHatches,
- TEXTURE_INDEX,
- 1
- ),
onElementPass(
x -> ++x.blocks,
ofBlock(
GregTech_API.sBlockCasings2,
1
)
+ ),
+ ofHatchAdder(
+ TT_VacuumFreezer::addVacuumFreezerHatches,
+ TEXTURE_INDEX,
+ 1
)
)
).build();
@@ -100,14 +93,26 @@ public class TT_VacuumFreezer extends GT_MetaTileEntity_MultiblockBase_EM implem
return STRUCTURE_DEFINITION;
}
+ private final static String[] desc = new String[]{
+ "Vacuum Freezer",
+ "Controller Block for the Vacuum Freezer",
+ "Cools hot ingots and cells",
+ ADV_STR_CHECK,
+ TT_BLUEPRINT
+ };
+
+ private static final String[] sfStructureDescription = new String[] {
+ "0 - Air",
+ "Required: Output Bus, Input Bus, Energy Hatch, Maintenance Hatch"
+ };
+
+ @Override
+ public String[] getStructureDescription(ItemStack itemStack) {
+ return sfStructureDescription;
+ }
+
public String[] getDescription() {
- return new String[]{
- "Vacuum Freezer",
- "Controller Block for the Vacuum Freezer",
- "Cools hot ingots and cells",
- ADV_STR_CHECK,
- TT_BLUEPRINT
- };
+ return desc;
}
@Override
@@ -161,46 +166,10 @@ public class TT_VacuumFreezer extends GT_MetaTileEntity_MultiblockBase_EM implem
}
@Override
- public boolean isMachineBlockUpdateRecursive() {
- return true;
- }
-
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- public int getPollutionPerTick(ItemStack aStack) {
- return 0;
- }
-
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
-
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
- }
-
- @Override
public void construct(ItemStack itemStack, boolean b) {
this.structureBuild_EM("main", 1,1,0, b, itemStack);
}
- @Override
- public String[] getStructureDescription(ItemStack itemStack) {
- return new String[0];
- }
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",false,false,true);
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false, true);
- }
-
public final boolean addVacuumFreezerHatches(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity != null) {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();