From bc16f6da5c14e43cf3c0b375f7aa5d4e73dc4275 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Sat, 18 Jan 2025 17:42:45 +0100 Subject: [PATCH 1/6] Fix T7 water crash on restart when using bonus output (#3823) Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- .../multi/purification/MTEPurificationUnitDegasser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java index 417b7af59b1..39eee8110bd 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java @@ -668,8 +668,8 @@ protected void runMachine(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { @Override public void addRecipeOutputs() { super.addRecipeOutputs(); - if (outputMultiplier > 1.01f) { - FluidStack waterOutput = currentRecipe.mFluidOutputs[0]; + if (outputMultiplier > 1.01f && mOutputFluids != null) { + FluidStack waterOutput = mOutputFluids[0]; FluidStack bonusOutput = new FluidStack( waterOutput.getFluid(), (int) (this.effectiveParallel * waterOutput.amount * (outputMultiplier - 1.0f))); From 0e0d4776ef2cad4bd26d9ea46644feb799fd9761 Mon Sep 17 00:00:00 2001 From: Elisis Date: Sun, 19 Jan 2025 03:53:29 +1100 Subject: [PATCH 2/6] Beamline fixes 5 (#3822) Co-authored-by: Martin Robertz Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- .../gtnhlanth/common/tileentity/MTELINAC.java | 29 +++++----- .../common/tileentity/MTESynchrotron.java | 55 +++++++++---------- .../common/tileentity/MTETargetChamber.java | 7 ++- src/main/java/gtnhlanth/util/Util.java | 13 +++++ 4 files changed, 57 insertions(+), 47 deletions(-) diff --git a/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java b/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java index fa760dda9df..9cc408801a8 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java @@ -1,6 +1,7 @@ package gtnhlanth.common.tileentity; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel; import static gregtech.api.enums.GTValues.VN; import static gregtech.api.enums.HatchElement.Energy; import static gregtech.api.enums.HatchElement.InputHatch; @@ -116,12 +117,14 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu .addElement('g', ofBlock(GregTechAPI.sBlockCasings3, 10)) // Grate Machine Casing .addElement( 'b', - BorosilicateGlass.ofBoroGlass( - (byte) 0, - MIN_GLASS_TIER, - Byte.MAX_VALUE, - (te, t) -> te.glassTier = t, - te -> te.glassTier)) + withChannel( + "glass", + BorosilicateGlass.ofBoroGlass( + (byte) 0, + MIN_GLASS_TIER, + Byte.MAX_VALUE, + (te, t) -> te.glassTier = t, + te -> te.glassTier))) .addElement( 'i', buildHatchAdder(MTELINAC.class).hatchClass(MTEHatchInputBeamline.class) @@ -323,16 +326,10 @@ public CheckRecipeResult checkProcessing() { // Particle stays the same with this multiblock outputParticle = particleId; - if (primFluid.isFluidEqual(new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1))) { - tempFactor = calculateTemperatureFactor(60); // Default temp of 300 is unreasonable - machineTemp = 60; // Solely for tricorder use - } else { - tempFactor = calculateTemperatureFactor( - primFluid.getFluid() - .getTemperature()); - machineTemp = primFluid.getFluid() - .getTemperature(); // Solely for tricorder use - } + int coolantTemperature = Util.coolantFluidTemperature(primFluid); + + tempFactor = calculateTemperatureFactor(coolantTemperature); + machineTemp = coolantTemperature; // Solely for tricorder use machineFocus = Math.max(((-0.9f) * this.length * tempFactor) + 110, 5); // Min of 5 if (machineFocus > 90) { // Max of 90 diff --git a/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java b/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java index c9e0cf75b96..01599d13444 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java @@ -1,7 +1,7 @@ package gtnhlanth.common.tileentity; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAdder; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel; import static gregtech.api.enums.GTValues.VN; import static gregtech.api.enums.HatchElement.Energy; import static gregtech.api.enums.HatchElement.ExoticEnergy; @@ -17,6 +17,7 @@ import static gtnhlanth.util.DescTextLocalization.addDotText; import java.util.ArrayList; +import java.util.HashMap; import java.util.Objects; import net.minecraft.block.Block; @@ -28,13 +29,16 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureUtility; import bartworks.API.BorosilicateGlass; import gregtech.api.GregTechAPI; @@ -80,6 +84,8 @@ public class MTESynchrotron extends MTEExtendedPowerMultiBlockBase mAntennaCasings = new ArrayList<>(); + private static HashMap allowedAntennas = new HashMap<>(2); + private static final int CASING_INDEX = GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings5, 14); private static final byte MIN_GLASS_TIER = 6; @@ -99,6 +105,9 @@ public class MTESynchrotron extends MTEExtendedPowerMultiBlockBase 1200eV for x-ray lithography // spotless:off static { + + allowedAntennas.put(LanthItemList.ANTENNA_CASING_T1, 0); + allowedAntennas.put(LanthItemList.ANTENNA_CASING_T2, 0); STRUCTURE_DEFINITION = StructureDefinition.builder().addShape( STRUCTURE_PIECE_ENTRANCE, @@ -453,18 +462,23 @@ public class MTESynchrotron extends MTEExtendedPowerMultiBlockBase (block == LanthItemList.ANTENNA_CASING_T1 ? 1 : block == LanthItemList.ANTENNA_CASING_T2 ? 2 : -1), + ImmutableList.of( + Pair.of(LanthItemList.ANTENNA_CASING_T1, 0), + Pair.of(LanthItemList.ANTENNA_CASING_T2, 0)), + -2, MTESynchrotron::setAntennaTier, MTESynchrotron::getAntennaTier))) .addElement('i', buildHatchAdder(MTESynchrotron.class).atLeast(ImmutableMap.of(InputHatch, 2)).dot(4).casingIndex(CASING_INDEX).build()) .addElement('o', buildHatchAdder(MTESynchrotron.class).atLeast(ImmutableMap.of(OutputHatch, 2)).dot(5).casingIndex(CASING_INDEX).build()) .addElement('v', buildHatchAdder(MTESynchrotron.class).hatchClass(MTEHatchInputBeamline.class).casingIndex(CASING_INDEX) .dot(1).adder(MTESynchrotron::addBeamlineInputHatch).build()) .addElement('b', buildHatchAdder(MTESynchrotron.class).hatchClass(MTEHatchOutputBeamline.class).casingIndex(CASING_INDEX) .dot(2).adder(MTESynchrotron::addBeamlineOutputHatch).build()) - .addElement('g', BorosilicateGlass.ofBoroGlass((byte) 0, MIN_GLASS_TIER, Byte.MAX_VALUE, (te, t) -> te.glassTier = t, te -> te.glassTier)) + .addElement('g', withChannel("glass", BorosilicateGlass.ofBoroGlass((byte) 0, MIN_GLASS_TIER, Byte.MAX_VALUE, (te, t) -> te.glassTier = t, te -> te.glassTier))) .addElement('j', buildHatchAdder(MTESynchrotron.class).atLeast(Maintenance).dot(3).casingIndex(CASING_INDEX) .buildAndChain(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0)) - + .build(); @@ -693,21 +707,12 @@ public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int */ } - private boolean addAntenna(Block block, int meta) { - - if (block == null) return false; - - if (!(block instanceof BlockAntennaCasing antennaBlock)) return false; - - int antennaTier = antennaBlock.getTier(); - - // First antenna casing added - if (this.mAntennaCasings.isEmpty()) this.antennaeTier = antennaTier; - - if (antennaTier != this.antennaeTier) return false; - - return mAntennaCasings.add(antennaBlock); + public void setAntennaTier(int t) { + this.antennaeTier = t; + } + public int getAntennaTier() { + return this.antennaeTier; } @Override @@ -784,14 +789,7 @@ public CheckRecipeResult checkProcessing() { FluidStack primaryFluid = fluidList.get(0); - int fluidTemperature; - - if (primaryFluid.isFluidEqual(new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1))) { - fluidTemperature = 60; // Default temp of 300 is unreasonable - } else { - fluidTemperature = primaryFluid.getFluid() - .getTemperature(); - } + int fluidTemperature = Util.coolantFluidTemperature(primaryFluid); machineTemp = fluidTemperature; // Solely for tricorder info @@ -1024,7 +1022,7 @@ public String[] getInfoData() { + " K", // e.g. "137 K" StatCollector.translateToLocal("beamline.coolusage") + ": " // Coolant Usage: + EnumChatFormatting.AQUA - + 32_000 + + 32 + EnumChatFormatting.RESET + " kL/s", // 32 kL/s @@ -1087,7 +1085,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a this.energyHatchAmperage = 0; this.usingExotic = false; - this.antennaeTier = 0; + this.antennaeTier = -2; this.glassTier = 0; @@ -1100,6 +1098,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a if (!checkPiece(STRUCTURE_PIECE_BASE, 16, 3, 0)) return false; return this.mInputBeamline.size() == 1 && this.mOutputBeamline.size() == 1 + && this.antennaeTier > 0 && this.mMaintenanceHatches.size() == 1 && (this.mEnergyHatches.size() == 4 || this.mExoticEnergyHatches.size() == 4) && this.glassTier >= MIN_GLASS_TIER; diff --git a/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java b/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java index 6d81f2eb385..cb9aea56e2f 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java @@ -33,6 +33,7 @@ import bartworks.common.loaders.ItemRegistry; import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; import gregtech.api.enums.TickTime; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -255,7 +256,7 @@ public CheckRecipeResult checkProcessing() { tItemsWithFocusItem.add(tFocusItemZeroDamage); tItemsWithFocusItem.addAll(tItems); - long tVoltage = this.getMaxInputVoltage(); + long tVoltageActual = GTValues.VP[(int) this.getInputVoltageTier()]; ItemStack[] tItemsArray = tItems.toArray(new ItemStack[0]); @@ -263,7 +264,7 @@ public CheckRecipeResult checkProcessing() { RecipeTC tRecipe = (RecipeTC) BeamlineRecipeAdder2.instance.TargetChamberRecipes.findRecipeQuery() .items(tItemsWithFocusItemArray) - .voltage(tVoltage) + .voltage(tVoltageActual) .filter((GTRecipe recipe) -> { RecipeTC recipeTc = (RecipeTC) recipe; @@ -357,7 +358,7 @@ public CheckRecipeResult checkProcessing() { this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - mEUt = (int) -tVoltage; + mEUt = (int) -tVoltageActual; if (this.mEUt > 0) this.mEUt = (-this.mEUt); this.mOutputItems = itemOutputArray; diff --git a/src/main/java/gtnhlanth/util/Util.java b/src/main/java/gtnhlanth/util/Util.java index e3259659666..ff64fd9ff76 100644 --- a/src/main/java/gtnhlanth/util/Util.java +++ b/src/main/java/gtnhlanth/util/Util.java @@ -52,4 +52,17 @@ public static boolean coolantFluidCheck(FluidStack inStack, int fluidToConsume) || (!inStack.isFluidEqual(FluidRegistry.getFluidStack("ic2coolant", 1)) && inStack.getFluid() .getTemperature() > 200)); } + + public static int coolantFluidTemperature(FluidStack inStack) { + int fluidTemperature = 300; + + if (inStack.isFluidEqual(new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1))) { + fluidTemperature = 60; // Default temp of 300 is unreasonable + } else { + fluidTemperature = inStack.getFluid() + .getTemperature(); + } + + return fluidTemperature; + } } From 890ba2909d8fb34cfc45cc321a946f5f124379e3 Mon Sep 17 00:00:00 2001 From: Brady Date: Sat, 18 Jan 2025 16:38:04 -0500 Subject: [PATCH 3/6] Add null check for current recipe on t5 water failure (#3824) Co-authored-by: Brady --- .../multi/purification/MTEPurificationUnitPlasmaHeater.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPlasmaHeater.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPlasmaHeater.java index 68d3f3bd865..2a6ee0b54e3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPlasmaHeater.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPlasmaHeater.java @@ -432,7 +432,8 @@ private long drainFluidLimited(MTEHatchInput inputHatch, FluidStack fluid, long public void addRecipeOutputs() { super.addRecipeOutputs(); // If the cycle was ruined, output steam - if (this.ruinedCycle) { + // currentRecipe is null when multi is unloaded and reloaded + if (this.ruinedCycle && currentRecipe != null) { FluidStack insertedWater = currentRecipe.mFluidInputs[0]; // Multiply by 60 since that's the water:steam ratio in GTNH long steamAmount = insertedWater.amount * 60L; From d6a4bad3c2c5bfeffa9d6af3d7988163f357500e Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Sun, 19 Jan 2025 02:03:36 +0100 Subject: [PATCH 4/6] update --- dependencies.gradle | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 43964d60f9a..d285a8a1fd8 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -36,14 +36,14 @@ dependencies { api("com.github.GTNewHorizons:StructureLib:1.4.2:dev") api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") - api("com.github.GTNewHorizons:NotEnoughItems:2.7.20-GTNH:dev") + api("com.github.GTNewHorizons:NotEnoughItems:2.7.22-GTNH:dev") api("com.github.GTNewHorizons:NotEnoughIds:2.1.6:dev") api("com.github.GTNewHorizons:GTNHLib:0.6.2:dev") api("com.github.GTNewHorizons:ModularUI:1.2.17:dev") api("com.github.GTNewHorizons:ModularUI2:2.2.0-1.7.10:dev") api("com.github.GTNewHorizons:waila:1.8.2:dev") - api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-521-GTNH:dev") - api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.22-gtnh:dev") + api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-523-GTNH:dev") + api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.23-gtnh:dev") api('com.github.GTNewHorizons:Yamcl:0.6.0:dev') api("com.github.GTNewHorizons:Postea:1.0.13:dev") @@ -58,7 +58,7 @@ dependencies { compileOnlyApi("com.github.GTNewHorizons:Avaritia:1.59:dev") - compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta28:api') { transitive = false } + compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta29:api') { transitive = false } compileOnlyApi("com.github.GTNewHorizons:AppleCore:3.3.4:dev") { transitive = false } compileOnlyApi("com.github.GTNewHorizons:BuildCraft:7.1.42:dev") { transitive = false } compileOnlyApi("com.github.GTNewHorizons:EnderIO:2.9.2:dev") { transitive = false } @@ -80,7 +80,7 @@ dependencies { compileOnly rfg.deobf("curse.maven:cofh-core-69162:2388751") compileOnly("com.github.GTNewHorizons:Nuclear-Control:2.6.7:dev") { transitive = false } compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { transitive = false } - implementation("com.github.GTNewHorizons:Hodgepodge:2.6.15:dev") + implementation("com.github.GTNewHorizons:Hodgepodge:2.6.16:dev") compileOnly('com.github.GTNewHorizons:Botania:1.12.5-GTNH:dev') { transitive = false } compileOnly('com.github.GTNewHorizons:HoloInventory:2.5.0-GTNH:dev') { transitive = false } compileOnly rfg.deobf("curse.maven:extra-utilities-225561:2264384") @@ -88,14 +88,14 @@ dependencies { compileOnly("com.github.GTNewHorizons:OpenComputers:1.11.4-GTNH:dev") {transitive = false} // https://www.curseforge.com/minecraft/mc-mods/advancedsolarpanels compileOnlyApi rfg.deobf('curse.maven:advsolar-362768:2885953') - compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.4-GTNH:dev') {transitive = false} - compileOnly("com.github.GTNewHorizons:BloodMagic:1.7.0:dev") { transitive = false } + compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.5-GTNH:dev') {transitive = false} + compileOnly("com.github.GTNewHorizons:BloodMagic:1.7.3:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:CraftTweaker:3.4.0:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:BetterLoadingScreen:1.7.0-GTNH:dev") { transitive = false } compileOnly rfg.deobf("curse.maven:biomes-o-plenty-220318:2499612") compileOnly('com.github.GTNewHorizons:SC2:2.3.0:dev') {transitive=false} - compileOnly('com.github.GTNewHorizons:Binnie:2.5.2:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:Binnie:2.5.4:dev') {transitive = false} compileOnly('curse.maven:PlayerAPI-228969:2248928') {transitive=false} devOnlyNonPublishable('com.github.GTNewHorizons:BlockRenderer6343:1.3.2:dev'){transitive=false} @@ -106,7 +106,7 @@ dependencies { // runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForestryMC:4.10.1:dev") // runtimeOnlyNonPublishable('com.github.GTNewHorizons:neiaddons:1.16.0:dev') // runtimeOnlyNonPublishable('com.github.GTNewHorizons:MagicBees:2.9.0-GTNH:dev') - // runtimeOnlyNonPublishable('com.github.GTNewHorizons:Binnie:2.5.2:dev') + // runtimeOnlyNonPublishable('com.github.GTNewHorizons:Binnie:2.5.4:dev') testImplementation(platform('org.junit:junit-bom:5.9.2')) testImplementation('org.junit.jupiter:junit-jupiter') From 1195aca31fe11e5f11a7cd959221e8c9c07c93b7 Mon Sep 17 00:00:00 2001 From: Noc <95299389+Nockyx@users.noreply.github.com> Date: Sat, 18 Jan 2025 22:48:20 -0300 Subject: [PATCH 5/6] Change QFT hatch requirements (#3813) Co-authored-by: Martin Robertz Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- .../MTEQuantumForceTransformer.java | 206 +++++------------- 1 file changed, 54 insertions(+), 152 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java index 3c226c33c73..2b44ec03e2e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java @@ -63,9 +63,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase; -import gregtech.api.metatileentity.implementations.MTEHatch; import gregtech.api.metatileentity.implementations.MTEHatchBulkCatalystHousing; -import gregtech.api.metatileentity.implementations.MTEHatchInput; import gregtech.api.objects.ItemData; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; @@ -78,7 +76,6 @@ import gregtech.api.util.IGTHatchAdder; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.ParallelHelper; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.material.MaterialsElements; @@ -96,89 +93,29 @@ public class MTEQuantumForceTransformer extends MTEExtendedPowerMultiBlockBase catalystHounsings = new ArrayList<>(); private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition .builder() .addShape( MAIN_PIECE, new String[][] { // A - 142, B - 234, C - 177, D - 96, E - 224, H - 36, M - 21 - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " ", " BAB ", " BBBBABBBB ", - " BAAAAAAAB ", " BABBABBAB ", " BA AB ", " A A ", " A A ", - " A A " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", - "B B", "A A", "A A", "A A", "A A", - "A A" }, - { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", - " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", - " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", - "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", - " Z~X " }, - { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", - " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", - " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", - "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", - " HHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", - "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " AAEC CEAA ", " A EC CE A ", "AB EC CE BA", "AA D D AA", - "A EC CE A", "A D D A", " EC CE ", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", - "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", - " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", - " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", - "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", - " HHHHH " }, - { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", - " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", - " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", - "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", - " HHH " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", - "B B", "A A", "A A", "A A", "A A", - "A A" }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " ", " BAB ", " BBBBABBBB ", - " BBBAAABBB ", " ABBAAABBA ", " A BA AB A ", " A A ", " A A ", - " A A " }, }) + // spotless:off + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " BBBBABBBB ", " BAAAAAAAB ", " BABBABBAB ", " BA AB ", " A A ", " A A ", " A A " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", " B B ", " A A ", " A A ", " ", " ", " " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", " B B ", " A A ", " A A ", " ", " ", " " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", "B B", "A A", "A A", "A A", "A A", "A A" }, + { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", " H~H " }, + { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", " HHHHH " }, + { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", " HHHHHHH " }, + { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", " D D ", " AAEC CEAA ", " A EC CE A ", "AB EC CE BA", "AA D D AA", "A EC CE A", "A D D A", " EC CE ", " EC CE ", " EC CE ", " HHHHHHH " }, + { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", " HHHHHHH " }, + { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", " HHHHH " }, + { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", " HHH " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", "B B", "A A", "A A", "A A", "A A", "A A" }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", " B B ", " A A ", " A A ", " ", " ", " " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", " B B ", " A A ", " A A ", " ", " ", " " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " BBBBABBBB ", " BBBAAABBB ", " ABBAAABBA ", " A BA AB A ", " A A ", " A A ", " A A " }, }) + // spotless:on .addElement( 'A', withChannel( @@ -220,20 +157,6 @@ public class MTEQuantumForceTransformer extends MTEExtendedPowerMultiBlockBase ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .addElement( - 'Z', - buildHatchAdder(MTEQuantumForceTransformer.class).hatchClass(MTEHatchInput.class) - .adder(MTEQuantumForceTransformer::addNeptuniumHatch) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(5) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .addElement( - 'X', - buildHatchAdder(MTEQuantumForceTransformer.class).hatchClass(MTEHatchInput.class) - .adder(MTEQuantumForceTransformer::addFermiumHatch) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(5) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) .build(); public MTEQuantumForceTransformer(final int aID, final String aName, final String aNameRegional) { @@ -289,18 +212,6 @@ protected MultiblockTooltipBuilder createTooltip() { + "Bottom" + EnumChatFormatting.GRAY + " Layer") - .addStructureInfo( - EnumChatFormatting.WHITE + "Neptunium Plasma Hatch: " - + EnumChatFormatting.GREEN - + "Left" - + EnumChatFormatting.GRAY - + " side of Controller") - .addStructureInfo( - EnumChatFormatting.WHITE + "Fermium Plasma Hatch: " - + EnumChatFormatting.DARK_GREEN - + "Right" - + EnumChatFormatting.GRAY - + " side of Controller") .toolTipFinisher(GTValues.AuthorBlueWeabo, EnumChatFormatting.GREEN + "Steelux"); return tt; } @@ -487,12 +398,17 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { doFermium = false; doNeptunium = false; - if (recipe.mSpecialValue <= getFocusingTier()) { - if (drain(mFermiumHatch, new FluidStack(mFermium, 1), false)) { - doFermium = true; - } - if (drain(mNeptuniumHatch, new FluidStack(mNeptunium, 1), false)) { - doNeptunium = true; + if (recipe.getMetadataOrDefault(GTRecipeConstants.QFT_FOCUS_TIER, 1) <= getFocusingTier()) { + List fluids = getStoredFluids(); + for (FluidStack fluid : fluids) { + if (fluid.getFluid() + .equals(mNeptunium)) { + doNeptunium = true; + } + if (fluid.getFluid() + .equals(mFermium)) { + doFermium = true; + } } } @@ -605,21 +521,33 @@ public boolean onRunningTick(ItemStack aStack) { if (runningTick % 20 == 0) { int amount = (int) (getFocusingTier() * 4 * Math.sqrt(Math.min(mMaxParallel, processingLogic.getCurrentParallels()))); - if (doFermium) { - FluidStack fermiumToConsume = new FluidStack(mFermium, amount); - if (!drain(mFermiumHatch, fermiumToConsume, true)) { - doFermium = false; - stopMachine(ShutDownReasonRegistry.outOfFluid(fermiumToConsume)); - return false; - } - } - if (doNeptunium) { - FluidStack neptuniumToConsume = new FluidStack(mNeptunium, amount); - if (!drain(mNeptuniumHatch, neptuniumToConsume, true)) { - doNeptunium = false; - stopMachine(ShutDownReasonRegistry.outOfFluid(neptuniumToConsume)); - return false; + if (doNeptunium || doFermium) { + List fluids = getStoredFluids(); + for (FluidStack fluid : fluids) { + if (fluid == null) continue; + if (doNeptunium && fluid.getFluid() == mNeptunium) { + FluidStack neptuniumToConsume = new FluidStack(mNeptunium, amount); + + if (!this.depleteInput(neptuniumToConsume)) { + this.depleteInput(fluid); + doNeptunium = false; + mOutputItems = null; + mOutputFluids = null; + mProgresstime = mMaxProgresstime; + } + } + if (doFermium && fluid.getFluid() == mFermium) { + FluidStack fermiumToConsume = new FluidStack(mFermium, amount); + + if (!this.depleteInput(fermiumToConsume)) { + this.depleteInput(fluid); + doFermium = false; + mOutputItems = null; + mOutputFluids = null; + mProgresstime = mMaxProgresstime; + } + } } } @@ -731,32 +659,6 @@ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, f StatCollector.translateToLocal("miscutils.machines.QFTFluidMode") + " " + mFluidMode); } - public boolean addNeptuniumHatch(IGregTechTileEntity aTileEntity, short aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof MTEHatchInput) { - ((MTEHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((MTEHatchInput) aMetaTileEntity).mRecipeMap = null; - mNeptuniumHatch = (MTEHatchInput) aMetaTileEntity; - return true; - } - return false; - } - - public boolean addFermiumHatch(IGregTechTileEntity aTileEntity, short aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof MTEHatchInput) { - ((MTEHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((MTEHatchInput) aMetaTileEntity).mRecipeMap = null; - mFermiumHatch = (MTEHatchInput) aMetaTileEntity; - return true; - } - return false; - } - public boolean addCatalystHousingToMachineList(IGregTechTileEntity tileEntity, int baseCasingIndex) { if (tileEntity == null) return false; IMetaTileEntity metaTileEntity = tileEntity.getMetaTileEntity(); From 26a58fbb2a7f8c27d9356e6bb4cec3035283a608 Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Sun, 19 Jan 2025 12:49:42 -0500 Subject: [PATCH 6/6] Improve gt solars (#3827) --- .../generators/MTESolarGenerator.java | 171 +++++++++++++++++- .../resources/assets/gregtech/lang/en_US.lang | 5 + 2 files changed, 166 insertions(+), 10 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/generators/MTESolarGenerator.java b/src/main/java/gregtech/common/tileentities/generators/MTESolarGenerator.java index 6ed14ce8254..be28277f8ee 100644 --- a/src/main/java/gregtech/common/tileentities/generators/MTESolarGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/MTESolarGenerator.java @@ -2,22 +2,45 @@ import static gregtech.api.enums.GTValues.V; import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; +import static gregtech.api.util.GTUtility.formatNumbers; + +import java.util.List; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.gtnewhorizons.modularui.api.math.Alignment; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.api.enums.GTValues; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GTUIInfos; +import gregtech.api.gui.modularui.GTUITextures; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.MTETieredMachineBlock; import gregtech.api.render.TextureFactory; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; -public class MTESolarGenerator extends MTETieredMachineBlock { +public class MTESolarGenerator extends MTETieredMachineBlock implements IAddUIWidgets, IAddGregtechLogo { public MTESolarGenerator(int aID, String aName, String aNameRegional, int aTier) { super( @@ -25,7 +48,7 @@ public MTESolarGenerator(int aID, String aName, String aNameRegional, int aTier) aName, aNameRegional, aTier, - 0, + 4, new String[] { "Generates EU From Solar Power", "Does not generate power when raining", "Cleans itself automatically", "Does not explode in rain!" }); } @@ -85,16 +108,107 @@ public boolean isAccessAllowed(EntityPlayer aPlayer) { return true; } + // No logic for charge vs decharge because generator should not be chargeable + @Override + public int rechargerSlotCount() { + return 4; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, + float aX, float aY, float aZ) { + GTUIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); + return true; + } + + protected long clientEU; + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + addGregTechLogo(builder); + addConditionalImages(builder); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(0) + .endAtSlot(3) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot(), GTUITextures.OVERLAY_SLOT_CHARGER) + .build() + .setPos(100, 15)) + .widget( + new ProgressBar() + .setProgress( + () -> (float) getBaseMetaTileEntity().getStoredEU() / getBaseMetaTileEntity().getEUCapacity()) + .setDirection(ProgressBar.Direction.RIGHT) + .setTexture(GTUITextures.PROGRESSBAR_STORED_EU, 147) + .setPos(14, 74) + .setSize(147, 5)) + .widget( + new TextWidget() + .setStringSupplier( + () -> formatNumbers(clientEU) + "/" + + formatNumbers(getBaseMetaTileEntity().getEUCapacity()) + + " EU") + .setTextAlignment(Alignment.Center) + .setPos(14, 66) + .setSize(147, 5)) + .widget(new FakeSyncWidget.LongSyncer(() -> getBaseMetaTileEntity().getStoredEU(), val -> clientEU = val)); + } + + public void addConditionalImages(ModularWindow.Builder builder) { + builder + .widget( + new DrawableWidget() + .setDrawable( + () -> dayTime ? GTUITextures.OVERLAY_BUTTON_CHECKMARK : GTUITextures.OVERLAY_BUTTON_CROSS) + .setPos(5, 10) + .setSize(16, 16)) + .widget(new TextWidget(StatCollector.translateToLocal("GT5U.machines.solarindicator1")).setPos(21, 15)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> dayTime, val -> dayTime = val)) + .widget( + new DrawableWidget() + .setDrawable( + () -> noRain ? GTUITextures.OVERLAY_BUTTON_CHECKMARK : GTUITextures.OVERLAY_BUTTON_CROSS) + .setPos(5, 26) + .setSize(16, 16)) + .widget(new TextWidget(StatCollector.translateToLocal("GT5U.machines.solarindicator2")).setPos(21, 31)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> noRain, val -> noRain = val)) + .widget( + new DrawableWidget() + .setDrawable( + () -> seesSky ? GTUITextures.OVERLAY_BUTTON_CHECKMARK : GTUITextures.OVERLAY_BUTTON_CROSS) + .setPos(5, 42) + .setSize(16, 16)) + .widget(new TextWidget(StatCollector.translateToLocal("GT5U.machines.solarindicator3")).setPos(21, 47)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> seesSky, val -> seesSky = val)); + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) { + builder.widget( + new DrawableWidget().setDrawable(GTUITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT) + .setSize(17, 17) + .setPos(154, 5)); + } + private boolean valid = true; @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - // Check every 5 seconds for world conditions - if (aTick % 100 == 0) { - doWorldChecks(aBaseMetaTileEntity.getWorld(), aBaseMetaTileEntity); - } - if (aTick % 20 == 0 && valid) { - aBaseMetaTileEntity.increaseStoredEnergyUnits(maxEUOutput() * 20, false); + if (aBaseMetaTileEntity.isServerSide()) { + // Check every 5 seconds for world conditions + if (aTick % 100 == 0) { + doWorldChecks(aBaseMetaTileEntity.getWorld(), aBaseMetaTileEntity); + } + if (aTick % 20 == 0 && valid) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(maxEUOutput() * 20, false); + } } super.onPostTick(aBaseMetaTileEntity, aTick); } @@ -105,9 +219,46 @@ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { super.onFirstTick(aBaseMetaTileEntity); } + // Checks are independent for the sake of the ui indicators + private boolean noRain = false; + private boolean dayTime = false; + private boolean seesSky = false; + private void doWorldChecks(World world, IGregTechTileEntity aBaseMetaTileEntity) { - valid = (!(world.isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F) && world.isDaytime() - && aBaseMetaTileEntity.getSkyAtSide(ForgeDirection.UP)); + noRain = !(world.isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F); + dayTime = world.isDaytime(); + seesSky = aBaseMetaTileEntity.getSkyAtSide(ForgeDirection.UP); + + valid = noRain && dayTime && seesSky; + } + + @Override + public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, + int z) { + IGregTechTileEntity aBase = getBaseMetaTileEntity(); + tag.setBoolean("valid", valid); + tag.setLong("storedeu", aBase.getStoredEU()); + tag.setLong("maxeu", aBase.getEUCapacity()); + super.getWailaNBTData(player, tile, tag, world, x, y, z); + } + + @Override + public void getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + final NBTTagCompound tag = accessor.getNBTData(); + if (tag.hasKey("valid")) currenttip.add( + tag.getBoolean("valid") + ? EnumChatFormatting.GREEN + StatCollector.translateToLocal("GT5U.waila.generating.on") + : EnumChatFormatting.RED + StatCollector.translateToLocal("GT5U.waila.generating.off")); + if (tag.hasKey("storedeu") && tag.hasKey("maxeu")) currenttip.add( + EnumChatFormatting.GREEN + formatNumbers(tag.getLong("storedeu")) + + EnumChatFormatting.GRAY + + " / " + + EnumChatFormatting.YELLOW + + formatNumbers(tag.getLong("maxeu")) + + EnumChatFormatting.GRAY + + " EU"); + super.getWailaBody(itemStack, currenttip, accessor, config); } @Override diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index d8618059df9..24eeb2e3a8e 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -377,6 +377,9 @@ GT5U.machines.stalled_vent.tooltip.1=§7Right-click with a wrench to GT5U.machines.stalled_vent.tooltip.2=§7point this machine's steam GT5U.machines.stalled_vent.tooltip.3=§7vent towards an empty space. GT5U.machines.perfectoc.tooltip=Performs perfect overclocks +GT5U.machines.solarindicator1=Is Daytime +GT5U.machines.solarindicator2=Not Raining +GT5U.machines.solarindicator3=Can See Sky GT5U.GTPP_MULTI_ARC_FURNACE.mode.0=Electric GT5U.GTPP_MULTI_ARC_FURNACE.mode.1=Plasma GT5U.GTPP_MULTI_CUTTING_MACHINE.mode.0=Cutting @@ -841,6 +844,8 @@ GT5U.waila.drone_downlink.connectionCount=Connection Count: GT5U.waila.drone_downlink.droneLevel=Drone Level: GT5U.waila.producing=Producing: GT5U.waila.producing.andmore= And %d More... +GT5U.waila.generating.on=Generating Energy +GT5U.waila.generating.off=Not Generating achievement.flintpick=First Tools