Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steam Multi change #2959

Merged
merged 6 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,19 @@ private static void runModRecipes() {
aBronzeBricks,
GregtechItemList.Controller_SteamCentrifugeMulti.get(1));

// Steam Forge Hammer Multi
RecipeUtils.addShapedGregtechRecipe(
aBronzeBricks,
"plateWroughtIron",
aBronzeBricks,
"plateWroughtIron",
Blocks.anvil,
"plateWroughtIron",
aBronzeBricks,
ALLOY.TUMBAGA.getFrameBox(1),
aBronzeBricks,
GregtechItemList.Controller_SteamForgeHammerMulti.get(1));

// Steam Compressor Multi
RecipeUtils.addShapedGregtechRecipe(
aBronzeBricks,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam;

import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlocksTiered;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
Expand All @@ -9,11 +8,15 @@
import static gregtech.api.enums.GT_HatchElement.InputHatch;
import static gregtech.api.enums.GT_HatchElement.OutputHatch;
import static gregtech.api.enums.GT_Values.AuthorEvgenWarGold;
import static gregtech.api.enums.Mods.EnderIO;
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import javax.annotation.Nonnull;

Expand All @@ -36,8 +39,10 @@
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.ITierConverter;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
Expand Down Expand Up @@ -108,6 +113,10 @@ public String getMachineType() {

private int tierMachine = 1;

private int tierSimpleBlock = 0;

Map<Block, Integer> simpleBlockTiers = new HashMap<>();

public int getTierMachineCasing(Block block, int meta) {
if (block == sBlockCasings1 && 10 == meta) {
tCountCasing++;
Expand All @@ -132,6 +141,25 @@ public static int getTierPipeCasing(Block block, int meta) {
return 0;
}

private static List<Pair<Block, Integer>> getAllSimpleBlockTiers(Map<Block, Integer> simpleBlockTiers) {
return simpleBlockTiers.entrySet()
.stream()
.map(e -> Pair.of(e.getKey(), e.getValue()))
.collect(Collectors.toList());
}

private static ITierConverter<Integer> simpleBlockTierConverter(Map<Block, Integer> simpleBlockTiers) {
return (block, meta) -> block == null ? 0 : simpleBlockTiers.getOrDefault(block, 1);
}

private void setSimpleBlockTier(int tier) {
tierSimpleBlock = tier;
}

private int getSimpleBlockTier() {
return tierSimpleBlock;
}

protected void updateHatchTexture() {
for (GT_MetaTileEntity_Hatch h : mSteamInputs) h.updateTexture(getCasingTextureID());
for (GT_MetaTileEntity_Hatch h : mSteamOutputs) h.updateTexture(getCasingTextureID());
Expand All @@ -141,7 +169,7 @@ protected void updateHatchTexture() {
}

private int getCasingTextureID() {
if (tierGearBoxCasing == 2 || tierPipeCasing == 2 || tierMachineCasing == 2)
if (tierGearBoxCasing == 2 || tierPipeCasing == 2 || tierMachineCasing == 2 || tierSimpleBlock == 2)
return ((GT_Block_Casings2) GregTech_API.sBlockCasings2).getTextureIndex(0);
return ((GT_Block_Casings1) GregTech_API.sBlockCasings1).getTextureIndex(10);
}
Expand Down Expand Up @@ -179,6 +207,11 @@ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, fina
@Override
public IStructureDefinition<GregtechMetaTileEntity_SteamMixer> getStructureDefinition() {
if (STRUCTURE_DEFINITION == null) {
simpleBlockTiers.put(Blocks.iron_block, 1);

if (EnderIO.isModLoaded()) {
simpleBlockTiers.put(GameRegistry.findBlock(EnderIO.ID, "blockIngotStorage"), 6);
} else simpleBlockTiers.put(Blocks.iron_block, 2);

STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamMixer>builder()

Expand All @@ -199,7 +232,14 @@ public IStructureDefinition<GregtechMetaTileEntity_SteamMixer> getStructureDefin
-1,
(t, m) -> t.tierPipeCasing = m,
t -> t.tierPipeCasing))
.addElement('D', ofBlock(Blocks.iron_block, 0))
.addElement(
'D',
ofBlocksTiered(
simpleBlockTierConverter(simpleBlockTiers),
getAllSimpleBlockTiers(simpleBlockTiers),
-1,
GregtechMetaTileEntity_SteamMixer::setSimpleBlockTier,
GregtechMetaTileEntity_SteamMixer::getSimpleBlockTier))
.addElement(
'A',
ofChain(
Expand Down Expand Up @@ -253,11 +293,13 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
tierGearBoxCasing = -1;
tierPipeCasing = -1;
tierSimpleBlock = -1;
tierMachineCasing = -1;
tCountCasing = 0;
if (!checkPiece(STRUCTUR_PIECE_MAIN, HORIZONTAL_OFF_SET, VERTICAL_OFF_SET, DEPTH_OFF_SET)) return false;
if (tierGearBoxCasing < 0 && tierPipeCasing < 0 && tierMachineCasing < 0) return false;
if (tierGearBoxCasing == 1 && tierPipeCasing == 1
&& tierSimpleBlock == 1
&& tierMachineCasing == 1
&& tCountCasing > 90
&& !mSteamInputFluids.isEmpty()
Expand All @@ -270,6 +312,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
return true;
}
if (tierGearBoxCasing == 2 && tierPipeCasing == 2
&& tierSimpleBlock == 2
&& tierMachineCasing == 2
&& tCountCasing > 90
&& !mSteamInputFluids.isEmpty()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package gtPlusPlus.xmod.gregtech.registration.gregtech;

import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.ControllerSteamForgeHammer;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.ControllerSteamMixerMulti;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.Controller_SteamCentrifugeMulti;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.Controller_SteamCompressorMulti;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.Controller_SteamForgeHammer;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.Controller_SteamMaceratorMulti;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.Controller_SteamMixerMulti;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.Controller_SteamWasherMulti;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.Hatch_Input_Bus_Steam;
import static gtPlusPlus.xmod.gregtech.registration.gregtech.MetaTileEntityIDs.Hatch_Output_Bus_Steam;
Expand Down Expand Up @@ -48,12 +48,12 @@ public static void run() {
"Steam Washer").getStackForm(1));
GregtechItemList.Controller_SteamForgeHammerMulti.set(
new GregtechMetaTileEntity_SteamForgeHammer(
ControllerSteamForgeHammer.ID,
Controller_SteamForgeHammer.ID,
"gtpp.multimachine.steam.forge.hammer",
"Steam Forge Hammer").getStackForm(1));
GregtechItemList.Controller_SteamMixerMulti.set(
new GregtechMetaTileEntity_SteamMixer(
ControllerSteamMixerMulti.ID,
Controller_SteamMixerMulti.ID,
"gtpp.multimachine.steam.mixer",
"Steam Mixer").getStackForm(1));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ public enum MetaTileEntityIDs {
XL_HeatExchanger(31079),
Controller_SteamCentrifugeMulti(31080),
Controller_SteamWasherMulti(31082),
ControllerSteamForgeHammer(31083),
ControllerSteamMixerMulti(31084),
Controller_SteamForgeHammer(31083),
Controller_SteamMixerMulti(31084),
GT4_Electric_Auto_Workbench_LV(31091),
GT4_Electric_Auto_Workbench_MV(31092),
GT4_Electric_Auto_Workbench_HV(31093),
Expand Down