aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java
diff options
context:
space:
mode:
authorNotAPenguin <michiel.vandeginste@gmail.com>2024-09-02 23:17:17 +0200
committerGitHub <noreply@github.com>2024-09-02 23:17:17 +0200
commit1b820de08a05070909a267e17f033fcf58ac8710 (patch)
tree02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java
parentafd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff)
downloadGT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.gz
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.bz2
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.zip
The Great Renaming (#3014)
* move kekztech to a single root dir * move detrav to a single root dir * move gtnh-lanthanides to a single root dir * move tectech and delete some gross reflection in gt++ * remove more reflection inside gt5u * delete more reflection in gt++ * fix imports * move bartworks and bwcrossmod * fix proxies * move galactigreg and ggfab * move gtneioreplugin * try to fix gt++ bee loader * apply the rename rules to BW * apply rename rules to bwcrossmod * apply rename rules to detrav scanner mod * apply rename rules to galacticgreg * apply rename rules to ggfab * apply rename rules to goodgenerator * apply rename rules to gtnh-lanthanides * apply rename rules to gt++ * apply rename rules to kekztech * apply rename rules to kubatech * apply rename rules to tectech * apply rename rules to gt apply the rename rules to gt * fix tt import * fix mui hopefully * fix coremod except intergalactic * rename assline recipe class * fix a class name i stumbled on * rename StructureUtility to GTStructureUtility to prevent conflict with structurelib * temporary rename of GTTooltipDataCache to old name * fix gt client/server proxy names
Diffstat (limited to 'src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java')
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java212
1 files changed, 212 insertions, 0 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java b/src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java
new file mode 100644
index 0000000000..be0fe5b4ce
--- /dev/null
+++ b/src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java
@@ -0,0 +1,212 @@
+package goodgenerator.blocks.tileEntity;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO;
+import static gregtech.api.enums.Textures.BlockIcons.*;
+import static gregtech.api.util.GTStructureUtility.*;
+import static gregtech.api.util.GTUtility.filterValidMTEs;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+import org.jetbrains.annotations.NotNull;
+
+import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
+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 goodgenerator.blocks.tileEntity.base.MTETooltipMultiBlockBaseEM;
+import goodgenerator.util.DescTextLocalization;
+import gregtech.api.GregTechAPI;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.MTEHatchInput;
+import gregtech.api.metatileentity.implementations.MTEHatchMultiInput;
+import gregtech.api.recipe.check.CheckRecipeResult;
+import gregtech.api.recipe.check.CheckRecipeResultRegistry;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.GTModHandler;
+import gregtech.api.util.GTUtility;
+import gregtech.api.util.MultiblockTooltipBuilder;
+import tectech.thing.metaTileEntity.multi.base.TTMultiblockBase;
+
+public class MTECoolantTower extends MTETooltipMultiBlockBaseEM implements IConstructable, ISurvivalConstructable {
+
+ protected IStructureDefinition<MTECoolantTower> multiDefinition = null;
+ private static final int CASING_INDEX = 1539;
+
+ public MTECoolantTower(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public MTECoolantTower(String name) {
+ super(name);
+ }
+
+ @Override
+ public IStructureDefinition<? extends TTMultiblockBase> getStructure_EM() {
+ if (multiDefinition == null) {
+ multiDefinition = StructureDefinition.<MTECoolantTower>builder()
+ .addShape(
+ mName,
+ transpose(
+ new String[][] {
+ { " ", " ", " BBB ", " B B ", " B B ", " B B ",
+ " B B ", " B B ", " BBB ", " ", " " },
+ { " ", " ", " BBB ", " BBBBB ", " BB BB ", " BB BB ",
+ " BB BB ", " BBBBB ", " BBB ", " ", " " },
+ { " ", " ", " ", " BBB ", " B B ", " B B ",
+ " B B ", " BBB ", " ", " ", " " },
+ { " ", " ", " ", " BBB ", " B B ", " B B ",
+ " B B ", " BBB ", " ", " ", " " },
+ { " ", " ", " ", " BBB ", " B B ", " B B ",
+ " B B ", " BBB ", " ", " ", " " },
+ { " ", " ", " BBB ", " BBBBB ", " BB BB ", " BB BB ",
+ " BB BB ", " BBBBB ", " BBB ", " ", " " },
+ { " ", " ", " BBB ", " B B ", " B B ", " B B ",
+ " B B ", " B B ", " BBB ", " ", " " },
+ { " ", " ", " BBB ", " B B ", " B B ", " B B ",
+ " B B ", " B B ", " BBB ", " ", " " },
+ { " ", " BBB ", " BBBBB ", " BB BB ", " BB BB ", " BB BB ",
+ " BB BB ", " BB BB ", " BBBBB ", " BBB ", " " },
+ { " ", " BBB ", " B B ", " B B ", " B B ", " B B ",
+ " B B ", " B B ", " B B ", " BBB ", " " },
+ { " ", " BBBBB ", " BB BB ", " BB BB ", " B B ", " B B ",
+ " B B ", " BB BB ", " BB BB ", " BBBBB ", " " },
+ { " HH~HH ", " HBBBBBH ", " HB BH ", "HB BH", "HB BH", "HB BH",
+ "HB BH", "HB BH", " HB BH ", " HBBBBBH ", " HHHHH " },
+ { " CCCCC ", " C C ", " C C ", "C C", "C C", "C C",
+ "C C", "C C", " C C ", " C C ", " CCCCC " }, }))
+ .addElement('B', ofBlockAnyMeta(GregTechAPI.sBlockConcretes, 8))
+ .addElement('C', ofFrame(Materials.TungstenCarbide))
+ .addElement(
+ 'H',
+ buildHatchAdder(MTECoolantTower.class)
+ .atLeast(
+ gregtech.api.enums.HatchElement.InputHatch,
+ gregtech.api.enums.HatchElement.OutputHatch)
+ .casingIndex(CASING_INDEX)
+ .dot(1)
+ .buildAndChain(ofBlockAnyMeta(GregTechAPI.sBlockConcretes, 8)))
+ .build();
+ }
+ return multiDefinition;
+ }
+
+ @Override
+ public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ return structureCheck_EM(mName, 5, 11, 0);
+ }
+
+ @Override
+ protected MultiblockTooltipBuilder createTooltip() {
+ final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder();
+ tt.addMachineType("Coolant Tower")
+ .addInfo("Controller block for the Coolant Tower.")
+ .addInfo("Turn Steam back to Distilled Water.")
+ .addInfo(BLUE_PRINT_INFO)
+ .addSeparator()
+ .addController("Mid of the second layer.")
+ .addInputHatch("Input Hatch", 1)
+ .addOutputHatch("Output Hatch", 1)
+ .toolTipFinisher("Good Generator");
+ return tt;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ structureBuild_EM(mName, 5, 11, 0, stackSize, hintsOnly);
+ }
+
+ @Override
+ public String[] getStructureDescription(ItemStack stackSize) {
+ return DescTextLocalization.addText("CoolantTower.hint", 3);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new MTECoolantTower(mName);
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ protected @NotNull CheckRecipeResult checkProcessing_EM() {
+ this.mMaxProgresstime = 20;
+ int steam = 0;
+
+ for (MTEHatchInput tHatch : filterValidMTEs(mInputHatches)) {
+ steam += maybeDrainHatch(tHatch);
+ }
+ addOutput(GTModHandler.getDistilledWater(steam / 160));
+ return CheckRecipeResultRegistry.SUCCESSFUL;
+ }
+
+ private int maybeDrainHatch(MTEHatchInput tHatch) {
+ if (tHatch instanceof MTEHatchMultiInput) {
+ int drained = 0;
+ for (FluidStack maybeSteam : ((MTEHatchMultiInput) tHatch).getStoredFluid()) {
+ drained += maybeDrainSteam(tHatch, maybeSteam);
+ }
+ return drained;
+ }
+ return maybeDrainSteam(tHatch, tHatch.getFillableStack());
+ }
+
+ private int maybeDrainSteam(MTEHatchInput tHatch, FluidStack maybeSteam) {
+ if (maybeSteam == null) return 0;
+ if (!GTUtility.areFluidsEqual(maybeSteam, GTModHandler.getSteam(1))) return 0;
+ FluidStack defoSteam = tHatch.drain(ForgeDirection.UNKNOWN, maybeSteam, true);
+ return defoSteam.amount;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
+ int colorIndex, boolean aActive, boolean aRedstone) {
+ if (side == facing) {
+ if (aActive) return new ITexture[] { casingTexturePages[12][3], TextureFactory.builder()
+ .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE)
+ .extFacing()
+ .build(),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW)
+ .extFacing()
+ .glow()
+ .build() };
+ return new ITexture[] { casingTexturePages[12][3], TextureFactory.builder()
+ .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER)
+ .extFacing()
+ .build(),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW)
+ .extFacing()
+ .glow()
+ .build() };
+ }
+ return new ITexture[] { casingTexturePages[12][3] };
+ }
+
+ @Override
+ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
+ if (mMachine) return -1;
+ return survivialBuildPiece(mName, stackSize, 5, 11, 0, elementBudget, env, false, true);
+ }
+
+ @Override
+ public boolean getDefaultHasMaintenanceChecks() {
+ return false;
+ }
+}