diff options
author | GlodBlock <1356392126@qq.com> | 2021-12-22 22:16:53 +0800 |
---|---|---|
committer | GlodBlock <1356392126@qq.com> | 2021-12-22 22:16:53 +0800 |
commit | da4165b3699ef8e7174236e6f4d5f093eb1554d4 (patch) | |
tree | baf91d1919212f4dd7c209f65e7a6bdcd1966762 /src/main | |
parent | ab6139b7b72d601dee3c8612481af243937de028 (diff) | |
download | GT5-Unofficial-da4165b3699ef8e7174236e6f4d5f093eb1554d4.tar.gz GT5-Unofficial-da4165b3699ef8e7174236e6f4d5f093eb1554d4.tar.bz2 GT5-Unofficial-da4165b3699ef8e7174236e6f4d5f093eb1554d4.zip |
make UCFE support tt hatch and rocket fuel
Diffstat (limited to 'src/main')
3 files changed, 83 insertions, 36 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/UniversalChemicalFuelEngine.java b/src/main/java/goodgenerator/blocks/tileEntity/UniversalChemicalFuelEngine.java index 4cd0476b4a..568e9b8c03 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/UniversalChemicalFuelEngine.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/UniversalChemicalFuelEngine.java @@ -1,10 +1,9 @@ package goodgenerator.blocks.tileEntity; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; +import goodgenerator.crossmod.LoadedList; import goodgenerator.loader.Loaders; import goodgenerator.util.DescTextLocalization; -import com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -15,6 +14,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.*; import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTPP_Recipe; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -33,12 +33,16 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.enums.Textures.BlockIcons.*; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_MultiblockBase_EM implements TecTechEnabledMulti, IConstructable { +public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { protected final double DIESEL_EFFICIENCY_COEFFICIENT = 0.02D; protected final double GAS_EFFICIENCY_COEFFICIENT = 0.01D; + protected final double ROCKET_EFFICIENCY_COEFFICIENT = 0.005D; protected final double EFFICIENCY_CEILING = 1.5D; + private long lEUt; + private long tEff; + private IStructureDefinition<UniversalChemicalFuelEngine> multiDefinition = null; public UniversalChemicalFuelEngine(String name){super(name);} @@ -94,6 +98,9 @@ public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_MultiblockBas if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo){ ((GT_MetaTileEntity_Hatch)aMetaTileEntity).updateTexture(aBaseCasingIndex); return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo)aMetaTileEntity); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti){ + ((GT_MetaTileEntity_Hatch)aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti)aMetaTileEntity); } } return false; @@ -192,7 +199,7 @@ public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_MultiblockBas } @Override - public String[] getDescription(){ + public String[] getDescription() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Chemical Engine") .addInfo("Controller block for the Chemical Engine") @@ -242,6 +249,7 @@ public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_MultiblockBas consumeAllLiquid(getPromoter()); this.mEUt = (int)(FuelAmount * recipe.mSpecialValue / 20.0D); + this.lEUt = (long)(FuelAmount * recipe.mSpecialValue / 20.0D); this.mMaxProgresstime = 20; this.updateSlots(); return true; @@ -258,28 +266,87 @@ public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_MultiblockBas consumeAllLiquid(getPromoter()); this.mEUt = (int)(FuelAmount * recipe.mSpecialValue / 20.0D); + this.lEUt = (long)(FuelAmount * recipe.mSpecialValue / 20.0D); this.mMaxProgresstime = 20; this.updateSlots(); return true; } + if (LoadedList.GTPP) { + Collection<GT_Recipe> tRocketFuels = GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels.mRecipeList; + for (GT_Recipe recipe : tRocketFuels) { + FluidStack tFuel = findFuel(recipe); + if (tFuel == null) continue; + int FuelAmount = findLiquidAmount(tFuel, tFluids); + if (FuelAmount == 0) continue; + calculateEfficiency(FuelAmount, PromoterAmount, ROCKET_EFFICIENCY_COEFFICIENT); + + consumeAllLiquid(tFuel); + consumeAllLiquid(getPromoter()); + + this.mEUt = (int)(FuelAmount * recipe.mSpecialValue / 20.0D); + this.lEUt = (long)(FuelAmount * recipe.mSpecialValue / 20.0D); + this.mMaxProgresstime = 20; + this.updateSlots(); + return true; + } + } + return false; } + @Override + public boolean onRunningTick(ItemStack stack) { + super.onRunningTick(stack); + if (this.getBaseMetaTileEntity().isServerSide()) { + addAutoEnergy(); + } + return true; + } + + @Override + public String[] getInfoData() { + String[] info = super.getInfoData(); + info[4] = "Probably makes: " + EnumChatFormatting.RED + this.lEUt + EnumChatFormatting.RESET + " EU/t"; + info[6] = "Problems: " + EnumChatFormatting.RED + (this.getIdealStatus() - this.getRepairStatus()) + EnumChatFormatting.RESET + " Efficiency: " + EnumChatFormatting.YELLOW + tEff / 100D + EnumChatFormatting.RESET + " %"; + return info; + } + + void addAutoEnergy() { + long exEU = lEUt * tEff / 10000; + if (!mDynamoHatches.isEmpty()) { + GT_MetaTileEntity_Hatch_Dynamo tHatch = mDynamoHatches.get(0); + if (tHatch.maxEUOutput() * tHatch.maxAmperesOut() >= exEU) { + tHatch.setEUVar(Math.min(tHatch.maxEUStore(), tHatch.getBaseMetaTileEntity().getStoredEU() + exEU)); + } + else tHatch.doExplosion(tHatch.maxEUOutput()); + } + if (!eDynamoMulti.isEmpty()) { + GT_MetaTileEntity_Hatch_DynamoMulti tHatch = eDynamoMulti.get(0); + if (tHatch.maxEUOutput() * tHatch.maxAmperesOut() >= exEU) { + tHatch.setEUVar(Math.min(tHatch.maxEUStore(), tHatch.getBaseMetaTileEntity().getStoredEU() + exEU)); + } + else tHatch.doExplosion(tHatch.maxEUOutput()); + } + } + public FluidStack getPromoter() { return FluidRegistry.getFluidStack("combustionpromotor", 1); } public FluidStack findFuel(GT_Recipe aFuel) { - return GT_Utility.getFluidForFilledItem(aFuel.mInputs[0], true); + if (aFuel.mInputs != null && aFuel.mInputs.length > 0) + return GT_Utility.getFluidForFilledItem(aFuel.mInputs[0], true); + else + return aFuel.mFluidInputs[0]; } - public void calculateEfficiency(int aFuel, int aPromoter, double coefficient){ - if (aPromoter == 0){ - this.mEfficiency = 0; + public void calculateEfficiency(int aFuel, int aPromoter, double coefficient) { + if (aPromoter == 0) { + this.tEff = 0; return; } - this.mEfficiency = (int)(Math.exp(-coefficient * (double)aFuel / (double)aPromoter) * EFFICIENCY_CEILING * 10000); + this.tEff = (int)(Math.exp(-coefficient * (double)aFuel / (double)aPromoter) * EFFICIENCY_CEILING * 10000); } public int findLiquidAmount(FluidStack liquid, List<FluidStack> input) { @@ -305,19 +372,14 @@ public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_MultiblockBas } @Override - public int getMaxEfficiency(ItemStack aStack) { - return (int)(10000 * EFFICIENCY_CEILING); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone){ - if(aSide == aFacing){ - if(aActive) return new ITexture[]{ + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if(aSide == aFacing) { + if(aActive) return new ITexture[] { casingTexturePages[0][50], TextureFactory.of(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE), TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW).glow().build() }; - return new ITexture[]{ + return new ITexture[] { casingTexturePages[0][50], TextureFactory.of(OVERLAY_FRONT_DIESEL_ENGINE), TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_GLOW).glow().build() @@ -327,21 +389,6 @@ public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_MultiblockBas } @Override - public List<GT_MetaTileEntity_Hatch_Energy> getVanillaEnergyHatches() { - return this.mEnergyHatches; - } - - @Override - public List<GT_MetaTileEntity_Hatch_EnergyTunnel> getTecTechEnergyTunnels() { - return new ArrayList<>(); - } - - @Override - public List<GT_MetaTileEntity_Hatch_EnergyMulti> getTecTechEnergyMultis() { - return new ArrayList<>(); - } - - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new UniversalChemicalFuelEngine(this.mName); } diff --git a/src/main/resources/assets/goodgenerator/lang/en_US.lang b/src/main/resources/assets/goodgenerator/lang/en_US.lang index dc1dd22820..289d4a8b88 100644 --- a/src/main/resources/assets/goodgenerator/lang/en_US.lang +++ b/src/main/resources/assets/goodgenerator/lang/en_US.lang @@ -240,7 +240,7 @@ UniversalChemicalFuelEngine.hint.6=1 - Maintenance Hatch UniversalChemicalFuelEngine.hint.7=2 - Muffler Hatch UniversalChemicalFuelEngine.hint.8=3 - Input Hatch UniversalChemicalFuelEngine.hint.9=4 - Dynamo Hatch -UniversalChemicalFuelEngine.hint.10=Doesn't support TecTech Dynamo Hatch +UniversalChemicalFuelEngine.hint.10=Support TecTech Dynamo/Laser Hatch LargeEssentiaGenerator.hint.0=25x Any Essentia Cell LargeEssentiaGenerator.hint.1=4x Amber Bricks LargeEssentiaGenerator.hint.2=24x Arcane Stone Bricks diff --git a/src/main/resources/assets/goodgenerator/lang/zh_CN.lang b/src/main/resources/assets/goodgenerator/lang/zh_CN.lang index 6cc3161aec..61bdabd29b 100644 --- a/src/main/resources/assets/goodgenerator/lang/zh_CN.lang +++ b/src/main/resources/assets/goodgenerator/lang/zh_CN.lang @@ -225,7 +225,7 @@ UniversalChemicalFuelEngine.hint.6=1 - 维护仓 UniversalChemicalFuelEngine.hint.7=2 - 消声仓 UniversalChemicalFuelEngine.hint.8=3 - 输入仓 UniversalChemicalFuelEngine.hint.9=4 - 动力仓 -UniversalChemicalFuelEngine.hint.10=不支持TecTech动力仓 +UniversalChemicalFuelEngine.hint.10=支持TecTech动力仓 LargeEssentiaGenerator.hint.0=25x任意源质扩散单元 LargeEssentiaGenerator.hint.1=4x琥珀砖块 LargeEssentiaGenerator.hint.2=24x奥术石砖 |