diff options
author | evgengoldwar <69961523+evgengoldwar@users.noreply.github.com> | 2024-06-07 07:41:03 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 05:41:03 +0200 |
commit | 581b4b8b3012f9a36220400ad56821ee060790ae (patch) | |
tree | fff9f5d72777ed1d0ae1438bbdc4054a6415d4cf /src/main/java/gtPlusPlus | |
parent | bfd41f8ff591b7101d71fc53b7c1ec42f7685416 (diff) | |
download | GT5-Unofficial-581b4b8b3012f9a36220400ad56821ee060790ae.tar.gz GT5-Unofficial-581b4b8b3012f9a36220400ad56821ee060790ae.tar.bz2 GT5-Unofficial-581b4b8b3012f9a36220400ad56821ee060790ae.zip |
Add Steam Multi (#2631)
* add Steam Centrifuge
* add Steam Washer
* Change Steam Washer
* Change Steam Multi
* Fix tooltip Washer
* Change Washer
* Change Steam Multi
* add id comment
* update deps + sa
* Added centrifuge tiers
* Added washer tiers
* Added compressor tiers
* Added macerator tiers
* Delete fixAllMaintenanceIssue();
* Delete fixAllMaintenanceIssue();
* Changed recipes
* Added meaningful names
* sa + update bs
---------
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gtPlusPlus')
8 files changed, 1091 insertions, 49 deletions
diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 107b508e04..5c5c439d47 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -831,6 +831,33 @@ public class RECIPES_Machines { "gemDiamond", aBronzeBricks, GregtechItemList.Controller_SteamMaceratorMulti.get(1)); + + // Steam Washer Multi + RecipeUtils.addShapedGregtechRecipe( + aBronzeBricks, + "plateWroughtIron", + aBronzeBricks, + "rotorTin", + ALLOY.TUMBAGA.getFrameBox(1), + "rotorTin", + aBronzeBricks, + "plateWroughtIron", + aBronzeBricks, + GregtechItemList.Controller_SteamWasherMulti.get(1)); + + // Steam Centrifuge Multi + RecipeUtils.addShapedGregtechRecipe( + aBronzeBricks, + "plateWroughtIron", + aBronzeBricks, + "gearBronze", + ALLOY.TUMBAGA.getFrameBox(1), + "gearBronze", + aBronzeBricks, + "plateWroughtIron", + aBronzeBricks, + GregtechItemList.Controller_SteamCentrifugeMulti.get(1)); + // Steam Compressor Multi RecipeUtils.addShapedGregtechRecipe( aBronzeBricks, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 6367d22f77..e1f7c415ef 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -443,6 +443,10 @@ public enum GregtechItemList implements GregtechItemContainer { // Big Steam Macerator Controller_SteamMaceratorMulti, + // Bit Steam Washer + Controller_SteamWasherMulti, + // Big Steam Centrifuge + Controller_SteamCentrifugeMulti, // Big Steam Compressor Controller_SteamCompressorMulti, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java index 6e501815f0..abebb5a38a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java @@ -27,6 +27,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; 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_Output; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.recipe.RecipeMap; @@ -129,6 +130,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu if (this.mUpdate == 1 || this.mStartUpCheck == 1) { this.mSteamInputs.clear(); this.mSteamOutputs.clear(); + this.mInputHatches.clear(); this.mSteamInputFluids.clear(); } } @@ -180,7 +182,9 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput) { log("Adding Steam Output Bus"); aDidAdd = addToMachineListInternal(mSteamOutputs, aMetaTileEntity, aBaseCasingIndex); - } + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) + aDidAdd = addToMachineListInternal(mInputHatches, aMetaTileEntity, aBaseCasingIndex); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output); return aDidAdd; } @@ -251,6 +255,9 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu rList.add(tHatch.getFillableStack()); } } + for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) if (hatch.getFillableStack() != null) { + rList.add(hatch.getFillableStack()); + } return rList; } @@ -338,6 +345,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu @Override public void clearHatches() { super.clearHatches(); + mInputHatches.clear(); mSteamInputFluids.clear(); mSteamInputs.clear(); mSteamOutputs.clear(); @@ -351,6 +359,12 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu ret = true; } } + for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) { + if (resetRecipeMapForHatch(g, aMap)) { + ret = true; + } + } + return ret; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCentrifuge.java new file mode 100644 index 0000000000..148c44e858 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCentrifuge.java @@ -0,0 +1,364 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.GregTech_API.*; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Nonnull; + +import net.minecraft.block.Block; +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 org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; + +import com.google.common.collect.ImmutableList; +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 gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.logic.ProcessingLogic; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_OverclockCalculator; +import gregtech.api.util.GT_Recipe; +import gregtech.common.blocks.GT_Block_Casings1; +import gregtech.common.blocks.GT_Block_Casings2; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + +public class GregtechMetaTileEntity_SteamCentrifuge + extends GregtechMeta_SteamMultiBase<GregtechMetaTileEntity_SteamCentrifuge> implements ISurvivalConstructable { + + public GregtechMetaTileEntity_SteamCentrifuge(String aName) { + super(aName); + } + + public GregtechMetaTileEntity_SteamCentrifuge(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_SteamCentrifuge(this.mName); + } + + @Override + public String getMachineType() { + return "Centrifuge"; + } + + private static final String STRUCTUR_PIECE_MAIN = "main"; + + private static IStructureDefinition<GregtechMetaTileEntity_SteamCentrifuge> STRUCTURE_DEFINITION = null; + private final String[][] shape = new String[][] { { " AAA ", "AAAAA", "AAAAA", "AAAAA", " AAA " }, + { " ", " ABA ", " BDB ", " ABA ", " " }, { " A ", " ACA ", "ACDCA", " ACA ", " A " }, + { " A~A ", "AABAA", "ABDBA", "AABAA", " AAA " }, { " AAA ", "AAAAA", "AAAAA", "AAAAA", " AAA " } }; + + private static final int horizontalOffSet = 2; + private static final int verticalOffSet = 3; + private static final int depthOffSet = 0; + + private int tierGearBoxCasing = -1; + private int tierPipeCasing = -1; + private int tierFireBoxCasing = -1; + private int tierMachineCasing = -1; + + private int tierMachine = 1; + + private String tMachineCasing = "Solid Bronze or Steel Machine Casing"; + + public static int getTierMachineCasing(Block block, int meta) { + if (block == sBlockCasings1 && 10 == meta) return 1; + if (block == sBlockCasings2 && 0 == meta) return 2; + return -1; + } + + private String tFireBoxCasing = "Bronze or Steel Firebox Casing"; + + public static int getTierFireBoxCasing(Block block, int meta) { + if (block == sBlockCasings3 && 13 == meta) return 1; + if (block == sBlockCasings3 && 14 == meta) return 2; + return -1; + } + + private String tGearBoxCasing = "Bronze or Steel Gear Box Casing"; + + public static int getTierGearBoxCasing(Block block, int meta) { + if (block == sBlockCasings2 && 2 == meta) return 1; + if (block == sBlockCasings2 && 3 == meta) return 2; + return -1; + } + + private String tPipeCasing = "Bronze or Steel Pipe Casing"; + + public static int getTierPipeCasing(Block block, int meta) { + if (block == sBlockCasings2 && 12 == meta) return 1; + if (block == sBlockCasings2 && 13 == meta) return 2; + return -1; + } + + protected void updateHatchTexture() { + for (GT_MetaTileEntity_Hatch h : mSteamInputs) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mSteamOutputs) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mSteamInputFluids) h.updateTexture(getCasingTextureID()); + } + + protected static String getNickname() { + return "EvgenWarGold"; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("tierMachine", tierMachine); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + tierMachine = aNBT.getInteger("tierMachine"); + } + + @Override + public String[] getInfoData() { + ArrayList<String> info = new ArrayList<>(Arrays.asList(super.getInfoData())); + info.add("Machine Tier: " + EnumChatFormatting.YELLOW + tierMachine); + info.add("Parallel: " + EnumChatFormatting.YELLOW + getMaxParallelRecipes()); + return info.toArray(new String[0]); + } + + @Override + public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + super.getWailaBody(itemStack, currenttip, accessor, config); + NBTTagCompound tag = accessor.getNBTData(); + + currenttip.add( + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + + EnumChatFormatting.YELLOW + + tag.getInteger("tierMachine") + + EnumChatFormatting.RESET); + currenttip.add( + StatCollector.translateToLocal("GT5U.multiblock.curparallelism") + ": " + + EnumChatFormatting.BLUE + + tag.getInteger("paralell") + + EnumChatFormatting.RESET); + } + + @Override + public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, + int z) { + super.getWailaNBTData(player, tile, tag, world, x, y, z); + tag.setInteger("tierMachine", tierMachine); + tag.setInteger("paralell", getMaxParallelRecipes()); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + tierGearBoxCasing = -1; + tierPipeCasing = -1; + tierFireBoxCasing = -1; + tierMachineCasing = -1; + if (!checkPiece(STRUCTUR_PIECE_MAIN, horizontalOffSet, verticalOffSet, depthOffSet)) return false; + if (tierGearBoxCasing < 0 && tierPipeCasing < 0 && tierFireBoxCasing < 0 && tierMachineCasing < 0) return false; + if (tierGearBoxCasing == 1 && tierPipeCasing == 1 && tierFireBoxCasing == 1 && tierMachineCasing == 1) { + updateHatchTexture(); + tierMachine = 1; + return true; + } + if (tierGearBoxCasing == 2 && tierPipeCasing == 2 && tierFireBoxCasing == 2 && tierMachineCasing == 2) { + updateHatchTexture(); + tierMachine = 2; + return true; + } + return false; + } + + @Override + public void onValueUpdate(byte aValue) { + tierMachineCasing = aValue; + } + + @Override + public byte getUpdateData() { + return (byte) tierMachineCasing; + } + + @Override + public IStructureDefinition<GregtechMetaTileEntity_SteamCentrifuge> getStructureDefinition() { + if (STRUCTURE_DEFINITION == null) { + + STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamCentrifuge>builder() + + .addShape(STRUCTUR_PIECE_MAIN, transpose(shape)) + .addElement( + 'B', + withChannel( + "tier", + ofBlocksTiered( + GregtechMetaTileEntity_SteamCentrifuge::getTierGearBoxCasing, + ImmutableList.of(Pair.of(sBlockCasings2, 2), Pair.of(sBlockCasings2, 3)), + -1, + (t, m) -> t.tierGearBoxCasing = m, + t -> t.tierGearBoxCasing))) + .addElement( + 'C', + withChannel( + "tier", + ofBlocksTiered( + GregtechMetaTileEntity_SteamCentrifuge::getTierPipeCasing, + ImmutableList.of(Pair.of(sBlockCasings2, 12), Pair.of(sBlockCasings2, 13)), + -1, + (t, m) -> t.tierPipeCasing = m, + t -> t.tierPipeCasing))) + .addElement( + 'D', + withChannel( + "tier", + ofBlocksTiered( + GregtechMetaTileEntity_SteamCentrifuge::getTierFireBoxCasing, + ImmutableList.of(Pair.of(sBlockCasings3, 13), Pair.of(sBlockCasings3, 14)), + -1, + (t, m) -> t.tierFireBoxCasing = m, + t -> t.tierFireBoxCasing))) + .addElement( + 'A', + withChannel( + "tier", + ofChain( + ofBlocksTiered( + GregtechMetaTileEntity_SteamCentrifuge::getTierMachineCasing, + ImmutableList.of(Pair.of(sBlockCasings1, 10), Pair.of(sBlockCasings2, 0)), + -1, + (t, m) -> t.tierMachineCasing = m, + t -> t.tierMachineCasing), + buildSteamInput(GregtechMetaTileEntity_SteamCentrifuge.class).casingIndex(10) + .dot(1) + .build(), + buildHatchAdder(GregtechMetaTileEntity_SteamCentrifuge.class) + .atLeast(SteamHatchElement.InputBus_Steam, SteamHatchElement.OutputBus_Steam) + .casingIndex(10) + .dot(1) + .buildAndChain() + + ))) + .build(); + + } + return STRUCTURE_DEFINITION; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + this.buildPiece(STRUCTUR_PIECE_MAIN, stackSize, hintsOnly, horizontalOffSet, verticalOffSet, depthOffSet); + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (this.mMachine) return -1; + return this.survivialBuildPiece( + STRUCTUR_PIECE_MAIN, + stackSize, + horizontalOffSet, + verticalOffSet, + depthOffSet, + elementBudget, + env, + false, + true); + } + + @Override + protected GT_RenderedTexture getFrontOverlay() { + return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_CENTRIFUGE); + } + + @Override + protected GT_RenderedTexture getFrontOverlayActive() { + return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_CENTRIFUGE_ACTIVE); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, + final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { + if (side == facing) { + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureID()), + aActive ? getFrontOverlayActive() : getFrontOverlay() }; + } + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureID()) }; + } + + private int getCasingTextureID() { + if (tierGearBoxCasing == 2 || tierPipeCasing == 2 || tierFireBoxCasing == 2 || tierMachineCasing == 2) + return ((GT_Block_Casings2) GregTech_API.sBlockCasings2).getTextureIndex(0); + return ((GT_Block_Casings1) GregTech_API.sBlockCasings1).getTextureIndex(10); + } + + @Override + public int getMaxParallelRecipes() { + return tierMachine == 1 ? 8 : 16; + } + + @Override + public RecipeMap<?> getRecipeMap() { + return RecipeMaps.centrifugeRecipes; + } + + @Override + protected ProcessingLogic createProcessingLogic() { + return new ProcessingLogic() { + + @Override + @Nonnull + protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { + return GT_OverclockCalculator.ofNoOverclock(recipe) + .setEUtDiscount(1.33F * tierMachine) + .setSpeedBoost(1.5F); + } + }.setMaxParallelSupplier(this::getMaxParallelRecipes); + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType(getMachineType()) + .addInfo("Controller Block for the Steam Centrifuge") + .addInfo("Runs recipes up to MV tier") + .addInfo("Centrifuges up to Tier 1 - 8 and Tier 2 - 16 things at a time") + .addInfo("Multi consumes x2 amount of steam on Tier 2") + .addSeparator() + .beginStructureBlock(5, 5, 5, false) + .addCasingInfoMin(tMachineCasing, 60, false) + .addCasingInfo(tFireBoxCasing, 3) + .addCasingInfo(tGearBoxCasing, 8) + .addCasingInfo(tPipeCasing, 4) + .addOtherStructurePart(TT_steaminputbus, "Any casing", 1) + .addOtherStructurePart(TT_steamoutputbus, "Any casing", 1) + .addOtherStructurePart(TT_steamhatch, "Any casing", 1) + .toolTipFinisher(getNickname()); + return tt; + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java index 0845c7f061..344df2e1c3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java @@ -1,42 +1,71 @@ 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.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlocksTiered; import static gregtech.api.GregTech_API.sBlockCasings1; +import static gregtech.api.GregTech_API.sBlockCasings2; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import javax.annotation.Nonnull; +import net.minecraft.block.Block; +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 org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import com.google.common.collect.ImmutableList; 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 gregtech.api.GregTech_API; import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_OverclockCalculator; import gregtech.api.util.GT_Recipe; +import gregtech.common.blocks.GT_Block_Casings1; +import gregtech.common.blocks.GT_Block_Casings2; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; public class GregtechMetaTileEntity_SteamCompressor extends GregtechMeta_SteamMultiBase<GregtechMetaTileEntity_SteamCompressor> implements ISurvivalConstructable { - private String mCasingName = "Bronze Plated Bricks"; + private String mCasingName = "Bronze or Steel Plated Bricks"; private static IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> STRUCTURE_DEFINITION = null; - private int mCasing; + + private int tierMachine = 1; + + private int tierMachineCasing = -1; + + public static int getTierMachineCasing(Block block, int meta) { + if (block == sBlockCasings1 && 10 == meta) return 1; + if (block == sBlockCasings2 && 0 == meta) return 2; + return -1; + } public GregtechMetaTileEntity_SteamCompressor(String aName) { super(aName); @@ -73,7 +102,8 @@ public class GregtechMetaTileEntity_SteamCompressor .addInfo("Controller Block for the Steam Compressor") .addInfo("33.3% faster than using a single block Steam Compressor.") .addInfo("Uses only 66.6% of the steam/s compared to a single block Steam Compressor.") - .addInfo("Compresses up to " + getMaxParallelRecipes() + " things at a time") + .addInfo("Compresses up to Tier 1 - 8 and Tier 2 - 16 things at a time") + .addInfo("Multi consumes x2 amount of steam on Tier 2") .addSeparator() .beginStructureBlock(3, 3, 4, true) .addController("Front center") @@ -96,16 +126,23 @@ public class GregtechMetaTileEntity_SteamCompressor { "CCC", "CCC", "CCC", "CCC" }, })) .addElement( 'C', - ofChain( - buildSteamInput(GregtechMetaTileEntity_SteamCompressor.class).casingIndex(10) - .dot(1) - .build(), - buildHatchAdder(GregtechMetaTileEntity_SteamCompressor.class) - .atLeast(SteamHatchElement.InputBus_Steam, SteamHatchElement.OutputBus_Steam) - .casingIndex(10) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(sBlockCasings1, 10)))) + withChannel( + "tier", + ofChain( + ofBlocksTiered( + GregtechMetaTileEntity_SteamCompressor::getTierMachineCasing, + ImmutableList.of(Pair.of(sBlockCasings1, 10), Pair.of(sBlockCasings2, 0)), + -1, + (t, m) -> t.tierMachineCasing = m, + t -> t.tierMachineCasing), + buildSteamInput(GregtechMetaTileEntity_SteamCompressor.class).casingIndex(10) + .dot(1) + .build(), + buildHatchAdder(GregtechMetaTileEntity_SteamCompressor.class) + .atLeast(SteamHatchElement.InputBus_Steam, SteamHatchElement.OutputBus_Steam) + .casingIndex(10) + .dot(1) + .buildAndChain()))) .build(); } return STRUCTURE_DEFINITION; @@ -123,14 +160,47 @@ public class GregtechMetaTileEntity_SteamCompressor @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - fixAllMaintenanceIssue(); - return checkPiece(mName, 1, 1, 0) && mCasing >= 28; + tierMachineCasing = -1; + if (!checkPiece(mName, 1, 1, 0)) return false; + if (tierMachineCasing < 0) return false; + if (tierMachineCasing == 1) { + updateHatchTexture(); + tierMachine = 1; + return true; + } + if (tierMachineCasing == 2) { + updateHatchTexture(); + tierMachine = 2; + return true; + } + + return false; + } + + @Override + public void onValueUpdate(byte aValue) { + tierMachineCasing = aValue; + } + + @Override + public byte getUpdateData() { + return (byte) tierMachineCasing; + } + + protected void updateHatchTexture() { + for (GT_MetaTileEntity_Hatch h : mSteamInputs) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mSteamOutputs) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mSteamInputFluids) h.updateTexture(getCasingTextureID()); + } + + private int getCasingTextureID() { + if (tierMachineCasing == 2) return ((GT_Block_Casings2) GregTech_API.sBlockCasings2).getTextureIndex(0); + return ((GT_Block_Casings1) GregTech_API.sBlockCasings1).getTextureIndex(10); } @Override public int getMaxParallelRecipes() { - return 8; + return tierMachine == 1 ? 8 : 16; } @Override @@ -147,10 +217,66 @@ public class GregtechMetaTileEntity_SteamCompressor @Nonnull protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { return GT_OverclockCalculator.ofNoOverclock(recipe) - .setEUtDiscount(1.33F) + .setEUtDiscount(1.33F * tierMachine) .setSpeedBoost(1.5F); } - }.setMaxParallel(getMaxParallelRecipes()); + }.setMaxParallelSupplier(this::getMaxParallelRecipes); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, + final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { + if (side == facing) { + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureID()), + aActive ? getFrontOverlayActive() : getFrontOverlay() }; + } + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureID()) }; + } + + @Override + public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + super.getWailaBody(itemStack, currenttip, accessor, config); + NBTTagCompound tag = accessor.getNBTData(); + + currenttip.add( + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + + EnumChatFormatting.YELLOW + + tag.getInteger("tierMachine") + + EnumChatFormatting.RESET); + currenttip.add( + StatCollector.translateToLocal("GT5U.multiblock.curparallelism") + ": " + + EnumChatFormatting.BLUE + + tag.getInteger("paralell") + + EnumChatFormatting.RESET); + } + + @Override + public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, + int z) { + super.getWailaNBTData(player, tile, tag, world, x, y, z); + tag.setInteger("tierMachine", tierMachine); + tag.setInteger("paralell", getMaxParallelRecipes()); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("tierMachine", tierMachine); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + tierMachine = aNBT.getInteger("tierMachine"); + } + + @Override + public String[] getInfoData() { + ArrayList<String> info = new ArrayList<>(Arrays.asList(super.getInfoData())); + info.add("Machine Tier: " + EnumChatFormatting.YELLOW + tierMachine); + info.add("Parallel: " + EnumChatFormatting.YELLOW + getMaxParallelRecipes()); + return info.toArray(new String[0]); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java index dce362fa14..f022e44501 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java @@ -1,43 +1,66 @@ 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.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlocksTiered; import static gregtech.api.GregTech_API.sBlockCasings1; +import static gregtech.api.GregTech_API.sBlockCasings2; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import javax.annotation.Nonnull; +import net.minecraft.block.Block; +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 org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import com.google.common.collect.ImmutableList; 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 gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_OverclockCalculator; import gregtech.api.util.GT_Recipe; +import gregtech.common.blocks.GT_Block_Casings1; +import gregtech.common.blocks.GT_Block_Casings2; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; public class GregtechMetaTileEntity_SteamMacerator extends GregtechMeta_SteamMultiBase<GregtechMetaTileEntity_SteamMacerator> implements ISurvivalConstructable { - private String mCasingName = "Bronze Plated Bricks"; + private String mCasingName = "Bronze or Steel Plated Bricks"; private static IStructureDefinition<GregtechMetaTileEntity_SteamMacerator> STRUCTURE_DEFINITION = null; - private int mCasing; + + private int tierMachine = 0; + + private int tierMachineCasing = -1; public GregtechMetaTileEntity_SteamMacerator(String aName) { super(aName); @@ -52,6 +75,12 @@ public class GregtechMetaTileEntity_SteamMacerator return new GregtechMetaTileEntity_SteamMacerator(this.mName); } + public static int getTierMachineCasing(Block block, int meta) { + if (block == sBlockCasings1 && 10 == meta) return 1; + if (block == sBlockCasings2 && 0 == meta) return 2; + return -1; + } + @Override protected GT_RenderedTexture getFrontOverlay() { return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR); @@ -78,7 +107,8 @@ public class GregtechMetaTileEntity_SteamMacerator .addInfo("Controller Block for the Steam Macerator") .addInfo("33.3% faster than using a single block Steam Macerator.") .addInfo("Uses only 66.6% of the steam/s required compared to a single block Steam Macerator.") - .addInfo("Macerates up to " + getMaxParallelRecipes() + " things at a time") + .addInfo("Compresses up to Tier 1 - 8 and Tier 2 - 16 things at a time") + .addInfo("Multi consumes x2 amount of steam on Tier 2") .addSeparator() .beginStructureBlock(3, 3, 3, true) .addController("Front center") @@ -100,16 +130,23 @@ public class GregtechMetaTileEntity_SteamMacerator new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) .addElement( 'C', - ofChain( - buildSteamInput(GregtechMetaTileEntity_SteamMacerator.class).casingIndex(10) - .dot(1) - .build(), - buildHatchAdder(GregtechMetaTileEntity_SteamMacerator.class) - .atLeast(SteamHatchElement.InputBus_Steam, SteamHatchElement.OutputBus_Steam) - .casingIndex(10) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(sBlockCasings1, 10)))) + withChannel( + "tier", + ofChain( + ofBlocksTiered( + GregtechMetaTileEntity_SteamMacerator::getTierMachineCasing, + ImmutableList.of(Pair.of(sBlockCasings1, 10), Pair.of(sBlockCasings2, 0)), + -1, + (t, m) -> t.tierMachineCasing = m, + t -> t.tierMachineCasing), + buildSteamInput(GregtechMetaTileEntity_SteamMacerator.class).casingIndex(10) + .dot(1) + .build(), + buildHatchAdder(GregtechMetaTileEntity_SteamMacerator.class) + .atLeast(SteamHatchElement.InputBus_Steam, SteamHatchElement.OutputBus_Steam) + .casingIndex(10) + .dot(1) + .buildAndChain()))) .build(); } return STRUCTURE_DEFINITION; @@ -127,14 +164,47 @@ public class GregtechMetaTileEntity_SteamMacerator @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - fixAllMaintenanceIssue(); - return checkPiece(mName, 1, 1, 0) && mCasing >= 14; + tierMachineCasing = -1; + if (!checkPiece(mName, 1, 1, 0)) return false; + if (tierMachineCasing < 0) return false; + if (tierMachineCasing == 1) { + updateHatchTexture(); + tierMachine = 1; + return true; + } + if (tierMachineCasing == 2) { + updateHatchTexture(); + tierMachine = 2; + return true; + } + + return false; + } + + @Override + public void onValueUpdate(byte aValue) { + tierMachineCasing = aValue; + } + + @Override + public byte getUpdateData() { + return (byte) tierMachineCasing; + } + + protected void updateHatchTexture() { + for (GT_MetaTileEntity_Hatch h : mSteamInputs) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mSteamOutputs) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mSteamInputFluids) h.updateTexture(getCasingTextureID()); + } + + private int getCasingTextureID() { + if (tierMachineCasing == 2) return ((GT_Block_Casings2) GregTech_API.sBlockCasings2).getTextureIndex(0); + return ((GT_Block_Casings1) GregTech_API.sBlockCasings1).getTextureIndex(10); } @Override public int getMaxParallelRecipes() { - return 8; + return tierMachine == 1 ? 8 : 16; } @Override @@ -143,6 +213,12 @@ public class GregtechMetaTileEntity_SteamMacerator } // note that a basic steam machine has .setEUtDiscount(2F).setSpeedBoost(2F). So these are bonuses. + + @Override + public int getItemOutputLimit() { + return 1; + } + @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { @@ -151,15 +227,65 @@ public class GregtechMetaTileEntity_SteamMacerator @Nonnull protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { return GT_OverclockCalculator.ofNoOverclock(recipe) - .setEUtDiscount(1.33F) + .setEUtDiscount(1.33F * tierMachine) .setSpeedBoost(1.5F); } + }.setMaxParallelSupplier(this::getMaxParallelRecipes); + } - }.setMaxParallel(getMaxParallelRecipes()); + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, + final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { + if (side == facing) { + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureID()), + aActive ? getFrontOverlayActive() : getFrontOverlay() }; + } + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureID()) }; } @Override - public int getItemOutputLimit() { - return 1; + public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + super.getWailaBody(itemStack, currenttip, accessor, config); + NBTTagCompound tag = accessor.getNBTData(); + + currenttip.add( + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + + EnumChatFormatting.YELLOW + + tag.getInteger("tierMachine") + + EnumChatFormatting.RESET); + currenttip.add( + StatCollector.translateToLocal("GT5U.multiblock.curparallelism") + ": " + + EnumChatFormatting.BLUE + + tag.getInteger("paralell") + + EnumChatFormatting.RESET); + } + + @Override + public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, + int z) { + super.getWailaNBTData(player, tile, tag, world, x, y, z); + tag.setInteger("tierMachine", tierMachine); + tag.setInteger("paralell", getMaxParallelRecipes()); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("tierMachine", tierMachine); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + tierMachine = aNBT.getInteger("tierMachine"); + } + + @Override + public String[] getInfoData() { + ArrayList<String> info = new ArrayList<>(Arrays.asList(super.getInfoData())); + info.add("Machine Tier: " + EnumChatFormatting.YELLOW + tierMachine); + info.add("Parallel: " + EnumChatFormatting.YELLOW + getMaxParallelRecipes()); + return info.toArray(new String[0]); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamWasher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamWasher.java new file mode 100644 index 0000000000..c8f61240d7 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamWasher.java @@ -0,0 +1,371 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.GregTech_API.*; +import static gregtech.api.enums.GT_HatchElement.InputHatch; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Nonnull; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +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 org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; + +import com.google.common.collect.ImmutableList; +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; +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 gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.logic.ProcessingLogic; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.multitileentity.multiblock.casing.Glasses; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_OverclockCalculator; +import gregtech.api.util.GT_Recipe; +import gregtech.common.blocks.GT_Block_Casings1; +import gregtech.common.blocks.GT_Block_Casings2; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase; +import ic2.core.init.BlocksItems; +import ic2.core.init.InternalName; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + +public class GregtechMetaTileEntity_SteamWasher extends GregtechMeta_SteamMultiBase<GregtechMetaTileEntity_SteamWasher> + implements ISurvivalConstructable { + + public GregtechMetaTileEntity_SteamWasher(String aName) { + super(aName); + } + + public GregtechMetaTileEntity_SteamWasher(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_SteamWasher(this.mName); + } + + @Override + public String getMachineType() { + return "Washer"; + } + + private static final String STRUCTUR_PIECE_MAIN = "main"; + + private static IStructureDefinition<GregtechMetaTileEntity_SteamWasher> STRUCTURE_DEFINITION = null; + + private final String[][] shape = new String[][] { + { " ", " ", " CCCCCC ", " ", " " }, + { " ", " ", " C C ", " ", " " }, + { " AAA ", " A A", " C A C A", " A A", " AAA " }, + { " ADDDA", "AAA D D", "AAA D C D", "AAA D D", " ADDDA" }, + { " ADDDA", "A~A DEEED", "AAA DECED", "AAA DEEED", " ADDDA" }, + { " AAAAA", "AAA ABBBA", "AAA ABABA", "AAA ABBBA", " AAAAA" } }; + + private static final int horizontalOffSet = 1; + private static final int verticalOffSet = 4; + private static final int depthOffSet = 1; + + private int tierGearBoxCasing = -1; + private int tierPipeCasing = -1; + private int tierMachineCasing = -1; + private int tierMachine = 1; + + private String tGlasses = "Any Glass"; + + private String tMachineCasing = "Solid Bronze or Steel Machine Casing"; + + public static int getTierMachineCasing(Block block, int meta) { + if (block == sBlockCasings1 && 10 == meta) return 1; + if (block == sBlockCasings2 && 0 == meta) return 2; + return -1; + } + + private String tGearBoxCasing = "Bronze or Steel Gear Box Casing"; + + public static int getTierGearBoxCasing(Block block, int meta) { + if (block == sBlockCasings2 && 2 == meta) return 1; + if (block == sBlockCasings2 && 3 == meta) return 2; + return -1; + } + + private String tPipeCasing = "Bronze or Steel Pipe Casing"; + + public static int getTierPipeCasing(Block block, int meta) { + if (block == sBlockCasings2 && 12 == meta) return 1; + if (block == sBlockCasings2 && 13 == meta) return 2; + return -1; + } + + protected void updateHatchTexture() { + for (GT_MetaTileEntity_Hatch h : mSteamInputs) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mSteamOutputs) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mSteamInputFluids) h.updateTexture(getCasingTextureID()); + for (GT_MetaTileEntity_Hatch h : mInputHatches) h.updateTexture(getCasingTextureID()); + } + + protected static String getNickname() { + return "EvgenWarGold"; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("tierMachine", tierMachine); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + tierMachine = aNBT.getInteger("tierMachine"); + } + + @Override + public String[] getInfoData() { + ArrayList<String> info = new ArrayList<>(Arrays.asList(super.getInfoData())); + info.add("Machine Tier: " + EnumChatFormatting.YELLOW + tierMachine); + info.add("Parallel: " + EnumChatFormatting.YELLOW + getMaxParallelRecipes()); + return info.toArray(new String[0]); + } + + @Override + public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + super.getWailaBody(itemStack, currenttip, accessor, config); + NBTTagCompound tag = accessor.getNBTData(); + + currenttip.add( + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + + EnumChatFormatting.YELLOW + + tag.getInteger("tierMachine") + + EnumChatFormatting.RESET); + currenttip.add( + StatCollector.translateToLocal("GT5U.multiblock.curparallelism") + ": " + + EnumChatFormatting.BLUE + + tag.getInteger("paralell") + + EnumChatFormatting.RESET); + } + + @Override + public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, + int z) { + super.getWailaNBTData(player, tile, tag, world, x, y, z); + tag.setInteger("tierMachine", tierMachine); + tag.setInteger("paralell", getMaxParallelRecipes()); + } + + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + tierGearBoxCasing = -1; + tierPipeCasing = -1; + tierMachineCasing = -1; + if (!checkPiece(STRUCTUR_PIECE_MAIN, horizontalOffSet, verticalOffSet, depthOffSet)) return false; + if (tierGearBoxCasing < 0 && tierPipeCasing < 0 && tierMachineCasing < 0) return false; + if (tierGearBoxCasing == 1 && tierPipeCasing == 1 && tierMachineCasing == 1) { + updateHatchTexture(); + tierMachine = 1; + return true; + } + if (tierGearBoxCasing == 2 && tierPipeCasing == 2 && tierMachineCasing == 2) { + updateHatchTexture(); + tierMachine = 2; + return true; + } + return false; + } + + @Override + public void onValueUpdate(byte aValue) { + tierMachineCasing = aValue; + } + + @Override + public byte getUpdateData() { + return (byte) tierMachineCasing; + } + + @Override + public IStructureDefinition<GregtechMetaTileEntity_SteamWasher> getStructureDefinition() { + if (STRUCTURE_DEFINITION == null) { + + STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamWasher>builder() + + .addShape(STRUCTUR_PIECE_MAIN, transpose(shape)) + .addElement( + 'B', + withChannel( + "tier", + ofBlocksTiered( + GregtechMetaTileEntity_SteamWasher::getTierGearBoxCasing, + ImmutableList.of(Pair.of(sBlockCasings2, 2), Pair.of(sBlockCasings2, 3)), + -1, + (t, m) -> t.tierGearBoxCasing = m, + t -> t.tierGearBoxCasing))) + .addElement( + 'C', + withChannel( + "tier", + ofBlocksTiered( + GregtechMetaTileEntity_SteamWasher::getTierPipeCasing, + ImmutableList.of(Pair.of(sBlockCasings2, 12), Pair.of(sBlockCasings2, 13)), + -1, + (t, m) -> t.tierPipeCasing = m, + t -> t.tierPipeCasing))) + .addElement('D', ofChain(ofBlock(Blocks.glass, 0), Glasses.chainAllGlasses())) + .addElement( + 'E', + ofChain( + isAir(), + ofBlockAnyMeta(Blocks.water), + ofBlockAnyMeta(Blocks.flowing_water), + ofBlockAnyMeta(BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)))) + .addElement( + 'A', + withChannel( + "tier", + ofChain( + ofBlocksTiered( + GregtechMetaTileEntity_SteamWasher::getTierMachineCasing, + ImmutableList.of(Pair.of(sBlockCasings1, 10), Pair.of(sBlockCasings2, 0)), + -1, + (t, m) -> t.tierMachineCasing = m, + t -> t.tierMachineCasing), + buildSteamInput(GregtechMetaTileEntity_SteamWasher.class).casingIndex(10) + .dot(1) + .build(), + buildHatchAdder(GregtechMetaTileEntity_SteamWasher.class) + .atLeast( + SteamHatchElement.InputBus_Steam, + SteamHatchElement.OutputBus_Steam, + InputHatch) + .casingIndex(10) + .dot(1) + .buildAndChain()))) + .build(); + + } + return STRUCTURE_DEFINITION; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + this.buildPiece(STRUCTUR_PIECE_MAIN, stackSize, hintsOnly, horizontalOffSet, verticalOffSet, depthOffSet); + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (this.mMachine) return -1; + return this.survivialBuildPiece( + STRUCTUR_PIECE_MAIN, + stackSize, + horizontalOffSet, + verticalOffSet, + depthOffSet, + elementBudget, + env, + false, + true); + } + + @Override + protected GT_RenderedTexture getFrontOverlay() { + return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_WASHER); + } + + @Override + protected GT_RenderedTexture getFrontOverlayActive() { + return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_WASHER_ACTIVE); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, + final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { + if (side == facing) { + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureID()), + aActive ? getFrontOverlayActive() : getFrontOverlay() }; + } + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureID()) }; + } + + private int getCasingTextureID() { + if (tierGearBoxCasing == 2 || tierPipeCasing == 2 || tierMachineCasing == 2) + return ((GT_Block_Casings2) GregTech_API.sBlockCasings2).getTextureIndex(0); + return ((GT_Block_Casings1) GregTech_API.sBlockCasings1).getTextureIndex(10); + } + + @Override + public int getMaxParallelRecipes() { + return tierMachine == 1 ? 8 : 16; + } + + @Override + public RecipeMap<?> getRecipeMap() { + return RecipeMaps.oreWasherRecipes; + } + + @Override + protected ProcessingLogic createProcessingLogic() { + return new ProcessingLogic() { + + @Override + @Nonnull + protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { + return GT_OverclockCalculator.ofNoOverclock(recipe) + .setEUtDiscount(1.33F * tierMachine) + .setSpeedBoost(1.5F); + } + }.setMaxParallelSupplier(this::getMaxParallelRecipes); + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType(getMachineType()) + .addInfo("Controller Block for the Steam Washer") + .addInfo("Runs recipes up to LV tier") + .addInfo("Washing up to Tier 1 - 8 and Tier 2 - 16 things at a time") + .addInfo("Multi consumes x2 amount of steam on Tier 2") + .addSeparator() + .beginStructureBlock(5, 5, 9, false) + .addCasingInfoMin(tMachineCasing, 55, false) + .addCasingInfo(tPipeCasing, 12) + .addCasingInfo(tGearBoxCasing, 8) + .addCasingInfo(tGlasses, 24) + .addOtherStructurePart(TT_steaminputbus, "Any casing", 1) + .addOtherStructurePart(TT_steamoutputbus, "Any casing", 1) + .addOtherStructurePart(TT_steamhatch, "Any casing", 1) + .addInputHatch("Any casing", 1) + .toolTipFinisher(getNickname()); + return tt; + } + + @Override + protected IAlignmentLimits getInitialAlignmentLimits() { + // don't rotate a washer, water will flow out. + return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped(); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamMultis.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamMultis.java index 9c3a73092b..a83666da11 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamMultis.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamMultis.java @@ -4,13 +4,17 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusOutput; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam.GregtechMetaTileEntity_SteamCentrifuge; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam.GregtechMetaTileEntity_SteamCompressor; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam.GregtechMetaTileEntity_SteamMacerator; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam.GregtechMetaTileEntity_SteamWasher; public class GregtechSteamMultis { public static void run() { + // id 31079 and 31081 are occupied by another machine + Logger.INFO("Gregtech5u Content | Registering Steam Multiblocks."); GregtechItemList.Controller_SteamMaceratorMulti.set( @@ -19,6 +23,12 @@ public class GregtechSteamMultis { GregtechItemList.Controller_SteamCompressorMulti.set( new GregtechMetaTileEntity_SteamCompressor(31078, "gtpp.multimachine.steam.compressor", "Steam Squasher") .getStackForm(1L)); + GregtechItemList.Controller_SteamCentrifugeMulti.set( + new GregtechMetaTileEntity_SteamCentrifuge(31080, "gtpp.multimachine.steam.centrifuge", "Steam Centrifuge") + .getStackForm(1)); + GregtechItemList.Controller_SteamWasherMulti.set( + new GregtechMetaTileEntity_SteamWasher(31082, "gtpp.multimachine.steam.washer", "Steam Washer") + .getStackForm(1)); GregtechItemList.Hatch_Input_Bus_Steam.set( new GT_MetaTileEntity_Hatch_Steam_BusInput(31046, "hatch.input_bus.tier.steam", "Input Bus (Steam)", 0) |