Skip to content

Commit

Permalink
Multi Autoclave/Lathe Revisions (GTNewHorizons#2976)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Volence and Dream-Master authored Aug 26, 2024
1 parent fa0e628 commit 81fb479
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand Down Expand Up @@ -145,7 +146,7 @@ public Integer getCoilTier() {
.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(
Expand Down Expand Up @@ -236,8 +237,8 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
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;
Expand Down Expand Up @@ -340,7 +341,8 @@ public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompou
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,
Expand All @@ -350,28 +352,28 @@ public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDat
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"))))
+ "%");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@
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;
Expand All @@ -43,6 +52,8 @@
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 {
Expand Down Expand Up @@ -219,6 +230,7 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
.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)
Expand Down Expand Up @@ -284,6 +296,39 @@ public int getMaxParallelRecipes() {
return getPipeData().maxParallel + (GT_Utility.getTier(this.getMaxInputVoltage()) * 2);
}

@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;
Expand Down

0 comments on commit 81fb479

Please sign in to comment.