Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
structure cleanup (#220)
Browse files Browse the repository at this point in the history
* structure cleanup

* spotlessApply

---------

Co-authored-by: GitHub GTNH Actions <unknown>
  • Loading branch information
Glease authored Dec 3, 2023
1 parent d74691e commit 89af477
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 306 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public class ComponentAssemblyLine extends GT_MetaTileEntity_ExtendedPowerMultiB
(block, meta) -> block == Loaders.componentAssemblylineCasing ? meta : -1,
IntStream.range(0, 14).mapToObj(i -> Pair.of(Loaders.componentAssemblylineCasing, i))
.collect(Collectors.toList()),
-1,
-2,
(t, meta) -> t.casingTier = meta,
t -> t.casingTier))
.addElement(
Expand Down Expand Up @@ -284,13 +284,14 @@ protected void setProcessingLogicPower(ProcessingLogic logic) {

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
if (mMachine) return -1;
int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 5);
return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 4, 2, 0, realBudget, env, false, true);
}

@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
casingTier = -1;
casingTier = -2;
return checkPiece(STRUCTURE_PIECE_MAIN, 4, 2, 0);
}

Expand Down
37 changes: 7 additions & 30 deletions src/main/java/goodgenerator/blocks/tileEntity/CoolantTower.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static gregtech.api.util.GT_StructureUtility.*;
import static gregtech.api.util.GT_Utility.filterValidMTEs;

import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand All @@ -16,8 +15,8 @@
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;

import goodgenerator.blocks.tileEntity.base.GT_MetaTileEntity_TooltipMultiBlockBase_EM;
Expand All @@ -28,10 +27,8 @@
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_MultiInput;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
Expand Down Expand Up @@ -104,35 +101,15 @@ public IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> getSt
.addElement('C', ofFrame(Materials.TungstenCarbide))
.addElement(
'H',
ofChain(
buildHatchAdder(CoolantTower.class)
.atLeast(GT_HatchElement.InputHatch, GT_HatchElement.OutputHatch)
.casingIndex(CASING_INDEX).dot(1)
.buildAndChain(ofBlockAnyMeta(GregTech_API.sBlockConcretes, 8))))
buildHatchAdder(CoolantTower.class)
.atLeast(GT_HatchElement.InputHatch, GT_HatchElement.OutputHatch)
.casingIndex(CASING_INDEX).dot(1)
.buildAndChain(ofBlockAnyMeta(GregTech_API.sBlockConcretes, 8)))
.build();
}
return multiDefinition;
}

public final boolean addIOFluidToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
} else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) {
return false;
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
} else {
return false;
}
}
}

@Override
public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
mWrench = true;
Expand Down Expand Up @@ -238,8 +215,8 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) {
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
if (mMachine) return -1;
return survivialBuildPiece(mName, stackSize, 5, 11, 0, elementBudget, source, actor, false, true);
return survivialBuildPiece(mName, stackSize, 5, 11, 0, elementBudget, env, false, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.enums.Textures.BlockIcons.*;
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
Expand All @@ -25,8 +23,8 @@

import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;

import goodgenerator.blocks.tileEntity.base.GT_MetaTileEntity_TooltipMultiBlockBase_EM;
Expand Down Expand Up @@ -102,24 +100,15 @@ public IStructureDefinition<ExtremeHeatExchanger> getStructure_EM() {
ofChain(
buildHatchAdder(ExtremeHeatExchanger.class)
.atLeast(GT_HatchElement.OutputHatch, GT_HatchElement.Maintenance)
.casingIndex(48).dot(1).build(),
.casingIndex(48).dot(2).build(),
onElementPass(x -> x.casingAmount++, ofBlock(GregTech_API.sBlockCasings4, 0))))
.addElement(
'F',
buildHatchAdder(ExtremeHeatExchanger.class).atLeast(EHEHatches.HotInputHatch)
.casingIndex(48).dot(3).build())
.addElement(
'E',
buildHatchAdder(ExtremeHeatExchanger.class).atLeast(EHEHatches.ColdOutputHatch)
.casingIndex(48).dot(4).build())
.addElement('F', EHEHatches.HotInputHatch.newAny(48, 3))
.addElement('E', EHEHatches.ColdOutputHatch.newAny(48, 4))
.addElement(
'C',
ofChain(
ofHatchAdder(
ExtremeHeatExchanger::addMaintenanceToMachineList,
48,
GregTech_API.sBlockCasings4,
0),
buildHatchAdder(ExtremeHeatExchanger.class).atLeast(GT_HatchElement.Maintenance)
.casingIndex(48).dot(5).build(),
onElementPass(x -> x.casingAmount++, ofBlock(GregTech_API.sBlockCasings4, 0))))
.addElement('G', Glasses.chainAllGlasses())
.addElement('P', ofBlock(GregTech_API.sBlockCasings2, 15))
Expand Down Expand Up @@ -173,10 +162,15 @@ public void saveNBTData(NBTTagCompound aNBT) {
}

@Override
public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
this.casingAmount = 0;
protected void clearHatches_EM() {
super.clearHatches_EM();
mCooledFluidHatch = null;
mHotFluidHatch = null;
}

@Override
public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
this.casingAmount = 0;
return structureCheck_EM(mName, 2, 5, 0) && mMaintenanceHatches.size() == 1 && casingAmount >= 25;
}

Expand All @@ -187,13 +181,11 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
.addInfo("Controller block for the Extreme Heat Exchanger.")
.addInfo("Accept Hot fluid like lava, hot coolant or plasma.")
.addInfo("Output SC Steam/SH Steam/Steam.").addInfo("Check NEI for more info.").addInfo(BLUE_PRINT_INFO)
.addSeparator().addController("Front bottom")
.addOtherStructurePart("Input Hatch: distilled water", "Hint block with dot 1")
.addOtherStructurePart("Output Hatch: SC Steam/SH Steam/Steam", "Hint block with dot 2")
.addOtherStructurePart("Input Hatch: Hot fluid or plasma", "Hint block with dot 3")
.addOtherStructurePart("Output Hatch: Cold fluid", "Hint block with dot 4")
.addMaintenanceHatch("Any Casing").addCasingInfo("Robust Tungstensteel Machine Casings", 25)
.toolTipFinisher("Good Generator");
.addSeparator().addController("Front bottom").addOtherStructurePart("Input Hatch", "distilled water", 1)
.addOtherStructurePart("Output Hatch", "SC Steam/SH Steam/Steam", 2)
.addOtherStructurePart("Input Hatch", "Hot fluid or plasma", 3)
.addOtherStructurePart("Output Hatch", "Cold fluid", 4).addMaintenanceHatch("Any Casing", 1, 2, 5)
.addCasingInfoMin("Robust Tungstensteel Machine Casings", 25, false).toolTipFinisher("Good Generator");
return tt;
}

Expand Down Expand Up @@ -337,9 +329,9 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) {
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
if (mMachine) return -1;
return survivialBuildPiece(mName, stackSize, 2, 5, 0, elementBudget, source, actor, false, true);
return survivialBuildPiece(mName, stackSize, 2, 5, 0, elementBudget, env, false, true);
}

private enum EHEHatches implements IHatchElement<ExtremeHeatExchanger> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
Expand All @@ -18,9 +17,9 @@
import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;

import goodgenerator.blocks.tileEntity.base.GT_MetaTileEntity_TooltipMultiBlockBase_EM;
Expand Down Expand Up @@ -163,9 +162,9 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
.addInfo("Use higher tier coils to unlock more fuel types and reduce the processing times.")
.addInfo("The structure is too complex!").addInfo(BLUE_PRINT_INFO).addSeparator()
.beginStructureBlock(3, 15, 15, false).addInputHatch("The casings adjoin the field restriction glass.")
.addInputBus("The casings adjoin the field restriction glass.")
.addOutputHatch("The casings adjoin the field restriction glass.")
.addEnergyHatch("The casings adjoin the field restriction glass.").toolTipFinisher("Good Generator");
.addInputBus("The casings adjoin the field restriction glass.", 1)
.addOutputHatch("The casings adjoin the field restriction glass.", 1)
.addEnergyHatch("The casings adjoin the field restriction glass.", 1).toolTipFinisher("Good Generator");
return tt;
}

Expand Down Expand Up @@ -332,8 +331,8 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) {
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
if (mMachine) return -1;
return survivialBuildPiece(mName, stackSize, 7, 12, 1, elementBudget, source, actor, false, true);
return survivialBuildPiece(mName, stackSize, 7, 12, 1, elementBudget, env, false, true);
}
}
Loading

0 comments on commit 89af477

Please sign in to comment.