aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/multi
diff options
context:
space:
mode:
authorVolence <32358820+Volence@users.noreply.github.com>2024-08-26 09:27:41 -0400
committerGitHub <noreply@github.com>2024-08-26 13:27:41 +0000
commit81fb479136b70ae3dbbcfd0410504dee800afbb5 (patch)
tree9adc1b180f735f9f3f4850f73466b8bdb176fbd4 /src/main/java/gregtech/common/tileentities/machines/multi
parentfa0e628505ff04335c45677595e2335c0c855471 (diff)
downloadGT5-Unofficial-81fb479136b70ae3dbbcfd0410504dee800afbb5.tar.gz
GT5-Unofficial-81fb479136b70ae3dbbcfd0410504dee800afbb5.tar.bz2
GT5-Unofficial-81fb479136b70ae3dbbcfd0410504dee800afbb5.zip
Multi Autoclave/Lathe Revisions (#2976)
* Revisions: add option for output hatch * Revisions: Format waila better * Revisions: More cleanup on waila and add some to the MultiLathe --------- Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/multi')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiAutoclave.java20
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiLathe.java45
2 files changed, 56 insertions, 9 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiAutoclave.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiAutoclave.java
index 77cd30e453..fdb34b6d25 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiAutoclave.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiAutoclave.java
@@ -11,6 +11,7 @@ import static gregtech.api.enums.GT_HatchElement.InputHatch;
import static gregtech.api.enums.GT_HatchElement.Maintenance;
import static gregtech.api.enums.GT_HatchElement.Muffler;
import static gregtech.api.enums.GT_HatchElement.OutputBus;
+import static gregtech.api.enums.GT_HatchElement.OutputHatch;
import static gregtech.api.enums.GT_Values.AuthorVolence;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_AUTOCLAVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_AUTOCLAVE_ACTIVE;
@@ -145,7 +146,7 @@ public class GT_MetaTileEntity_MultiAutoclave extends
.addElement(
'A',
buildHatchAdder(GT_MetaTileEntity_MultiAutoclave.class)
- .atLeast(InputBus, OutputBus, InputHatch, Maintenance, Muffler, Energy)
+ .atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Muffler, Energy)
.casingIndex(((GT_Block_Casings10) GregTech_API.sBlockCasings10).getTextureIndex(3))
.dot(1)
.buildAndChain(
@@ -236,8 +237,8 @@ public class GT_MetaTileEntity_MultiAutoclave extends
mEnergyHatches.clear();
setCoilLevel(HeatingCoilLevel.None);
if (!checkPiece(STRUCTURE_PIECE_MAIN, 3, 6, 0)) return false;
- if (mCasingAmount < 128) return false;
return this.mMaintenanceHatches.size() == 1 && fluidPipeTier >= 0
+ && mCasingAmount >= 128
&& itemPipeTier >= 0
&& mEnergyHatches.size() >= 1
&& mMufflerHatches.size() == 1;
@@ -340,7 +341,8 @@ public class GT_MetaTileEntity_MultiAutoclave extends
tag.setFloat("getMaxParallelRecipes", getMaxParallelRecipes());
}
- private static final DecimalFormat df = new DecimalFormat("0.00");
+ private static final DecimalFormat dfTwo = new DecimalFormat("0.00");
+ private static final DecimalFormat dfNone = new DecimalFormat("#");
@Override
public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
@@ -350,28 +352,28 @@ public class GT_MetaTileEntity_MultiAutoclave extends
currenttip.add(
StatCollector.translateToLocal("GT5U.multiblock.fluidPipeTier") + ": "
+ EnumChatFormatting.WHITE
- + tag.getInteger("fluidPipeTier"));
+ + Math.max(0, tag.getInteger("fluidPipeTier")));
currenttip.add(
StatCollector.translateToLocal("GT5U.multiblock.euModifier") + ": "
+ EnumChatFormatting.WHITE
- + df.format(euModifier(tag.getInteger("fluidPipeTier")) * 100)
+ + dfTwo.format(Math.max(0, euModifier(tag.getInteger("fluidPipeTier")) * 100))
+ "%");
currenttip.add(
StatCollector.translateToLocal("GT5U.multiblock.itemPipeTier") + ": "
+ EnumChatFormatting.WHITE
- + tag.getInteger("itemPipeTier"));
+ + Math.max(0, tag.getInteger("itemPipeTier")));
currenttip.add(
StatCollector.translateToLocal("GT5U.multiblock.parallelism") + ": "
+ EnumChatFormatting.WHITE
- + tag.getFloat("getMaxParallelRecipes"));
+ + dfNone.format(Math.max(0, tag.getFloat("getMaxParallelRecipes"))));
currenttip.add(
StatCollector.translateToLocal("GT5U.multiblock.coilLevel") + ": "
+ EnumChatFormatting.WHITE
- + tag.getInteger("coilTier"));
+ + Math.max(0, tag.getInteger("coilTier")));
currenttip.add(
StatCollector.translateToLocal("GT5U.multiblock.speed") + ": "
+ EnumChatFormatting.WHITE
- + df.format(100 / speedBoost(tag.getInteger("coilTier")))
+ + dfNone.format(Math.max(0, 100 / speedBoost(tag.getInteger("coilTier"))))
+ "%");
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiLathe.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiLathe.java
index 18796433f9..dc15d89c70 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiLathe.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiLathe.java
@@ -16,8 +16,17 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_LATHE_A
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_LATHE_GLOW;
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
+import java.text.DecimalFormat;
+import java.util.List;
+
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;
@@ -43,6 +52,8 @@ import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Block_Casings2;
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
public class GT_MetaTileEntity_MultiLathe extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_MultiLathe>
implements ISurvivalConstructable {
@@ -219,6 +230,7 @@ public class GT_MetaTileEntity_MultiLathe extends GT_MetaTileEntity_EnhancedMult
.addInfo("Gains 2 parallels per voltage tier,")
.addInfo("and 4 parallels per pipe casing tier (16 for Black Plutonium)")
.addInfo("Better pipe casings increase speed")
+ .addInfo("Only uses 80% of the recipe's required energy")
.addInfo(AuthorVolence)
.addSeparator()
.beginStructureBlock(7, 5, 5, true)
@@ -285,6 +297,39 @@ public class GT_MetaTileEntity_MultiLathe extends GT_MetaTileEntity_EnhancedMult
}
@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("itemPipeTier", Math.max(0, pipeTier));
+ tag.setFloat(
+ "speedBonus",
+ Math.max(0, 100 / (1F / (getPipeData().speedBoost + GT_Utility.getTier(this.getMaxInputVoltage()) / 4F))));
+ tag.setFloat("getMaxParallelRecipes", Math.max(0, getMaxParallelRecipes()));
+ }
+
+ private static final DecimalFormat dfNone = new DecimalFormat("#");
+
+ @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("GT5U.multiblock.itemPipeTier") + ": "
+ + EnumChatFormatting.WHITE
+ + Math.max(0, tag.getInteger("itemPipeTier")));
+ currenttip.add(
+ StatCollector.translateToLocal("GT5U.multiblock.parallelism") + ": "
+ + EnumChatFormatting.WHITE
+ + dfNone.format(Math.max(0, tag.getFloat("getMaxParallelRecipes"))));
+ currenttip.add(
+ StatCollector.translateToLocal("GT5U.multiblock.speed") + ": "
+ + EnumChatFormatting.WHITE
+ + dfNone.format(Math.max(0, tag.getFloat("speedBonus")))
+ + "%");
+ }
+
+ @Override
public RecipeMap<?> getRecipeMap() {
return RecipeMaps.latheRecipes;
}