From ca2ebd4bd1887d32dab8c9c23b419c617a1b4f58 Mon Sep 17 00:00:00 2001 From: boubou19 Date: Tue, 18 Jul 2023 17:52:23 +0200 Subject: Added machine type on single block tooltips (#2138) * change tooltips * put machine types together * Added constructor to accept multi line tooltip on sbs * sorting machine registering methods * update MachineType * migrate machines to multiline description * add new constructor for matter amplifier * migrate matter amplifier to multi line tooltip * spotless apply * Capitalize machine types * breakdown large run methods into themed methods * migrate TE IDs to an enum (1/?) * spotless apply * migrate TE IDs to an enum (2/?) * migrate TE IDs to an enum (3/?) * migrate TE IDs to an enum (4/?) * spotless apply * sorting crafting recipes by type + fix meta id typo * migrate TE IDs to an enum(5/?) * spotless apply * merge master (#2143) * Make structure tooltips more colorful (#2133) * default color changes * add colored casing amount builders * oversight * address reviews * GPL Special Item access (#2134) * Added getters to allow a machine to set the special item for recipe checking * Changes to ore factorys running mode description (#2135) * Changes the integrated ore factory mode description to match what its actually doing. * Some tooltip grammar changes. That would have annoyed me :) * Enable void protection for PA (#2136) * Added ofNoOverclock builder that accepts eut and duration (#2140) * Fix findRecipe might limit stack size by 64 (#2139) * Fix potential issue with applecore ItemFoodProxy (#2137) * Fix potential issue with applecore ItemFoodProxy * Fix the worst class loader issue ive ever encountered --------- Co-authored-by: GDCloud <93287602+GDCloudstrike@users.noreply.github.com> Co-authored-by: Maxim Co-authored-by: Lyfts <127234178+Lyfts@users.noreply.github.com> Co-authored-by: miozune Co-authored-by: Serenibyss <10861407+serenibyss@users.noreply.github.com> * Moved machine type and descriptions to lang files * Removed redundant visibility modifier * Only expose translated descriptions * Using prefix gt.recipe for NEI compatibility * Deprecate use of LanguageManager in GT_Recipe_Map * Unify GT_Recipe and MachineType localization * Electromagnetic Polarizer consistency with Separator * Added Packager MachineType * Added Scanner MachineType * Added Rock breaker MachineType * Added Mass Fabricator MachineType * Added Replicator MachineType * Added "Machine Type" tooltip to steam machines * public modifier unnecessary * Spotless apply --------- Co-authored-by: minecraft7771 Co-authored-by: Martin Robertz Co-authored-by: GDCloud <93287602+GDCloudstrike@users.noreply.github.com> Co-authored-by: Lyfts <127234178+Lyfts@users.noreply.github.com> Co-authored-by: miozune Co-authored-by: Serenibyss <10861407+serenibyss@users.noreply.github.com> Co-authored-by: YannickMG --- .../GT_MetaTileEntity_BasicMachine_Bronze.java | 15 +++++ .../GT_MetaTileEntity_BasicMachine_GT_Recipe.java | 75 ++++++++++++++++++++++ 2 files changed, 90 insertions(+) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index c3cb9da636..322f62ac09 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -10,11 +10,15 @@ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZE_TOP; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +import java.util.Arrays; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; +import com.gtnewhorizon.gtnhlib.util.AnimatedTooltipHandler; import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.math.Pos2d; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -47,6 +51,7 @@ import gregtech.common.power.SteamPower; */ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileEntity_BasicMachine { + private static final String TT_machineType = StatCollector.translateToLocal("GT5U.MBTT.MachineType"); private static final int NEEDS_STEAM_VENTING = 64; public boolean mNeedsSteamVenting = false; @@ -384,4 +389,14 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE protected FluidSlotWidget createFluidOutputSlot(IDrawable[] backgrounds, Pos2d pos) { return null; } + + @Override + public String[] getDescription() { + String[] description = Arrays.copyOf(mDescriptionArray, mDescriptionArray.length + 1); + description[mDescriptionArray.length] = TT_machineType + ": " + + AnimatedTooltipHandler.YELLOW + + StatCollector.translateToLocal(this.getRecipeList().mUnlocalizedName) + + AnimatedTooltipHandler.RESET; + return description; + } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index 42f45e0e5d..2a11a890bd 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -70,6 +70,31 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, ResourceLocation aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) { + this( + aID, + aName, + aNameRegional, + aTier, + new String[] { aDescription }, + aRecipes, + aInputSlots, + aOutputSlots, + aTankCapacity, + aGUIParameterA, + aGUIParameterB, + aGUIName, + aSound, + aSharedTank, + aRequiresFluidForFiltering, + aSpecialEffect, + aOverlays, + aRecipe); + } + + public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, + String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, + int aGUIParameterA, int aGUIParameterB, String aGUIName, ResourceLocation aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) { super( aID, aName, @@ -448,6 +473,31 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ aRecipe); } + public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, + String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, boolean usesFluids, + int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) { + this( + aID, + aName, + aNameRegional, + aTier, + aDescription, + aRecipes, + aInputSlots, + aOutputSlots, + usesFluids ? getCapacityForTier(aTier) : 0, + aGUIParameterA, + aGUIParameterB, + aGUIName, + aSound.resourceLocation, + aSharedTank, + aRequiresFluidForFiltering, + aSpecialEffect, + aOverlays, + aRecipe); + } + public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank, @@ -473,6 +523,31 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ aRecipe); } + public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, + String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, + int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) { + this( + aID, + aName, + aNameRegional, + aTier, + aDescription, + aRecipes, + aInputSlots, + aOutputSlots, + aTankCapacity, + aGUIParameterA, + aGUIParameterB, + aGUIName, + aSound.resourceLocation, + aSharedTank, + aRequiresFluidForFiltering, + aSpecialEffect, + aOverlays, + aRecipe); + } + /** * @inheritDoc * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe( int aID, String, String, int, String, -- cgit