From 585338863022d2fd7ded5233268a25fc7c643fba Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Sun, 21 Jan 2024 12:29:00 +0800 Subject: [PATCH] Fix Recycling Groovy Helpers, Localize Colours, JEI Helpers --- gradle.properties | 6 +- src/main/groovy-tests/forMaterialTests.groovy | 24 ++- src/main/groovy-tests/jeiTests.groovy | 20 +++ .../groovy-tests/replaceRecyclingTests.groovy | 5 +- .../java/com/nomiceu/nomilabs/LabsValues.java | 1 + .../java/com/nomiceu/nomilabs/NomiLabs.java | 4 +- .../com/nomiceu/nomilabs/block/BlockBase.java | 24 +-- .../nomilabs/block/BlockExcitationCoil.java | 6 +- .../nomilabs/block/registry/LabsBlocks.java | 8 +- .../nomiceu/nomilabs/core/LabsLateMixin.java | 3 +- .../nomiceu/nomilabs/event/CommonProxy.java | 2 +- .../MetaTileEntityActualizationChamber.java | 6 +- .../MetaTileEntityCreativeTankProvider.java | 6 +- .../MetaTileEntityDMESimChamber.java | 6 +- .../multiblock/MetaTileEntityGreenhouse.java | 6 +- .../MetaTileEntityMicroverseProjector.java | 10 +- .../MetaTileEntityNaquadahReactor.java | 11 +- .../MetaTileEntityUniversalCrystalizer.java | 6 +- .../nomilabs/groovy/GroovyHelpers.java | 44 +++++- .../nomilabs/groovy/LabsGroovyPlugin.java | 20 +++ .../groovy/LabsVirtualizedRegistries.java | 29 ++++ .../nomilabs/groovy/ReplaceRecipe.java | 8 +- .../draconicevolution/GuiEnergyCoreLogic.java | 15 +- .../nomilabs/integration/jei/JEIPlugin.java | 21 ++- .../integration/jei/PartialRecipeWrapper.java | 26 ++++ .../com/nomiceu/nomilabs/item/ItemBase.java | 26 ++-- .../nomiceu/nomilabs/item/ItemCapacitor.java | 7 +- .../nomilabs/item/ItemExcitationCoil.java | 16 +- .../nomilabs/item/ItemHandFramingTool.java | 20 +-- .../item/registry/register/LabsEndgame.java | 8 +- .../registry/register/LabsMicroMiners.java | 98 ++++++------- .../nomilabs/mixin/WorldLoadHandler.java | 5 +- .../draconicevolution/GuiEnergyCoreMixin.java | 17 ++- .../jei/CraftingRecipeCategoryMixin.java | 32 ++++ .../nomilabs/remap/LabsMessageHelper.java | 137 +++++------------- .../nomiceu/nomilabs/remap/LabsRemappers.java | 4 +- .../remap/datafixer/DataFixerHandler.java | 6 +- .../nomilabs/tooltip/LabsTooltipHelper.java | 89 +----------- .../nomilabs/tooltip/TooltipAdder.java | 6 +- .../com/nomiceu/nomilabs/util/ItemMeta.java | 28 +++- .../nomiceu/nomilabs/util/ItemTagMeta.java | 37 +++++ .../com/nomiceu/nomilabs/util/LabsSide.java | 17 +++ .../nomiceu/nomilabs/util/LabsTranslate.java | 66 +++++++++ .../resources/assets/nomilabs/lang/en_us.lang | 91 ++++++------ src/main/resources/mixins.nomilabs.jei.json | 12 ++ 45 files changed, 597 insertions(+), 442 deletions(-) create mode 100644 src/main/groovy-tests/jeiTests.groovy create mode 100644 src/main/java/com/nomiceu/nomilabs/groovy/LabsGroovyPlugin.java create mode 100644 src/main/java/com/nomiceu/nomilabs/groovy/LabsVirtualizedRegistries.java create mode 100644 src/main/java/com/nomiceu/nomilabs/integration/jei/PartialRecipeWrapper.java create mode 100644 src/main/java/com/nomiceu/nomilabs/mixin/jei/CraftingRecipeCategoryMixin.java create mode 100644 src/main/java/com/nomiceu/nomilabs/util/ItemTagMeta.java create mode 100644 src/main/java/com/nomiceu/nomilabs/util/LabsSide.java create mode 100644 src/main/java/com/nomiceu/nomilabs/util/LabsTranslate.java create mode 100644 src/main/resources/mixins.nomilabs.jei.json diff --git a/gradle.properties b/gradle.properties index 71c57af9..23dcdb27 100644 --- a/gradle.properties +++ b/gradle.properties @@ -199,11 +199,11 @@ org.gradle.jvmargs = -Xmx3G # Whether to enable Storage Drawers and its deps in runtime. Enables Hand Framing Tool. # If this is set to false, the hand framing tool is disabled. -enable_storage_drawers = false +enable_storage_drawers = true # Whether to enable Framed Compacting Drawers and its deps in runtime. Enables more of the Hand Framing Tool. # Requires `enable_storage_drawers` to be set to true. -enable_framed_compact = false +enable_framed_compact = true # Whether to enable Ender IO and its deps in runtime. Enables Custom Capacitors. # If this is set to false, custom capacitors are disabled. @@ -219,7 +219,7 @@ enable_ae2 = false # Whether to enable Extended Crafting in runtime. Enables Extended Crafting Blocks in DME Sim Chamber and Naq Reactors. # If this is set to false, those blocks will be set to air. -enable_extended_crafting = false +enable_extended_crafting = true # Whether to enable Draconic Evolution in runtime. Enables the energy core and reactor mixin improvements, and Draconic Evolution blocks in Universal Crystallizer. # If this is set to false, the mixin will not apply, and those blocks will be set to air. diff --git a/src/main/groovy-tests/forMaterialTests.groovy b/src/main/groovy-tests/forMaterialTests.groovy index 896a0860..67c0d5b1 100644 --- a/src/main/groovy-tests/forMaterialTests.groovy +++ b/src/main/groovy-tests/forMaterialTests.groovy @@ -1,34 +1,33 @@ -import net.minecraft.item.ItemStack - -import static com.nomiceu.nomilabs.groovy.GroovyHelpers.* import net.minecraftforge.fluids.Fluid +import static com.nomiceu.nomilabs.groovy.GroovyHelpers.MaterialHelpers.* + // Actions on Items include all material items and blocks, and buckets containing any material fluid. // Actions on Fluids include liquids, gasses, solids, and addon fluids (such as molten fluids, added by GCYM) println("ITEMS:") // Do an Action for each Material's Item (GregTech's) -MaterialHelpers.forMaterialItem(material('tungsten_steel'), (stack) -> println(getFormattingForStack(stack, "Tungsten Steel"))) +forMaterialItem(material('tungsten_steel'), (stack) -> println(getFormattingForStack(stack, "Tungsten Steel"))) // Do an Action for each Material's Item (Nomi Labs') -MaterialHelpers.forMaterialItem(material('nomilabs:dulysite'), (stack) -> println(getFormattingForStack(stack, "Dulysite"))) +forMaterialItem(material('nomilabs:dulysite'), (stack) -> println(getFormattingForStack(stack, "Dulysite"))) println("FLUIDS:") // Do an Action for each Material's Fluid (GregTech's) -MaterialHelpers.forMaterialFluid(material('tungsten_steel'), (fluid) -> println(getFormattingForFluid(fluid, "Tungsten Steel"))) +forMaterialFluid(material('tungsten_steel'), (fluid) -> println(getFormattingForFluid(fluid, "Tungsten Steel"))) // Do an Action for each Material's Fluid (Nomi Labs') -MaterialHelpers.forMaterialFluid(material('nomilabs:dulysite'), (fluid) -> println(getFormattingForFluid(fluid, "Dulysite"))) +forMaterialFluid(material('nomilabs:dulysite'), (fluid) -> println(getFormattingForFluid(fluid, "Dulysite"))) println("COMBINED:") // Do an Action for each Material's Items and Fluids (GregTech's) -MaterialHelpers.forMaterial(material('tungsten_steel'), (stack) -> println(getFormattingForStack(stack, "Tungsten Steel")), (fluid) -> println(getFormattingForFluid(fluid, "Tungsten Steel"))) +forMaterial(material('tungsten_steel'), (stack) -> println(getFormattingForStack(stack, "Tungsten Steel")), (fluid) -> println(getFormattingForFluid(fluid, "Tungsten Steel"))) // Do an Action for each Material's Items and Fluids (Nomi Labs') -MaterialHelpers.forMaterial(material('nomilabs:dulysite'), (stack) -> println(getFormattingForStack(stack, "Dulysite")), (fluid) -> println(getFormattingForFluid(fluid, "Dulysite"))) +forMaterial(material('nomilabs:dulysite'), (stack) -> println(getFormattingForStack(stack, "Dulysite")), (fluid) -> println(getFormattingForFluid(fluid, "Dulysite"))) static String getFormattingForStack(ItemStack stack, String name) { if (!stack.hasTagCompound()) return "${name}: Item: ${stack.getItem().getRegistryName()} at ${stack.getMetadata()} with no tag." @@ -42,11 +41,10 @@ static String getFormattingForFluid(Fluid fluid, String name) { // JEI Shortforms // Hide All Material Items and Fluids -MaterialHelpers.hideMaterial(material('nomilabs:taranium')) +hideMaterial(material('nomilabs:taranium')) // Remove and Hide All Material Items and Fluids (Removes crafting recipes outputting material items) -MaterialHelpers.removeAndHideMaterial(material('titanium')) +removeAndHideMaterial(material('titanium')) // Same as above, but... yeet. Same as Groovy's -MaterialHelpers.yeetMaterial(material('gcym:watertight_steel')) - +yeetMaterial(material('gcym:watertight_steel')) diff --git a/src/main/groovy-tests/jeiTests.groovy b/src/main/groovy-tests/jeiTests.groovy new file mode 100644 index 00000000..0e029fe8 --- /dev/null +++ b/src/main/groovy-tests/jeiTests.groovy @@ -0,0 +1,20 @@ +import net.minecraft.util.text.TextFormatting + +import static com.nomiceu.nomilabs.groovy.GroovyHelpers.JEIHelpers.* +import static com.nomiceu.nomilabs.groovy.GroovyHelpers.TranslationHelpers.* + +/* Description Pages. Each entry is seperated by double new lines. */ + +// Add a description page for a stack +addDescription(item('minecraft:apple'), format("An Ordinary Apple... Not Poisoned.", TextFormatting.DARK_GREEN), "Eat it!") + +// Add a translated description page for a stack +addDescription(item('minecraft:iron_ingot'), translate("tooltip.nomilabs.greenhouse.description"), translate("tooltip.nomilabs.dme_sim_chamber.description")) + +/* Recipe Output Tooltips. These are tooltips that appear on recipes that output that stack. */ + +// Add a recipe output tooltip for a stack +addRecipeOutputTooltip(item('minecraft:golden_apple'), format("An Ordinary Apple... Not Poisoned.", TextFormatting.GREEN), "Eat it!") + +// Add a translated recipe output tooltip for a stack +addRecipeOutputTooltip(item('minecraft:iron_ingot'), translate("tooltip.nomilabs.greenhouse.description"), translate("tooltip.nomilabs.dme_sim_chamber.description")) diff --git a/src/main/groovy-tests/replaceRecyclingTests.groovy b/src/main/groovy-tests/replaceRecyclingTests.groovy index 2f617084..5c633e87 100644 --- a/src/main/groovy-tests/replaceRecyclingTests.groovy +++ b/src/main/groovy-tests/replaceRecyclingTests.groovy @@ -28,7 +28,4 @@ replaceRecipeInput("electric_motor_hv", [ [metaitem('plateWroughtIron'), metaitem('plateWroughtIron'), metaitem('plateWroughtIron')], [metaitem('plateWroughtIron'), ore('toolWrench'), metaitem('plateWroughtIron')], [metaitem('plateWroughtIron'), metaitem('plateWroughtIron'), metaitem('plateWroughtIron')] -]) - -// Reload recycling recipes (so it works in GS Reload, and in the postInit phase) -reloadRecyclingRecipes() \ No newline at end of file +]) \ No newline at end of file diff --git a/src/main/java/com/nomiceu/nomilabs/LabsValues.java b/src/main/java/com/nomiceu/nomilabs/LabsValues.java index 8a33b870..7359d375 100644 --- a/src/main/java/com/nomiceu/nomilabs/LabsValues.java +++ b/src/main/java/com/nomiceu/nomilabs/LabsValues.java @@ -27,4 +27,5 @@ public class LabsValues { public static final String STORAGE_DRAWERS_MODID = "storagedrawers"; public static final String FRAMED_COMPACT_MODID = "framedcompactdrawers"; public static final String ENDER_IO_MODID = "enderio"; + public static final String JEI_MODID = "jei"; } diff --git a/src/main/java/com/nomiceu/nomilabs/NomiLabs.java b/src/main/java/com/nomiceu/nomilabs/NomiLabs.java index 2de9ab7d..6bad7f45 100644 --- a/src/main/java/com/nomiceu/nomilabs/NomiLabs.java +++ b/src/main/java/com/nomiceu/nomilabs/NomiLabs.java @@ -3,9 +3,9 @@ import com.nomiceu.nomilabs.event.ClientProxy; import com.nomiceu.nomilabs.event.CommonProxy; import com.nomiceu.nomilabs.remap.datafixer.DataFixerHandler; +import com.nomiceu.nomilabs.util.LabsSide; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.*; @@ -32,7 +32,7 @@ public class NomiLabs { @EventHandler public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(this); - if (FMLCommonHandler.instance().getEffectiveSide().isClient()) + if (LabsSide.isClient()) ClientProxy.preInit(); CommonProxy.preInit(); } diff --git a/src/main/java/com/nomiceu/nomilabs/block/BlockBase.java b/src/main/java/com/nomiceu/nomilabs/block/BlockBase.java index 0655ae04..7c73a693 100644 --- a/src/main/java/com/nomiceu/nomilabs/block/BlockBase.java +++ b/src/main/java/com/nomiceu/nomilabs/block/BlockBase.java @@ -1,8 +1,6 @@ package com.nomiceu.nomilabs.block; -import com.google.common.collect.ImmutableList; import com.nomiceu.nomilabs.integration.top.TOPInfoProvider; -import com.nomiceu.nomilabs.tooltip.LabsTooltipHelper; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -18,13 +16,14 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class BlockBase extends Block implements TOPInfoProvider { - private List description; + private String[] description; public BlockBase(ResourceLocation rl, CreativeTabs tab, Material material, SoundType sound) { super(material); - initialize(rl, tab, sound, ImmutableList.of()); + initialize(rl, tab, sound); } /** @@ -35,12 +34,12 @@ public BlockBase(ResourceLocation rl, CreativeTabs tab, Material material, Sound * @param sound Sound * @param description Description. Map of translation keys to formatting keys. Is of string to string so we can use GTFormatCodes */ - public BlockBase(ResourceLocation rl, CreativeTabs tab, Material material, SoundType sound, List description) { + public BlockBase(ResourceLocation rl, CreativeTabs tab, Material material, SoundType sound, String... description) { super(material); initialize(rl, tab, sound, description); } - private void initialize(ResourceLocation rl, CreativeTabs tab, SoundType sound, List description) { + private void initialize(ResourceLocation rl, CreativeTabs tab, SoundType sound, String... description) { this.setRegistryName(rl); this.setHardness(2.0F); this.setResistance(10.0F); @@ -49,24 +48,15 @@ private void initialize(ResourceLocation rl, CreativeTabs tab, SoundType sound, this.description = description; } - /** - * I18n formatting is done here instead of in constructor as I18n is client only - */ @Override @SideOnly(Side.CLIENT) public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { - for (var text : description) - tooltip.add(text.getFormattedString()); + tooltip.addAll(Arrays.asList(description)); } @Override @SideOnly(Side.CLIENT) public List getTOPMessage(IBlockState state) { - List tooltip = new ArrayList<>(); - for (var text : description) { - var string = text.getTOPFormattedString(); - if (string != null) tooltip.add(string); - } - return tooltip; + return new ArrayList<>(Arrays.asList(description)); } } diff --git a/src/main/java/com/nomiceu/nomilabs/block/BlockExcitationCoil.java b/src/main/java/com/nomiceu/nomilabs/block/BlockExcitationCoil.java index 9d93a15d..3c4ed83a 100644 --- a/src/main/java/com/nomiceu/nomilabs/block/BlockExcitationCoil.java +++ b/src/main/java/com/nomiceu/nomilabs/block/BlockExcitationCoil.java @@ -5,7 +5,6 @@ import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.Mirror; import net.minecraft.util.ResourceLocation; @@ -14,7 +13,6 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.math.BlockPos; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockAccess; import net.minecraft.util.EnumFacing; import net.minecraft.block.state.BlockFaceShape; @@ -25,6 +23,8 @@ import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + @SuppressWarnings({"PointlessArithmeticExpression", "deprecation"}) public class BlockExcitationCoil extends BlockDirectional implements TOPInfoProvider { @@ -150,6 +150,6 @@ public int getMetaFromState(IBlockState state) @Override @SideOnly(Side.CLIENT) public List getTOPMessage(IBlockState state) { - return ImmutableList.of(TextFormatting.GRAY + I18n.format("tooltip.nomilabs.excitationcoil.description_block")); + return ImmutableList.of(translate("tooltip.nomilabs.general.crafting_component")); } } \ No newline at end of file diff --git a/src/main/java/com/nomiceu/nomilabs/block/registry/LabsBlocks.java b/src/main/java/com/nomiceu/nomilabs/block/registry/LabsBlocks.java index 98d99dea..17ebc898 100644 --- a/src/main/java/com/nomiceu/nomilabs/block/registry/LabsBlocks.java +++ b/src/main/java/com/nomiceu/nomilabs/block/registry/LabsBlocks.java @@ -1,6 +1,5 @@ package com.nomiceu.nomilabs.block.registry; -import com.google.common.collect.ImmutableList; import com.nomiceu.nomilabs.block.*; import com.nomiceu.nomilabs.item.ItemBlockBase; import com.nomiceu.nomilabs.creativetab.registry.LabsCreativeTabs; @@ -13,7 +12,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.IRarity; import net.minecraftforge.registries.IForgeRegistry; import org.jetbrains.annotations.NotNull; @@ -25,7 +23,7 @@ import java.util.function.Function; import static com.nomiceu.nomilabs.util.LabsNames.makeLabsName; -import static com.nomiceu.nomilabs.tooltip.LabsTooltipHelper.Tooltip; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; @SuppressWarnings("unused") public class LabsBlocks { @@ -60,10 +58,10 @@ public static void preInit() { /* Ultimate Blocks */ ULTIMATE_POWER_STORAGE = createBlock(new BlockBase(makeLabsName("ultimate_power_storage"), LabsCreativeTabs.TAB_NOMI_LABS, Material.IRON, SoundType.METAL, - ImmutableList.of(Tooltip.of("tooltip.nomilabs.ultimate_items.description").withFormat(TextFormatting.GRAY))), + translate("tooltip.nomilabs.general.crafting_component")), EnumRarity.EPIC, 1); ULTIMATE_GENERATOR = createBlock(new BlockBase(makeLabsName("ultimate_generator"), LabsCreativeTabs.TAB_NOMI_LABS, Material.IRON, SoundType.METAL, - ImmutableList.of(Tooltip.of("tooltip.nomilabs.ultimate_items.description").withFormat(TextFormatting.GRAY))), + translate("tooltip.nomilabs.general.crafting_component")), EnumRarity.EPIC, 1); /* Misc Blocks */ diff --git a/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java b/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java index 4508a339..2cba8243 100644 --- a/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java +++ b/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java @@ -19,7 +19,8 @@ public class LabsLateMixin implements ILateMixinLoader { LabsValues.DRACONIC_MODID, LabsConfig.modIntegration.draconicEvolutionIntegration.enableDraconicEvolutionIntegration, LabsValues.NUCLEARCRAFT_MODID, LabsConfig.modIntegration.enableNuclearCraftIntegration, LabsValues.XU2_MODID, LabsConfig.modIntegration.enableExtraUtils2Integration, - LabsValues.GREGTECH_MODID, true + LabsValues.GREGTECH_MODID, true, + LabsValues.JEI_MODID, true ); @Override diff --git a/src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java b/src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java index bcc560f2..69d88784 100644 --- a/src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java +++ b/src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java @@ -111,7 +111,7 @@ public static void registerRecipes(RegistryEvent.Register event) { if (LabsConfig.content.customContent.enableComplexRecipes && LabsItems.HAND_FRAMING_TOOL != null) event.getRegistry().register(new HandFramingRecipe(LabsNames.makeLabsName("hand_framing_recipe"))); - //com.nomiceu.nomilabs.recipe.LabsTestRecipes.initRecipes(); + com.nomiceu.nomilabs.recipe.LabsTestRecipes.initRecipes(); } @SubscribeEvent diff --git a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityActualizationChamber.java b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityActualizationChamber.java index 1b213302..d4b7a2f8 100644 --- a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityActualizationChamber.java +++ b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityActualizationChamber.java @@ -14,11 +14,9 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -27,6 +25,8 @@ import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.translate; + public class MetaTileEntityActualizationChamber extends RecipeMapMultiblockController { public MetaTileEntityActualizationChamber(ResourceLocation metaTileEntityId) { super(metaTileEntityId, LabsRecipeMaps.ACTUALIZATION_CHAMBER_RECIPES); @@ -89,7 +89,7 @@ public boolean canBeDistinct() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.actualization_chamber.description") + TextFormatting.RESET); + tooltip.add(translate("tooltip.nomilabs.actualization_chamber.description")); super.addInformation(stack, world, tooltip, advanced); } } diff --git a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityCreativeTankProvider.java b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityCreativeTankProvider.java index 14bade25..ca994421 100755 --- a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityCreativeTankProvider.java +++ b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityCreativeTankProvider.java @@ -16,11 +16,9 @@ import gregtech.common.blocks.*; import gregtech.core.sound.GTSoundEvents; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -29,6 +27,8 @@ import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + public class MetaTileEntityCreativeTankProvider extends RecipeMapMultiblockController { public MetaTileEntityCreativeTankProvider(ResourceLocation metaTileEntityId) { @@ -88,7 +88,7 @@ public boolean canBeDistinct() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.creative_tank_provider.description") + TextFormatting.RESET); + tooltip.add(translate("tooltip.nomilabs.creative_tank_provider.description")); super.addInformation(stack, world, tooltip, advanced); } } diff --git a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityDMESimChamber.java b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityDMESimChamber.java index acaabf6c..8f179b4c 100644 --- a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityDMESimChamber.java +++ b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityDMESimChamber.java @@ -20,12 +20,10 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; @@ -35,6 +33,8 @@ import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + public class MetaTileEntityDMESimChamber extends RecipeMapMultiblockController { public MetaTileEntityDMESimChamber(ResourceLocation metaTileEntityId) { super(metaTileEntityId, LabsRecipeMaps.DME_SIM_CHAMBER_RECIPES); @@ -122,7 +122,7 @@ public boolean canBeDistinct() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.dme_sim_chamber.description") + TextFormatting.RESET); + tooltip.add(translate("tooltip.nomilabs.dme_sim_chamber.description")); super.addInformation(stack, world, tooltip, advanced); } } diff --git a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityGreenhouse.java b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityGreenhouse.java index 14b97640..6a15144c 100755 --- a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityGreenhouse.java +++ b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityGreenhouse.java @@ -17,13 +17,11 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import gregicality.multiblocks.api.metatileentity.GCYMRecipeMapMultiblockController; import net.minecraft.util.SoundEvent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -32,6 +30,8 @@ import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + public class MetaTileEntityGreenhouse extends GCYMRecipeMapMultiblockController { public MetaTileEntityGreenhouse(ResourceLocation metaTileEntityId) { @@ -121,7 +121,7 @@ public boolean canBeDistinct() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.greenhouse.description") + TextFormatting.RESET); + tooltip.add(translate("tooltip.nomilabs.greenhouse.description")); super.addInformation(stack, world, tooltip, advanced); } } diff --git a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityMicroverseProjector.java b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityMicroverseProjector.java index 89c7a077..94f0ada8 100644 --- a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityMicroverseProjector.java +++ b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityMicroverseProjector.java @@ -22,13 +22,11 @@ import gregtech.common.metatileentities.MetaTileEntities; import gregtech.core.sound.GTSoundEvents; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; @@ -41,6 +39,8 @@ import java.util.List; import java.util.Objects; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + public abstract class MetaTileEntityMicroverseProjector extends RecipeMapMultiblockController { public MetaTileEntityMicroverseProjector(ResourceLocation metaTileEntityId, int tier) { @@ -152,7 +152,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEnti @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, world, tooltip, advanced); - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.microverse_projector_1.description") + TextFormatting.RESET); + tooltip.add(translate("tooltip.nomilabs.microverse_projector_1.description")); } } @@ -213,7 +213,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEnti @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.microverse_projector_2.description")); + tooltip.add(translate("tooltip.nomilabs.microverse_projector_2.description")); super.addInformation(stack, world, tooltip, advanced); } } @@ -282,7 +282,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEnti @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, world, tooltip, advanced); - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.microverse_projector_3.description")); + tooltip.add(translate("tooltip.nomilabs.microverse_projector_3.description")); } } } diff --git a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityNaquadahReactor.java b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityNaquadahReactor.java index 79ff061f..9e64ec45 100644 --- a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityNaquadahReactor.java +++ b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityNaquadahReactor.java @@ -27,7 +27,6 @@ import gregicality.multiblocks.common.block.GCYMMetaBlocks; import gregicality.multiblocks.common.block.blocks.BlockLargeMultiblockCasing; import gregtech.common.blocks.BlockGlassCasing; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; @@ -48,6 +47,8 @@ import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + public abstract class MetaTileEntityNaquadahReactor extends FuelMultiblockController { public final int numSpatial; public final int voltageTier; @@ -137,8 +138,8 @@ protected IBlockState getCasingStateSpatial() { } public void addSharedInfo(@NotNull List tooltip) { - tooltip.add(TextFormatting.WHITE + I18n.format("tooltip.nomilabs.naquadah_reactor.produces", AMP, GTValues.VNF[voltageTier] + TextFormatting.RESET)); - tooltip.add(TooltipHelper.RAINBOW_SLOW + I18n.format("tooltip.nomilabs.naquadah_reactor.overclock")); + tooltip.add(translate("tooltip.nomilabs.naquadah_reactor.produces", AMP, GTValues.VNF[voltageTier] + TextFormatting.RESET)); + tooltip.add(translateFormat("tooltip.nomilabs.naquadah_reactor.overclock", TooltipHelper.RAINBOW_SLOW)); } @Override @@ -195,7 +196,7 @@ protected IBlockState getCasingStateTop() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, World player, @NotNull List tooltip, boolean advanced) { - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.naquadah_reactor_1.description") + TextFormatting.RESET); + tooltip.add(translate("tooltip.nomilabs.naquadah_reactor_1.description")); addSharedInfo(tooltip); super.addInformation(stack, player, tooltip, advanced); @@ -236,7 +237,7 @@ protected IBlockState getCasingStateTop() { public void addInformation(ItemStack stack, World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.naquadah_reactor_2.description") + TextFormatting.RESET); + tooltip.add(translate("tooltip.nomilabs.naquadah_reactor_2.description")); addSharedInfo(tooltip); } } diff --git a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityUniversalCrystalizer.java b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityUniversalCrystalizer.java index f103f9dc..6c14ee52 100644 --- a/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityUniversalCrystalizer.java +++ b/src/main/java/com/nomiceu/nomilabs/gregtech/multiblock/MetaTileEntityUniversalCrystalizer.java @@ -21,12 +21,10 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; @@ -36,6 +34,8 @@ import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + public class MetaTileEntityUniversalCrystalizer extends RecipeMapMultiblockController { public MetaTileEntityUniversalCrystalizer(ResourceLocation metaTileEntityId) { super(metaTileEntityId, LabsRecipeMaps.UNIVERSAL_CRYSTALIZER_RECIPES); @@ -138,7 +138,7 @@ public boolean canBeDistinct() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - tooltip.add(TextFormatting.DARK_GRAY + I18n.format("tooltip.nomilabs.universal_crystallizer.description") + TextFormatting.RESET); + tooltip.add(translate("tooltip.nomilabs.universal_crystallizer.description")); super.addInformation(stack, world, tooltip, advanced); } } diff --git a/src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java b/src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java index 7c229841..f0b65d34 100644 --- a/src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java +++ b/src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java @@ -5,11 +5,16 @@ import com.cleanroommc.groovyscript.compat.mods.jei.JeiPlugin; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.sandbox.ClosureHelper; +import com.nomiceu.nomilabs.integration.jei.JEIPlugin; +import com.nomiceu.nomilabs.util.LabsSide; +import com.nomiceu.nomilabs.util.LabsTranslate; import gregtech.api.unification.material.Material; import gregtech.api.util.GTUtility; +import gregtech.client.utils.TooltipHelper; import groovy.lang.Closure; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -20,6 +25,42 @@ */ @SuppressWarnings("unused") public class GroovyHelpers { + public static class TranslationHelpers { + public static String translate(String key, Object... params) { + return LabsTranslate.translate(key, params); + } + public static String translateWithBackup(String key, String backup, Object... params) { + return LabsTranslate.translateWithBackup(key, backup, params); + } + + public static String translateFormat(String key, TooltipHelper.GTFormatCode format, Object... params) { + return LabsTranslate.translateFormat(key, format, params); + } + public static String translateWithBackupFormat(String key, String backup, TooltipHelper.GTFormatCode format, Object... params) { + return LabsTranslate.translateWithBackupFormat(key, backup, format, params); + } + + public static String format(String str, TextFormatting... formats) { + return LabsTranslate.format(str, formats); + } + + public static String format(String str, TooltipHelper.GTFormatCode... formats) { + return LabsTranslate.format(str, formats); + } + + public static String format(String str, LabsTranslate.Format... formats) { + return LabsTranslate.format(str, formats); + } + } + public static class JEIHelpers { + public static void addDescription(ItemStack stack, String... description) { + if (LabsSide.isClient()) + JEIPlugin.addDescription(stack, description); + } + public static void addRecipeOutputTooltip(ItemStack stack, String... tooltip) { + JEIPlugin.addRecipeOutputTooltip(stack, tooltip); + } + } public static class MaterialHelpers { public static void hideMaterial(Material material) { MaterialHelper.forMaterialItem(material, JeiPlugin::hideItem); @@ -50,9 +91,6 @@ private static FluidStack toFluidStack(Fluid fluid) { } } public static class RecipeRecyclingHelpers { - public static void reloadRecyclingRecipes() { - ReplaceRecipe.reloadRecyclingRecipes(); - } public static void replaceRecipeShaped(ResourceLocation name, ItemStack output, List> inputs) { ReplaceRecipe.replaceRecipeShaped(name, output, inputs); } diff --git a/src/main/java/com/nomiceu/nomilabs/groovy/LabsGroovyPlugin.java b/src/main/java/com/nomiceu/nomilabs/groovy/LabsGroovyPlugin.java new file mode 100644 index 00000000..fcb01c62 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/groovy/LabsGroovyPlugin.java @@ -0,0 +1,20 @@ +package com.nomiceu.nomilabs.groovy; + +import com.cleanroommc.groovyscript.api.GroovyPlugin; +import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; +import com.nomiceu.nomilabs.LabsValues; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class LabsGroovyPlugin implements GroovyPlugin { + @Override + @NotNull + public String getModId() { + return LabsValues.LABS_MODID; + } + + @Override + public void onCompatLoaded(GroovyContainer container) { + container.getVirtualizedRegistrar().addFieldsOf(LabsVirtualizedRegistries.class); + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/groovy/LabsVirtualizedRegistries.java b/src/main/java/com/nomiceu/nomilabs/groovy/LabsVirtualizedRegistries.java new file mode 100644 index 00000000..02b982a6 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/groovy/LabsVirtualizedRegistries.java @@ -0,0 +1,29 @@ +package com.nomiceu.nomilabs.groovy; + +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import gregtech.api.unification.OreDictUnifier; +import gregtech.api.unification.stack.ItemMaterialInfo; +import net.minecraft.item.ItemStack; +import org.apache.commons.lang3.tuple.Pair; + +@SuppressWarnings("unused") +public class LabsVirtualizedRegistries { + public static final ReplaceRecipeManager REPLACE_RECIPE_MANAGER = new ReplaceRecipeManager(); + + public static class ReplaceRecipeManager extends VirtualizedRegistry> { + @Override + public void onReload() { + restoreFromBackup().forEach((pair) -> OreDictUnifier.registerOre(pair.getLeft(), pair.getRight())); + } + + @Override + public void afterScriptLoad() { + ReplaceRecipe.reloadRecyclingRecipes(); + } + + public void registerOre(ItemStack stack, ItemMaterialInfo info) { + addBackup(Pair.of(stack, OreDictUnifier.getMaterialInfo(stack))); + OreDictUnifier.registerOre(stack, info); + } + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/groovy/ReplaceRecipe.java b/src/main/java/com/nomiceu/nomilabs/groovy/ReplaceRecipe.java index 55125d70..be7b5f30 100644 --- a/src/main/java/com/nomiceu/nomilabs/groovy/ReplaceRecipe.java +++ b/src/main/java/com/nomiceu/nomilabs/groovy/ReplaceRecipe.java @@ -33,7 +33,7 @@ @GroovyBlacklist public class ReplaceRecipe { - static void reloadRecyclingRecipes() { + public static void reloadRecyclingRecipes() { removeRecipesInCategory(RecipeMaps.ARC_FURNACE_RECIPES, RecipeCategories.ARC_FURNACE_RECYCLING); removeRecipesInCategory(RecipeMaps.MACERATOR_RECIPES, RecipeCategories.MACERATOR_RECYCLING); removeRecipesInCategory(RecipeMaps.EXTRACTOR_RECIPES, RecipeCategories.EXTRACTOR_RECYCLING); @@ -70,7 +70,7 @@ static void replaceRecipeOutput(ResourceLocation name, ItemStack newOutput) { // Multiplies by original then Divides by new as https://github.com/GregTechCEu/GregTech/blob/master/src/main/java/gregtech/api/recipes/RecyclingHandler.java#L82 divides originalMaterials.forEach((materialStack -> newMaterials.add(new MaterialStack(materialStack.material, materialStack.amount * originalCount / newCount)))); - OreDictUnifier.registerOre(newOutput, new ItemMaterialInfo(newMaterials)); + LabsVirtualizedRegistries.REPLACE_RECIPE_MANAGER.registerOre(newOutput, new ItemMaterialInfo(newMaterials)); } static void replaceRecipeInput(ResourceLocation name, List> newInputs) { @@ -97,6 +97,8 @@ private static IShapedRecipe validate(ResourceLocation name, ItemStack output, b if (OreDictUnifier.getMaterialInfo(originalOutput) == null) throw new IllegalArgumentException("Could not find existing Material Info for item " + originalOutput); + ReloadableRegistryManager.removeRegistryEntry(ForgeRegistries.RECIPES, name); + return shapedRecipe; } @@ -107,7 +109,7 @@ private static void registerRecycling(ItemStack output, List> gtInputs.add(ofGroovyIngredient(input)); } } - OreDictUnifier.registerOre(output, RecyclingHandler.getRecyclingIngredients(gtInputs, output.getCount())); + LabsVirtualizedRegistries.REPLACE_RECIPE_MANAGER.registerOre(output, RecyclingHandler.getRecyclingIngredients(gtInputs, output.getCount())); } @NotNull diff --git a/src/main/java/com/nomiceu/nomilabs/integration/draconicevolution/GuiEnergyCoreLogic.java b/src/main/java/com/nomiceu/nomilabs/integration/draconicevolution/GuiEnergyCoreLogic.java index 2fbc5032..927f57cd 100644 --- a/src/main/java/com/nomiceu/nomilabs/integration/draconicevolution/GuiEnergyCoreLogic.java +++ b/src/main/java/com/nomiceu/nomilabs/integration/draconicevolution/GuiEnergyCoreLogic.java @@ -7,17 +7,18 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + @SideOnly(Side.CLIENT) public class GuiEnergyCoreLogic { public static GuiButton addDestructButtonToList(GuiContainer gui, List buttonList) { GuiButton destructCore = new GuiButtonAHeight(7, gui.guiLeft + 9, gui.guiTop + 73 + 10, 162, 12, - I18n.format("button.de.destructCore.instant.txt")); + translate("button.de.destructCore.instant.txt")); buttonList.add(destructCore); return destructCore; } @@ -29,21 +30,21 @@ public static void drawBackground(GuiEnergyCore gui, FontRenderer fontRenderer) var improvedTile = (ImprovedTileEnergyCore) gui.tile; GuiHelper.drawGuiBaseBackground(gui, gui.guiLeft, gui.guiTop, gui.xSize, gui.ySize); GuiHelper.drawPlayerSlots(gui, gui.guiLeft + (gui.xSize / 2), gui.guiTop + 115 + 10, true); - gui.drawCenteredString(fontRenderer, I18n.format("gui.de.energyStorageCore.name", gui.tile.tier.toString()), + gui.drawCenteredString(fontRenderer, translate("gui.de.energyStorageCore.name", gui.tile.tier.toString()), gui.guiLeft + (gui.xSize / 2), gui.guiTop + 5, InfoHelper.GUI_TITLE); int stabColour = gui.tile.stabilizersOK.value ? 0x00FF00 : 0xFF0000; - String stabText = I18n.format("gui.de.stabilizers.txt") + ": " + (gui.tile.stabilizersOK.value ? I18n.format("gui.de.valid.txt") : I18n.format("gui.de.invalid.txt")); + String stabText = translate("gui.de.stabilizers.txt") + ": " + (gui.tile.stabilizersOK.value ? translate("gui.de.valid.txt") : translate("gui.de.invalid.txt")); GuiHelper.drawCenteredString(fontRenderer, stabText, gui.guiLeft + gui.xSize / 2, gui.guiTop + 18, stabColour, gui.tile.stabilizersOK.value); if (gui.tile.tier.value >= 5) { - GuiHelper.drawCenteredString(fontRenderer, I18n.format("gui.de.advancedStabilizersRequired.txt"), gui.guiLeft + gui.xSize / 2, gui.guiTop + 28, 0x777777, false); + GuiHelper.drawCenteredString(fontRenderer, translate("gui.de.advancedStabilizersRequired.txt"), gui.guiLeft + gui.xSize / 2, gui.guiTop + 28, 0x777777, false); } int coreColour = gui.tile.coreValid.value ? 0x00FF00 : 0xFF0000; - String coreText = I18n.format("gui.de.core.txt") + ": " + (gui.tile.coreValid.value ? I18n.format("gui.de.valid.txt") : I18n.format("gui.de.invalid.txt")); + String coreText = translate("gui.de.core.txt") + ": " + (gui.tile.coreValid.value ? translate("gui.de.valid.txt") : translate("gui.de.invalid.txt")); GuiHelper.drawCenteredString(fontRenderer, coreText, gui.guiLeft + gui.xSize / 2, gui.guiTop + 36, coreColour, gui.tile.coreValid.value); if (!gui.tile.coreValid.value) { var pos = improvedTile.getExpectedBlockPos(); - GuiHelper.drawCenteredSplitString(fontRenderer, I18n.format("ecore.gui.invalid_block.txt", pos.x, pos.y, pos.z, improvedTile.getExpectedBlockString()), gui.guiLeft + gui.xSize / 2, gui.guiTop + 46, 150, coreColour, false); + GuiHelper.drawCenteredSplitString(fontRenderer, translate("ecore.gui.invalid_block.txt", pos.x, pos.y, pos.z, improvedTile.getExpectedBlockString()), gui.guiLeft + gui.xSize / 2, gui.guiTop + 46, 150, coreColour, false); } } } diff --git a/src/main/java/com/nomiceu/nomilabs/integration/jei/JEIPlugin.java b/src/main/java/com/nomiceu/nomilabs/integration/jei/JEIPlugin.java index e740b65e..68e752d4 100644 --- a/src/main/java/com/nomiceu/nomilabs/integration/jei/JEIPlugin.java +++ b/src/main/java/com/nomiceu/nomilabs/integration/jei/JEIPlugin.java @@ -1,7 +1,7 @@ package com.nomiceu.nomilabs.integration.jei; -import com.cleanroommc.groovyscript.compat.mods.jei.ShapedRecipeWrapper; import com.nomiceu.nomilabs.groovy.PartialRecipe; +import com.nomiceu.nomilabs.util.ItemTagMeta; import mezz.jei.api.IModPlugin; import mezz.jei.api.IModRegistry; import mezz.jei.api.ingredients.VanillaTypes; @@ -16,19 +16,32 @@ @SuppressWarnings("unused") public class JEIPlugin implements IModPlugin { private static final Map DESCRIPTIONS = new HashMap<>(); + private static final Map RECIPE_OUTPUT_TOOLTIPS = new HashMap<>(); + + private static IModRegistry registry; + @Override public void register(IModRegistry registry) { + JEIPlugin.registry = registry; var jeiHelpers = registry.getJeiHelpers(); // JEI does not recognise Custom Recipe Classes on its own - // Uses the shaped recipe wrapper from GroovyScript - registry.handleRecipes(PartialRecipe.class, recipe -> new ShapedRecipeWrapper(jeiHelpers, recipe), VanillaRecipeCategoryUid.CRAFTING); + registry.handleRecipes(PartialRecipe.class, recipe -> new PartialRecipeWrapper(jeiHelpers, recipe), VanillaRecipeCategoryUid.CRAFTING); // Add Descriptions - DESCRIPTIONS.forEach(((itemStack, strings) -> registry.addIngredientInfo(itemStack, VanillaTypes.ITEM, strings))); + DESCRIPTIONS.forEach(((itemStack, strings) -> + registry.addIngredientInfo(itemStack, VanillaTypes.ITEM, String.join("\n\n", strings)))); } public static void addDescription(@NotNull ItemStack stack, String... description) { DESCRIPTIONS.put(stack, description); } + + public static void addRecipeOutputTooltip(@NotNull ItemStack stack, String... tooltip) { + RECIPE_OUTPUT_TOOLTIPS.put(new ItemTagMeta(stack), tooltip); + } + + public static Map getRecipeOutputTooltips() { + return RECIPE_OUTPUT_TOOLTIPS; + } } diff --git a/src/main/java/com/nomiceu/nomilabs/integration/jei/PartialRecipeWrapper.java b/src/main/java/com/nomiceu/nomilabs/integration/jei/PartialRecipeWrapper.java new file mode 100644 index 00000000..e3d4d3f9 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/integration/jei/PartialRecipeWrapper.java @@ -0,0 +1,26 @@ +package com.nomiceu.nomilabs.integration.jei; + +import com.cleanroommc.groovyscript.compat.mods.jei.ShapedRecipeWrapper; +import com.nomiceu.nomilabs.groovy.PartialRecipe; +import mezz.jei.api.IJeiHelpers; +import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper; +import mezz.jei.plugins.vanilla.crafting.ShapelessRecipeWrapper; + +/** + * Straight from {@link ShapedRecipeWrapper} + */ +public class PartialRecipeWrapper extends ShapelessRecipeWrapper implements IShapedCraftingRecipeWrapper { + public PartialRecipeWrapper(IJeiHelpers jeiHelpers, PartialRecipe recipe) { + super(jeiHelpers, recipe); + } + + @Override + public int getWidth() { + return recipe.getRecipeWidth(); + } + + @Override + public int getHeight() { + return recipe.getRecipeHeight(); + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/item/ItemBase.java b/src/main/java/com/nomiceu/nomilabs/item/ItemBase.java index b174ed3d..9a7b8111 100644 --- a/src/main/java/com/nomiceu/nomilabs/item/ItemBase.java +++ b/src/main/java/com/nomiceu/nomilabs/item/ItemBase.java @@ -1,7 +1,5 @@ package com.nomiceu.nomilabs.item; -import com.google.common.collect.ImmutableList; -import com.nomiceu.nomilabs.tooltip.LabsTooltipHelper; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumRarity; @@ -15,19 +13,20 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Arrays; import java.util.List; public class ItemBase extends Item { private IRarity rarity; - private List description; + private String[] description; public ItemBase(ResourceLocation rl, CreativeTabs tab) { - initialise(rl, tab, EnumRarity.COMMON, 64, ImmutableList.of()); + initialise(rl, tab, EnumRarity.COMMON, 64); } public ItemBase(ResourceLocation rl, CreativeTabs tab, @NotNull IRarity rarity) { - initialise(rl, tab, rarity, 64, ImmutableList.of()); + initialise(rl, tab, rarity, 64); } public ItemBase(ResourceLocation rl, CreativeTabs tab, @NotNull IRarity rarity, int stackSize) { - initialise(rl, tab, rarity, stackSize, ImmutableList.of()); + initialise(rl, tab, rarity, stackSize); } /** * Makes an item. @@ -35,13 +34,13 @@ public ItemBase(ResourceLocation rl, CreativeTabs tab, @NotNull IRarity rarity, * @param tab Creative Tab * @param rarity Rarity * @param stackSize Max Stack Size - * @param description Description. Map of translation keys to formatting keys. Is of string to string so we can use GTFormatCodes + * @param description Description. Localized. */ - public ItemBase(ResourceLocation rl, CreativeTabs tab, @NotNull IRarity rarity, int stackSize, List description) { + public ItemBase(ResourceLocation rl, CreativeTabs tab, @NotNull IRarity rarity, int stackSize, String... description) { initialise(rl, tab, rarity, stackSize, description); } - private void initialise(ResourceLocation rl, CreativeTabs tab, @NotNull IRarity rarity, int stackSize, List description) { + private void initialise(ResourceLocation rl, CreativeTabs tab, @NotNull IRarity rarity, int stackSize, String... description) { setRegistryName(rl); setCreativeTab(tab); setRarity(rarity); @@ -54,17 +53,14 @@ public void setRarity(@NotNull IRarity rarity) { } @Override - public @NotNull IRarity getForgeRarity(@NotNull ItemStack stack) { + @NotNull + public IRarity getForgeRarity(@NotNull ItemStack stack) { return rarity; } - /** - * I18n formatting is done here instead of in constructor as I18n is client only - */ @Override @SideOnly(Side.CLIENT) public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { - for (var text : description) - tooltip.add(text.getFormattedString()); + tooltip.addAll(Arrays.asList(description)); } } diff --git a/src/main/java/com/nomiceu/nomilabs/item/ItemCapacitor.java b/src/main/java/com/nomiceu/nomilabs/item/ItemCapacitor.java index 225e23dd..8c72a158 100644 --- a/src/main/java/com/nomiceu/nomilabs/item/ItemCapacitor.java +++ b/src/main/java/com/nomiceu/nomilabs/item/ItemCapacitor.java @@ -6,7 +6,6 @@ import crazypants.enderio.api.capacitor.ICapacitorData; import crazypants.enderio.api.capacitor.ICapacitorKey; import crazypants.enderio.base.lang.Lang; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -23,6 +22,8 @@ import java.util.List; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + public class ItemCapacitor extends Item { public final LabsCapacitorData data; public ItemCapacitor(ResourceLocation rl, CreativeTabs tab, LabsCapacitorData data) { @@ -36,7 +37,7 @@ public ItemCapacitor(ResourceLocation rl, CreativeTabs tab, LabsCapacitorData da @Optional.Method(modid = LabsValues.ENDER_IO_MODID) public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); - tooltip.add(I18n.format("tooltip.nomilabs.capacitors.description")); // Not using default here. This one adds `EnderIO`, making it clearer + tooltip.add(translate("tooltip.nomilabs.capacitors.description")); // Not using default here. This one adds `EnderIO`, making it clearer // Add default info if (SpecialTooltipHandler.showAdvancedTooltips()) SpecialTooltipHandler.addDetailedTooltipFromResources(tooltip, Lang.MACHINE_UPGRADE.getKey()); @@ -98,7 +99,7 @@ public String getUnlocalizedName() { @NotNull @Override public String getLocalizedName() { - return I18n.format(LabsValues.LABS_MODID + "." + name); + return translate(LabsValues.LABS_MODID + "." + name); } } } diff --git a/src/main/java/com/nomiceu/nomilabs/item/ItemExcitationCoil.java b/src/main/java/com/nomiceu/nomilabs/item/ItemExcitationCoil.java index bc9dd1e6..f8570ce4 100644 --- a/src/main/java/com/nomiceu/nomilabs/item/ItemExcitationCoil.java +++ b/src/main/java/com/nomiceu/nomilabs/item/ItemExcitationCoil.java @@ -2,8 +2,8 @@ import com.nomiceu.nomilabs.block.registry.LabsBlocks; import com.nomiceu.nomilabs.tooltip.LabsTooltipHelper; +import gregtech.client.utils.TooltipHelper; import net.minecraft.block.Block; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -12,17 +12,17 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import gregtech.client.utils.TooltipHelper; import java.util.List; import java.util.Objects; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + public class ItemExcitationCoil extends ItemBlock { public ItemExcitationCoil(Block block) { @@ -55,12 +55,12 @@ public void onUpdate(@NotNull ItemStack stack, @NotNull World world, @NotNull En @Override @SideOnly(Side.CLIENT) public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { - tooltip.add(TextFormatting.GRAY + I18n.format("tooltip.nomilabs.excitationcoil.description_item")); + tooltip.add(translate("tooltip.nomilabs.excitationcoil.description")); if (LabsTooltipHelper.isShiftDown()) { - tooltip.add(TextFormatting.GRAY+ I18n.format("tooltip.nomilabs.excitationcoil.placeable")); - tooltip.add(TextFormatting.GRAY + I18n.format("tooltip.nomilabs.excitationcoil.wearable")); - tooltip.add(TooltipHelper.RAINBOW_SLOW + I18n.format("tooltip.nomilabs.excitationcoil.night_vision")); + tooltip.add(translate("tooltip.nomilabs.excitationcoil.placeable")); + tooltip.add(translate("tooltip.nomilabs.excitationcoil.wearable")); + tooltip.add(translateFormat("tooltip.nomilabs.excitationcoil.night_vision", TooltipHelper.RAINBOW_SLOW)); } else - tooltip.add(TooltipHelper.BLINKING_ORANGE + I18n.format("tooltip.nomilabs.general.press_shift_for_usages")); + tooltip.add(translateFormat("tooltip.nomilabs.general.press_shift_for_usages", TooltipHelper.BLINKING_ORANGE)); } } diff --git a/src/main/java/com/nomiceu/nomilabs/item/ItemHandFramingTool.java b/src/main/java/com/nomiceu/nomilabs/item/ItemHandFramingTool.java index 946a2256..ce5fad7d 100644 --- a/src/main/java/com/nomiceu/nomilabs/item/ItemHandFramingTool.java +++ b/src/main/java/com/nomiceu/nomilabs/item/ItemHandFramingTool.java @@ -15,7 +15,6 @@ import eutros.framedcompactdrawers.registry.ModBlocks; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -37,6 +36,8 @@ import java.util.List; import java.util.Objects; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + @Optional.Interface(iface = "com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IFrameable", modid = LabsValues.STORAGE_DRAWERS_MODID) public class ItemHandFramingTool extends Item implements IFrameable { public static final String MAT_SIDE_TAG = "MatS"; @@ -58,7 +59,7 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @N NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null || getItemStackFromKey(tagCompound, MAT_SIDE_TAG).isEmpty()){ - tooltip.add(I18n.format("tooltip.nomilabs.hand_framing_tool.not_set")); + tooltip.add(translate("tooltip.nomilabs.hand_framing_tool.not_set")); return; } @@ -72,7 +73,7 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @N @SideOnly(Side.CLIENT) private void addTooltipItem(@NotNull List tooltip, String translationKey, ItemStack stack) { - tooltip.add(I18n.format(translationKey, stack.isEmpty() ? "-" : stack.getDisplayName())); + tooltip.add(translate(translationKey, stack.isEmpty() ? "-" : stack.getDisplayName())); } @Override @@ -286,12 +287,11 @@ private static NBTTagCompound getMaterialTag(@Nonnull ItemStack stack) { public void addDescription() { JEIPlugin.addDescription(new ItemStack(this), - "item.nomilabs.hand_framing_tool.desc1", - "item.nomilabs.hand_framing_tool.desc2", - "item.nomilabs.hand_framing_tool.desc3", - "item.nomilabs.hand_framing_tool.desc4", - "item.nomilabs.hand_framing_tool.desc5", - "item.nomilabs.hand_framing_tool.desc6", - "item.nomilabs.hand_framing_tool.desc7"); + translate("item.nomilabs.hand_framing_tool.desc1"), + translate("item.nomilabs.hand_framing_tool.desc2"), + translate("item.nomilabs.hand_framing_tool.desc3"), + translate("item.nomilabs.hand_framing_tool.desc4"), + translate("item.nomilabs.hand_framing_tool.desc5"), + translate("item.nomilabs.hand_framing_tool.desc6")); } } \ No newline at end of file diff --git a/src/main/java/com/nomiceu/nomilabs/item/registry/register/LabsEndgame.java b/src/main/java/com/nomiceu/nomilabs/item/registry/register/LabsEndgame.java index 49f4535b..3a0a6b19 100644 --- a/src/main/java/com/nomiceu/nomilabs/item/registry/register/LabsEndgame.java +++ b/src/main/java/com/nomiceu/nomilabs/item/registry/register/LabsEndgame.java @@ -1,14 +1,12 @@ package com.nomiceu.nomilabs.item.registry.register; -import com.google.common.collect.ImmutableList; import com.nomiceu.nomilabs.creativetab.registry.LabsCreativeTabs; import com.nomiceu.nomilabs.item.ItemBase; import net.minecraft.item.EnumRarity; -import net.minecraft.util.text.TextFormatting; import static com.nomiceu.nomilabs.util.LabsNames.makeLabsName; import static com.nomiceu.nomilabs.item.registry.LabsItems.*; -import static com.nomiceu.nomilabs.tooltip.LabsTooltipHelper.Tooltip; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; public class LabsEndgame { public static void initEndgame() { @@ -16,8 +14,8 @@ public static void initEndgame() { CREATIVE_TANK_MOLD = createItem(new ItemBase(makeLabsName("creativeportabletankmold"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 1)); EXOTIC_MATERIALS_CATALYST = createItem(new ItemBase(makeLabsName("exoticmaterialscatalyst"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.RARE)); ETERNAL_CATALYST = createItem(new ItemBase(makeLabsName("eternalcatalyst"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 64, - ImmutableList.of(Tooltip.of("tooltip.nomilabs.eternalcatalyst.description").withFormat(TextFormatting.DARK_GRAY)))); + translate("tooltip.nomilabs.eternalcatalyst.description"))); ULTIMATE_GEM = createItem(new ItemBase(makeLabsName("ultimate_gem"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 1, - ImmutableList.of(Tooltip.of("tooltip.nomilabs.ultimate_items.description").withFormat(TextFormatting.GRAY)))); + translate("tooltip.nomilabs.general.crafting_component"))); } } diff --git a/src/main/java/com/nomiceu/nomilabs/item/registry/register/LabsMicroMiners.java b/src/main/java/com/nomiceu/nomilabs/item/registry/register/LabsMicroMiners.java index 34eec2af..78680efe 100644 --- a/src/main/java/com/nomiceu/nomilabs/item/registry/register/LabsMicroMiners.java +++ b/src/main/java/com/nomiceu/nomilabs/item/registry/register/LabsMicroMiners.java @@ -1,16 +1,12 @@ package com.nomiceu.nomilabs.item.registry.register; -import com.google.common.collect.ImmutableList; import com.nomiceu.nomilabs.creativetab.registry.LabsCreativeTabs; import com.nomiceu.nomilabs.item.ItemBase; import net.minecraft.item.EnumRarity; -import net.minecraft.util.text.TextFormatting; -import java.util.List; - -import static com.nomiceu.nomilabs.util.LabsNames.makeLabsName; import static com.nomiceu.nomilabs.item.registry.LabsItems.*; -import static com.nomiceu.nomilabs.tooltip.LabsTooltipHelper.Tooltip; +import static com.nomiceu.nomilabs.util.LabsNames.makeLabsName; +import static com.nomiceu.nomilabs.util.LabsTranslate.translate; public class LabsMicroMiners { public static void initMicroMinerItems() { @@ -18,7 +14,7 @@ public static void initMicroMinerItems() { GEM_SENSOR = createItem(new ItemBase(makeLabsName("gemsensor"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC)); WARP_ENGINE = createItem(new ItemBase(makeLabsName("warpengine"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC)); UNIVERSAL_NAVIGATOR = createItem(new ItemBase(makeLabsName("universalnavigator"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 64, - ImmutableList.of(Tooltip.of("tooltip.nomilabs.universalnavigator.description").withFormat(TextFormatting.BLUE)))); + translate("tooltip.nomilabs.universalnavigator.description"))); QUANTUM_FLUXED_ETERNIUM_PLATING = createItem(new ItemBase(makeLabsName("quantumfluxedeterniumplating"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC)); T1_GUIDANCE = createItem(new ItemBase(makeLabsName("t1guidance"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.UNCOMMON)); T2_GUIDANCE = createItem(new ItemBase(makeLabsName("t2guidance"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.RARE)); @@ -29,93 +25,83 @@ public static void initMicroMinerItems() { public static void initMicroMiners() { T1_SHIP = createItem(new ItemBase(makeLabsName("tieroneship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.UNCOMMON, 16, - formatMicroMinerDesc("tooltip.nomilabs.tieroneship.description"))); + translate("tooltip.nomilabs.tieroneship.description"))); T2_SHIP = createItem(new ItemBase(makeLabsName("tiertwoship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.UNCOMMON, 16, - formatMicroMinerDesc("tooltip.nomilabs.tiertwoship.description"))); + translate("tooltip.nomilabs.tiertwoship.description"))); T3_SHIP = createItem(new ItemBase(makeLabsName("tierthreeship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.UNCOMMON, 16, - formatMicroMinerDesc("tooltip.nomilabs.tierthreeship.description"))); + translate("tooltip.nomilabs.tierthreeship.description"))); T4_SHIP = createItem(new ItemBase(makeLabsName("tierfourship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.UNCOMMON, 16, - formatMicroMinerDesc("tooltip.nomilabs.tierfourship.description"))); + translate("tooltip.nomilabs.tierfourship.description"))); T4_HALF_SHIP = createItem(new ItemBase(makeLabsName("tierfourandhalfship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.UNCOMMON, 16, - formatMicroMinerDesc("tooltip.nomilabs.tierfourandhalfship.description"))); + translate("tooltip.nomilabs.tierfourandhalfship.description"))); T5_SHIP = createItem(new ItemBase(makeLabsName("tierfiveship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.RARE, 16, - formatMicroMinerDesc("tooltip.nomilabs.tierfiveship.description"))); + translate("tooltip.nomilabs.tierfiveship.description"))); T6_SHIP = createItem(new ItemBase(makeLabsName("tiersixship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.RARE, 16, - formatMicroMinerDesc("tooltip.nomilabs.tiersixship.description"))); + translate("tooltip.nomilabs.tiersixship.description"))); T7_SHIP = createItem(new ItemBase(makeLabsName("tiersevenship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.RARE, 16, - formatMicroMinerDesc("tooltip.nomilabs.tiersevenship.description"))); + translate("tooltip.nomilabs.tiersevenship.description"))); T8_SHIP = createItem(new ItemBase(makeLabsName("tiereightship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatMicroMinerDesc("tooltip.nomilabs.tiereightship.description"))); + translate("tooltip.nomilabs.tiereightship.description"))); T8_HALF_SHIP = createItem(new ItemBase(makeLabsName("tiereightandhalfship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatMicroMinerDesc("tooltip.nomilabs.tiereightandhalfship.description"))); + translate("tooltip.nomilabs.tiereightandhalfship.description"))); T9_SHIP = createItem(new ItemBase(makeLabsName("tiernineship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatMicroMinerDesc("tooltip.nomilabs.tiernineship.description"))); + translate("tooltip.nomilabs.tiernineship.description"))); T10_SHIP = createItem(new ItemBase(makeLabsName("tiertenship"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - ImmutableList.of(Tooltip.of("tooltip.nomilabs.tiertenship.description1").withFormat(getFormat()), - Tooltip.of("tooltip.nomilabs.tiertenship.description2").withFormat(getFormat())))); + translate("tooltip.nomilabs.tiertenship.description1"), + translate("tooltip.nomilabs.tiertenship.description2"))); } public static void initStabilizedMicroMiners() { T1_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tieroneship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); T2_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tiertwoship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); T3_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tierthreeship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); T4_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tierfourship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); T4_HALF_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tierfourandhalfship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); T5_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tierfiveship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); T6_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tiersixship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); T7_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tiersevenship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); T8_STABILIZED_SHIP = createItem(new ItemBase(makeLabsName("tiereightship_stabilized"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMinerDesc())); + getStabilizedMinerDesc())); } public static void initStabilizedMatter() { T1_STABILIZED_MATTER= createItem(new ItemBase(makeLabsName("tieroneship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); + getStabilizedMatterDesc())); T2_STABILIZED_MATTER = createItem(new ItemBase(makeLabsName("tiertwoship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); + getStabilizedMatterDesc())); T3_STABILIZED_MATTER = createItem(new ItemBase(makeLabsName("tierthreeship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); + getStabilizedMatterDesc())); T4_STABILIZED_MATTER = createItem(new ItemBase(makeLabsName("tierfourship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); + getStabilizedMatterDesc())); T4_HALF_STABILIZED_MATTER = createItem(new ItemBase(makeLabsName("tierfourandhalfship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); + getStabilizedMatterDesc())); T5_STABILIZED_MATTER = createItem(new ItemBase(makeLabsName("tierfiveship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); + getStabilizedMatterDesc())); T6_STABILIZED_MATTER = createItem(new ItemBase(makeLabsName("tiersixship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); + getStabilizedMatterDesc())); T7_STABILIZED_MATTER = createItem(new ItemBase(makeLabsName("tiersevenship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); + getStabilizedMatterDesc())); T8_STABILIZED_MATTER = createItem(new ItemBase(makeLabsName("tiereightship_stabilized_matter"), LabsCreativeTabs.TAB_NOMI_LABS, EnumRarity.EPIC, 16, - formatStabilizedMatterDesc())); - } - - private static List formatMicroMinerDesc(String key) { - return ImmutableList.of(Tooltip.of(key).withFormat(getFormat())); - } - - private static List formatStabilizedMinerDesc() { - return ImmutableList.of( - Tooltip.of("tooltip.stabilized_miners.description1").withFormat(getFormat()), - Tooltip.of("tooltip.stabilized_miners.description2").withFormat(getFormat()), - Tooltip.of("tooltip.stabilized_miners.description3").withFormat(getFormat()) - ); + getStabilizedMatterDesc())); } - private static List formatStabilizedMatterDesc() { - return ImmutableList.of( - Tooltip.of("tooltip.stabilized_matters.description").withFormat(getFormat()) - ); + private static String[] getStabilizedMinerDesc() { + return new String[] { + translate("tooltip.stabilized_miners.description1"), + translate("tooltip.stabilized_miners.description2"), + translate("tooltip.stabilized_miners.description3") + }; } - private static String getFormat() { - return "" + TextFormatting.WHITE + TextFormatting.ITALIC; + private static String getStabilizedMatterDesc() { + return translate("tooltip.stabilized_matters.description"); } } diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/WorldLoadHandler.java b/src/main/java/com/nomiceu/nomilabs/mixin/WorldLoadHandler.java index daf8fe84..803871aa 100644 --- a/src/main/java/com/nomiceu/nomilabs/mixin/WorldLoadHandler.java +++ b/src/main/java/com/nomiceu/nomilabs/mixin/WorldLoadHandler.java @@ -3,13 +3,12 @@ import com.nomiceu.nomilabs.LabsValues; import com.nomiceu.nomilabs.config.LabsConfig; import com.nomiceu.nomilabs.remap.datafixer.DataFixerHandler; +import com.nomiceu.nomilabs.util.LabsSide; import net.minecraft.util.datafix.DataFixer; import net.minecraft.world.storage.SaveFormatOld; import net.minecraft.world.storage.SaveHandler; import net.minecraft.world.storage.WorldInfo; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.relauncher.Side; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -23,7 +22,7 @@ public class WorldLoadHandler { @Inject(method = "loadAndFix(Ljava/io/File;Lnet/minecraft/util/datafix/DataFixer;Lnet/minecraft/world/storage/SaveHandler;)Lnet/minecraft/world/storage/WorldInfo;", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/nbt/CompressedStreamTools;readCompressed(Ljava/io/InputStream;)Lnet/minecraft/nbt/NBTTagCompound;", remap = true), remap = false, require = 1) private static void loadDataFixers(File file, DataFixer fixer, SaveHandler save, CallbackInfoReturnable cir) { - if (FMLCommonHandler.instance().getEffectiveSide() != Side.SERVER) + if (!LabsSide.isServer()) return; DataFixerHandler.onWorldLoad(save); diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/draconicevolution/GuiEnergyCoreMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/draconicevolution/GuiEnergyCoreMixin.java index 45cd699b..410ed75c 100644 --- a/src/main/java/com/nomiceu/nomilabs/mixin/draconicevolution/GuiEnergyCoreMixin.java +++ b/src/main/java/com/nomiceu/nomilabs/mixin/draconicevolution/GuiEnergyCoreMixin.java @@ -6,7 +6,6 @@ import com.nomiceu.nomilabs.integration.draconicevolution.ImprovedTileEnergyCore; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; import net.minecraft.inventory.Container; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -15,6 +14,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + // TODO maybe one day improve the GUI, so you can destruct button at any time, and it isn't as crowded with buttons disappearing // Perhaps inspire by GT's? /** @@ -54,7 +55,7 @@ public GuiEnergyCoreMixin(Container inventorySlotsIn) { public void initGui(CallbackInfo ci) { destructCore = GuiEnergyCoreLogic.addDestructButtonToList(this, buttonList); // Change default display string of assemble core - assembleCore.displayString = I18n.format("button.de.assembleCore.instant.txt"); + assembleCore.displayString = translate("button.de.assembleCore.instant.txt"); } @Inject(method = "drawGuiContainerBackgroundLayer(FII)V", at = @At("HEAD"), cancellable = true, remap = true) @@ -81,22 +82,22 @@ private void updateButtonStates(CallbackInfo ci) { assembleCore.enabled = !improvedTile.hasActiveDestructor(); if (DraconicHelpers.instantBuilder()) - assembleCore.displayString = I18n.format("button.de.assembleCore.instant.txt"); + assembleCore.displayString = translate("button.de.assembleCore.instant.txt"); else { if (improvedTile.hasActiveBuilder()) - assembleCore.displayString = I18n.format("button.de.assembleCore.stop.txt"); + assembleCore.displayString = translate("button.de.assembleCore.stop.txt"); else - assembleCore.displayString = I18n.format("button.de.assembleCore.start.txt"); + assembleCore.displayString = translate("button.de.assembleCore.start.txt"); } destructCore.enabled = !improvedTile.hasActiveBuilder(); if (DraconicHelpers.instantDestructor()) - destructCore.displayString = I18n.format("button.de.destructCore.instant.txt"); + destructCore.displayString = translate("button.de.destructCore.instant.txt"); else { if (improvedTile.hasActiveDestructor()) - destructCore.displayString = I18n.format("button.de.destructCore.stop.txt"); + destructCore.displayString = translate("button.de.destructCore.stop.txt"); else - destructCore.displayString = I18n.format("button.de.destructCore.start.txt"); + destructCore.displayString = translate("button.de.destructCore.start.txt"); } } diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/jei/CraftingRecipeCategoryMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/jei/CraftingRecipeCategoryMixin.java new file mode 100644 index 00000000..6bf3b91f --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/mixin/jei/CraftingRecipeCategoryMixin.java @@ -0,0 +1,32 @@ +package com.nomiceu.nomilabs.mixin.jei; + +import com.nomiceu.nomilabs.integration.jei.JEIPlugin; +import com.nomiceu.nomilabs.util.ItemTagMeta; +import mezz.jei.plugins.vanilla.crafting.CraftingRecipeCategory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.FMLCommonHandler; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.Arrays; +import java.util.List; + +@Mixin(value = CraftingRecipeCategory.class, remap = false) +public class CraftingRecipeCategoryMixin { + @Shadow + @Final + private static int craftOutputSlot; + + @Inject(method = "lambda$setRecipe$0", at = @At("HEAD")) + private static void addRecipeOutputTooltip(ResourceLocation registryName, int slotIndex, boolean input, ItemStack ingredient, List tooltip, CallbackInfo ci) { + if (FMLCommonHandler.instance().getEffectiveSide().isServer() || slotIndex != craftOutputSlot) return; + var itemTagMeta = new ItemTagMeta(ingredient); + if (!JEIPlugin.getRecipeOutputTooltips().containsKey(itemTagMeta)) return; + tooltip.addAll(Arrays.asList(JEIPlugin.getRecipeOutputTooltips().get(itemTagMeta))); + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/remap/LabsMessageHelper.java b/src/main/java/com/nomiceu/nomilabs/remap/LabsMessageHelper.java index 0df900fe..91018d49 100644 --- a/src/main/java/com/nomiceu/nomilabs/remap/LabsMessageHelper.java +++ b/src/main/java/com/nomiceu/nomilabs/remap/LabsMessageHelper.java @@ -1,46 +1,15 @@ package com.nomiceu.nomilabs.remap; -import net.minecraft.client.resources.I18n; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.StartupQuery; -import java.util.Arrays; +import static com.nomiceu.nomilabs.util.LabsTranslate.format; +import static com.nomiceu.nomilabs.util.LabsTranslate.translateWithBackup; public class LabsMessageHelper { - /** - * Send Message. If Type is Confirm, and user presses no, Startup will abort. - * @param type Type of Message - * @param texts Texts, which will be joined together. - */ - public static void sendTranslatableMessage(MessageType type, Translatable[] texts) { - var backup = Arrays.stream(texts).map((text) -> text.backup).toArray(String[]::new); - var joiners = Arrays.stream(texts).map((text) -> text.joiner).toArray(String[]::new); + public static void sendMessage(MessageType type, String[] message) { + var finalMessage = String.join("\n\n", message); - // If is dedicated server, I18n definitely doesn't exist - // Just use backup strings. - if (FMLCommonHandler.instance().getSide().isServer()) sendMessage(backup, joiners, type); - - // Try Translating - try { - Class.forName("net.minecraft.client.resources.I18n"); // Try to get I18n Class - // Exists, use it! - var translated = Arrays.stream(texts) - .map((text) -> I18n.format(text.key, text.substitutions)) - .toArray(String[]::new); - sendMessage(translated, joiners, type); - } catch (ClassNotFoundException e) { - // I18n not found, use backup - sendMessage(backup, joiners, type); - } - } - - private static void sendMessage(String[] message, String[] joiners, MessageType type) { - // Loop do this for all elements except for last - for (int i = 0; i < message.length - 1; i++) - message[i] = message[i].concat(joiners[i]); - - var finalMessage = String.join("", message); switch (type) { case NOTIFY -> StartupQuery.notify(finalMessage); case CONFIRM -> { @@ -54,83 +23,51 @@ public enum MessageType { CONFIRM } - public static class Translatable { - public final String backup; - public final String key; - public final Object[] substitutions; - /** - * What will be appended to the next translatable obj. - */ - public String joiner = "\n\n"; - - public Translatable(String backup, String key) { - this.backup = backup; - this.key = key; - this.substitutions = new Object[0]; - } - public Translatable(String backup, String key, Object... substitutions) { - this.backup = backup; - this.key = key; - this.substitutions = substitutions; - } - public Translatable setJoiner(String joiner) { - this.joiner = joiner; - return this; - } - } - // Don't forget to update this in en_us.lang as well! public static class Components { - public static Translatable[] getIntro() { - return new Translatable[] { - new Translatable("This world must be remapped.", "nomilabs.fixer.intro.1"), - new Translatable(TextFormatting.BOLD + "A Backup will be made.", "nomilabs.fixer.intro.2") - .setJoiner("\n"), - new Translatable("Pressing 'No' will cancel world loading.", "nomilabs.fixer.intro.3"), - new Translatable(TextFormatting.RED + "Note that after the world is loaded with this, you CANNOT undo this!.", - "nomilabs.fixer.intro.4").setJoiner("\n"), - new Translatable(String.format("You %sWILL%s have to load from the backup in order to load in a previous version!", - TextFormatting.UNDERLINE, TextFormatting.RESET), - "nomilabs.fixer.intro.5"), + public static String[] getIntro() { + return new String[] { + translateWithBackup("nomilabs.fixer.intro.1", "This world must be remapped."), + translateWithBackup("nomilabs.fixer.intro.2", format("A Backup will be made.", TextFormatting.BOLD)), + translateWithBackup("nomilabs.fixer.intro.3", "Pressing 'No' will cancel world loading."), + translateWithBackup("nomilabs.fixer.intro.4", + format("Note that after the world is loaded with this, you CANNOT undo this!.", TextFormatting.RED)), + translateWithBackup("nomilabs.fixer.intro.5", + String.format("You %s have to load from the backup in order to load in a previous version!", + format("WILL", TextFormatting.UNDERLINE))) }; } - public static Translatable[] getIntroAddition() { - return new Translatable[] { - new Translatable(TextFormatting.GRAY + "The changes that must be made via Data Fixers have been printed to your log.", - "nomilabs.fixer.intro.6") + public static String[] getIntroAddition() { + return new String[] { + translateWithBackup("nomilabs.fixer.intro.6", + format("The changes that must be made via Data Fixers have been printed to your log.", + TextFormatting.GRAY)) }; } - public static Translatable[] getModeCheck(String mode) { - return new Translatable[] { - new Translatable( + public static String[] getModeCheck(String mode) { + return new String[] { + translateWithBackup("nomilabs.fixer.mode_check.1", String.format("Are you sure you previously loaded this world with the pack mode '%s' ?", - TextFormatting.YELLOW + mode + TextFormatting.RESET), - "nomilabs.fixer.mode_check.1", - mode), - new Translatable( - String.format(TextFormatting.RED + "Launching with the wrong mode %sWILL%s void items and/or blocks!", - TextFormatting.UNDERLINE, TextFormatting.RESET), - "nomilabs.fixer.mode_check.2" - ), - new Translatable( - TextFormatting.GRAY + "If you did not change it in your old instance, the default mode is 'Normal'.", - "nomilabs.fixer.mode_check.3" - ), - new Translatable( - "Press 'No' if you are not sure! (It will cancel world loading)", - "nomilabs.fixer.mode_check.4" - ) + format(mode, TextFormatting.YELLOW)), mode), + translateWithBackup("nomilabs.fixer.mode_check.2", + format(String.format("Launching with the wrong mode %s void items and/or blocks!", + format("WILL", TextFormatting.UNDERLINE) + TextFormatting.RED), + TextFormatting.RED)), + translateWithBackup("nomilabs.fixer.mode_check.3", + format("If you did not change it in your old instance, the default mode is 'Normal'.", TextFormatting.GRAY)), + translateWithBackup("nomilabs.fixer.mode_check.4", + "Press 'No' if you are not sure! (It will cancel world loading)") }; } - public static Translatable[] getDoNotExit() { - return new Translatable[] { - new Translatable(TextFormatting.RED + "Do not interrupt the loading process!", - "nomilabs.fixer.do_not_exit.1"), - new Translatable("If interrupted, load again from the backup, as your world may be corrupted!", - "nomilabs.fixer.do_not_exit.2") + public static String[] getDoNotExit() { + return new String[] { + translateWithBackup("nomilabs.fixer.do_not_exit.1", + format("Do not interrupt the loading process!", TextFormatting.RED)), + translateWithBackup("nomilabs.fixer.do_not_exit.2", + "If interrupted, load again from the backup, as your world may be corrupted!") }; } } diff --git a/src/main/java/com/nomiceu/nomilabs/remap/LabsRemappers.java b/src/main/java/com/nomiceu/nomilabs/remap/LabsRemappers.java index 4d3e2c55..ed4e1c59 100644 --- a/src/main/java/com/nomiceu/nomilabs/remap/LabsRemappers.java +++ b/src/main/java/com/nomiceu/nomilabs/remap/LabsRemappers.java @@ -21,7 +21,7 @@ import java.util.regex.PatternSyntaxException; import static com.nomiceu.nomilabs.LabsValues.*; -import static com.nomiceu.nomilabs.remap.LabsMessageHelper.sendTranslatableMessage; +import static com.nomiceu.nomilabs.remap.LabsMessageHelper.sendMessage; import static com.nomiceu.nomilabs.remap.Remapper.RemapTypes; public class LabsRemappers { @@ -199,7 +199,7 @@ public static > void remapAndIgnoreEntries(Regi // Check with user if (!checked && !DataFixerHandler.checked) { - sendTranslatableMessage( + sendMessage( LabsMessageHelper.MessageType.CONFIRM, LabsMessageHelper.Components.getIntro() ); diff --git a/src/main/java/com/nomiceu/nomilabs/remap/datafixer/DataFixerHandler.java b/src/main/java/com/nomiceu/nomilabs/remap/datafixer/DataFixerHandler.java index 72a24fbd..55ff34b5 100644 --- a/src/main/java/com/nomiceu/nomilabs/remap/datafixer/DataFixerHandler.java +++ b/src/main/java/com/nomiceu/nomilabs/remap/datafixer/DataFixerHandler.java @@ -112,19 +112,19 @@ public static void onWorldLoad(SaveHandler save) { return; } - sendTranslatableMessage( + sendMessage( MessageType.CONFIRM, Arrays.concat(Components.getIntro(), Components.getIntroAddition()) ); if (modeNeeded) { - sendTranslatableMessage( + sendMessage( MessageType.CONFIRM, Components.getModeCheck(StringUtils.capitalize(PMConfig.getPackMode())) ); } - sendTranslatableMessage( + sendMessage( MessageType.NOTIFY, Components.getDoNotExit() ); diff --git a/src/main/java/com/nomiceu/nomilabs/tooltip/LabsTooltipHelper.java b/src/main/java/com/nomiceu/nomilabs/tooltip/LabsTooltipHelper.java index 1031f201..04a7c1f2 100644 --- a/src/main/java/com/nomiceu/nomilabs/tooltip/LabsTooltipHelper.java +++ b/src/main/java/com/nomiceu/nomilabs/tooltip/LabsTooltipHelper.java @@ -1,14 +1,8 @@ package com.nomiceu.nomilabs.tooltip; import mcjty.theoneprobe.api.IProbeInfo; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.input.Keyboard; -import javax.annotation.Nullable; - @SuppressWarnings("unused") public class LabsTooltipHelper { public static boolean isShiftDown() { @@ -19,86 +13,7 @@ public static boolean isCtrlDown() { return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); } - public static class Tooltip { - protected static final String defaultFormat = TextFormatting.WHITE.toString(); - - protected final String key; - protected final Object[] params; - protected String format; - protected String topFormat; - protected boolean noTop; - - protected Tooltip(String key, Object[] params) { - this.key = key; - this.params = params; - this.noTop = false; - } - - /** - * Makes a tooltip with the given translation key, with the specified params to input in {@link I18n#format(String, Object...)} with the default formatting (white). - */ - public static Tooltip of(String key, Object... params) { - return new Tooltip(key, params); - } - - /** - * Specifies a format to use. Also sets the TOP Formatting if it is not already set. If this is not specified, defaults to {@link LabsTooltipHelper.Tooltip#defaultFormat}. - */ - public Tooltip withFormat(TextFormatting format) { - this.format = format.toString(); - if (topFormat == null) topFormat = format.toString(); - return this; - } - - /** - * Specifies a format to use. Also sets the TOP Formatting if it is not already set. If this is not specified, defaults to {@link LabsTooltipHelper.Tooltip#defaultFormat}. - */ - public Tooltip withFormat(String format) { - this.format = format; - if (topFormat == null) topFormat = format; - return this; - } - - /** - * Specifies a TOP format to use. If this is not specified, defaults to specified formatting. - */ - public Tooltip withTopFormat(TextFormatting topFormat) { - this.topFormat = topFormat.toString(); - return this; - } - - /** - * Specifies a TOP format to use. If this is not specified, defaults to specified formatting. - */ - public Tooltip withTopFormat(String topFormat) { - this.topFormat = topFormat; - return this; - } - - /** - * Makes this not have a TOP message. - */ - public Tooltip withoutTOP() { - noTop = true; - return this; - } - - /** - * Gets the Formatted String, for use in Tooltips. - */ - @SideOnly(Side.CLIENT) - public String getFormattedString() { - return (format == null ? defaultFormat : format) + I18n.format(key, params) + TextFormatting.RESET; - } - - /** - * Gets the Formatted String, for use in TOP. Returns null if this message should not be displayed on TOP. - */ - @SideOnly(Side.CLIENT) - @Nullable - public String getTOPFormattedString() { - if (noTop) return null; - return (topFormat == null ? defaultFormat : topFormat) + IProbeInfo.STARTLOC + I18n.format(key, params) + IProbeInfo.ENDLOC + TextFormatting.RESET; - } + public static String getTOPFormat(String str) { + return IProbeInfo.STARTLOC + str + IProbeInfo.ENDLOC; } } diff --git a/src/main/java/com/nomiceu/nomilabs/tooltip/TooltipAdder.java b/src/main/java/com/nomiceu/nomilabs/tooltip/TooltipAdder.java index 0bc678da..a7f1898d 100644 --- a/src/main/java/com/nomiceu/nomilabs/tooltip/TooltipAdder.java +++ b/src/main/java/com/nomiceu/nomilabs/tooltip/TooltipAdder.java @@ -5,9 +5,7 @@ import com.nomiceu.nomilabs.config.LabsConfig; import crazypants.enderio.api.capacitor.CapabilityCapacitorData; import crazypants.enderio.base.capacitor.CapacitorKey; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.relauncher.Side; @@ -18,6 +16,8 @@ import java.util.List; import java.util.Objects; +import static com.nomiceu.nomilabs.util.LabsTranslate.*; + @SideOnly(Side.CLIENT) public class TooltipAdder { public static void addTooltipNormal(List tooltip, ItemStack stack) { @@ -38,7 +38,7 @@ private static void addTooltipEIO(List tooltip, ItemStack stack) { formatter.setRoundingMode(RoundingMode.HALF_UP); // Rounds up if in the middle (.5), else rounds to nearest // No clue what to use as the capacitor key, using NO_POWER, common declarations, in EnderIO and Nomi-Labs, don't use that parameter anyway - tooltip.add(TextFormatting.DARK_PURPLE + I18n.format("tooltip.nomilabs.capacitors.level", formatter.format(level))); + tooltip.add(translate("tooltip.nomilabs.capacitors.level", formatter.format(level))); } } } diff --git a/src/main/java/com/nomiceu/nomilabs/util/ItemMeta.java b/src/main/java/com/nomiceu/nomilabs/util/ItemMeta.java index 73684ef2..10fbd7dd 100644 --- a/src/main/java/com/nomiceu/nomilabs/util/ItemMeta.java +++ b/src/main/java/com/nomiceu/nomilabs/util/ItemMeta.java @@ -1,10 +1,36 @@ package com.nomiceu.nomilabs.util; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import java.util.Objects; + +/** + * Util class to compare ItemStacks based on Item and Meta. + */ +@SuppressWarnings("unused") public class ItemMeta { + private final Item item; + private final int meta; + + public ItemMeta(ItemStack stack) { + item = stack.getItem(); + meta = stack.getMetadata(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ItemMeta itemMeta)) return false; + return item.equals(itemMeta.item) && meta == itemMeta.meta; + } + + @Override + public int hashCode() { + return Objects.hash(item, meta); + } + /** - * Returns true if itemstacks are equal. Compares item & meta. + * Compares ItemStacks based on Item and Meta. */ public static boolean compare(ItemStack a, ItemStack b) { return a.getItem().equals(b.getItem()) && a.getMetadata() == b.getMetadata(); diff --git a/src/main/java/com/nomiceu/nomilabs/util/ItemTagMeta.java b/src/main/java/com/nomiceu/nomilabs/util/ItemTagMeta.java new file mode 100644 index 00000000..8e22a5d4 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/util/ItemTagMeta.java @@ -0,0 +1,37 @@ +package com.nomiceu.nomilabs.util; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.Objects; + +/** + * Util class to compare ItemStacks based on Item, Tag and Meta. + */ +@SuppressWarnings("unused") +public class ItemTagMeta extends ItemMeta { + private final NBTTagCompound tag; + + public ItemTagMeta(ItemStack stack) { + super(stack); + tag = stack.getTagCompound(); + } + + @Override + public boolean equals(Object obj) { + if (!super.equals(obj) || !(obj instanceof ItemTagMeta itemTagMeta)) return false; + return Objects.equals(tag, itemTagMeta.tag); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), tag); + } + + /** + * Compares ItemStacks based on Item, Tag and Meta. + */ + public static boolean compare(ItemStack a, ItemStack b) { + return ItemMeta.compare(a, b) && Objects.equals(a.getTagCompound(), b.getTagCompound()); + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/util/LabsSide.java b/src/main/java/com/nomiceu/nomilabs/util/LabsSide.java new file mode 100644 index 00000000..4b4b39ed --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/util/LabsSide.java @@ -0,0 +1,17 @@ +package com.nomiceu.nomilabs.util; + +import net.minecraftforge.fml.common.FMLCommonHandler; + +public class LabsSide { + public static boolean isClient() { + return FMLCommonHandler.instance().getEffectiveSide().isClient(); + } + + public static boolean isServer() { + return FMLCommonHandler.instance().getEffectiveSide().isServer(); + } + + public static boolean isDedicatedServer() { + return FMLCommonHandler.instance().getSide().isServer(); + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/util/LabsTranslate.java b/src/main/java/com/nomiceu/nomilabs/util/LabsTranslate.java new file mode 100644 index 00000000..c8d383a7 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/util/LabsTranslate.java @@ -0,0 +1,66 @@ +package com.nomiceu.nomilabs.util; + +import gregtech.client.utils.TooltipHelper; +import net.minecraft.util.text.TextFormatting; + +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; + +@SuppressWarnings("unused") +public class LabsTranslate { + public static String translate(String key, Object... params) { + return translateWithBackup(key, key, params); + } + + public static String translateWithBackup(String key, String backup, Object... params) { + if (LabsSide.isDedicatedServer()) return backup; // I18n is not available on Dedicated Servers + // Try Translating Indirectly + try { + return (String) Class.forName("net.minecraft.client.resources.I18n") + .getMethod("format", String.class, Object[].class) + .invoke(null, key, params); + } catch (ClassNotFoundException | NoSuchMethodException + | InvocationTargetException | IllegalAccessException | ClassCastException e) { + return backup; + } + } + + // Only GT Format Code version is available. + // If need Text Formatting format, place it in lang. + + public static String translateFormat(String key, TooltipHelper.GTFormatCode format, Object... params) { + return format(translate(key, params), format); + } + + public static String translateWithBackupFormat(String key, String backup, TooltipHelper.GTFormatCode format, Object... params) { + return format(translateWithBackup(key, backup, params), format); + } + + public static String format(String str, TextFormatting... formats) { + return String.join("", Arrays.stream(formats).map(TextFormatting::toString).toArray(String[]::new)) + + str + TextFormatting.RESET; + } + + public static String format(String str, TooltipHelper.GTFormatCode... formats) { + return String.join("", Arrays.stream(formats).map(TooltipHelper.GTFormatCode::toString).toArray(String[]::new)) + + str + TextFormatting.RESET; + } + + public static String format(String str, Format... formats) { + return String.join("", Arrays.stream(formats).map((format) -> format.format).toArray(String[]::new)) + + str + TextFormatting.RESET; + } + + public static class Format { + public final String format; + private Format(String format) { + this.format = format; + } + public Format of(TextFormatting format) { + return new Format(format.toString()); + } + public Format of(TooltipHelper.GTFormatCode format) { + return new Format(format.toString()); + } + } +} diff --git a/src/main/resources/assets/nomilabs/lang/en_us.lang b/src/main/resources/assets/nomilabs/lang/en_us.lang index 68a6d91e..bc17a519 100644 --- a/src/main/resources/assets/nomilabs/lang/en_us.lang +++ b/src/main/resources/assets/nomilabs/lang/en_us.lang @@ -67,15 +67,15 @@ fluid.moltendarksoularium=Molten Dark Soularium # Data Fixers # Don't forget to update this in LabsMessageHelper.Components as well! nomilabs.fixer.intro.1=This world must be remapped. -nomilabs.fixer.intro.2=§lA Backup will be made. +nomilabs.fixer.intro.2=§lA Backup will be made.§r nomilabs.fixer.intro.3=Pressing 'No' will cancel world loading. -nomilabs.fixer.intro.4=§cNote that after the world is loaded with this, you CANNOT undo this!. +nomilabs.fixer.intro.4=§cNote that after the world is loaded with this, you CANNOT undo this!.§r nomilabs.fixer.intro.5=You §nWILL§r have to load from the backup in order to load in a previous version! -nomilabs.fixer.intro.6=§7The changes that must be made via Data Fixers have been printed to your log. +nomilabs.fixer.intro.6=§7The changes that must be made via Data Fixers have been printed to your log.§r nomilabs.fixer.mode_check.1=Are you sure you previously loaded this world with the pack mode '§e%s§r' ? nomilabs.fixer.mode_check.2=Launching with the wrong mode §nWILL§r void items and/or blocks! -nomilabs.fixer.mode_check.3=§7If you did not change it in your old instance, the default mode is 'Normal'. +nomilabs.fixer.mode_check.3=§7If you did not change it in your old instance, the default mode is 'Normal'.§r nomilabs.fixer.mode_check.4=Press 'No' if you are not sure! (It will cancel world loading) nomilabs.fixer.do_not_exit.1=§cDo not interrupt the loading process!§r @@ -415,13 +415,12 @@ item.nomilabs.dark_red_coal.name=Dark Red Coal item.nomilabs.hand_framing_tool.name=Hand Framing Tool -item.nomilabs.hand_framing_tool.desc1=Frame your tools by hand! -item.nomilabs.hand_framing_tool.desc2=The Hand Framing Tool lets you frame drawers already placed in the world. -item.nomilabs.hand_framing_tool.desc3=To do this, the tool itself needs to be framed in a crafting table or a framing table. -item.nomilabs.hand_framing_tool.desc4=If you wish to frame the tool in a crafting table, see the item's crafting table recipes in JEI. +item.nomilabs.hand_framing_tool.desc1=Frame your Drawers by Hand! +item.nomilabs.hand_framing_tool.desc2=The §5Hand Framing Tool§r lets you frame drawers already placed in the world. +item.nomilabs.hand_framing_tool.desc3=To do this, the tool itself needs to be framed in a §3Crafting Table§r or a §3Framing Table§r. +item.nomilabs.hand_framing_tool.desc4=If you wish to frame the tool in a Crafting Table, see the item's crafting table recipes in §8JEI§r. item.nomilabs.hand_framing_tool.desc5=Then, once the tool is framed, right clicking any drawers in-world will frame them. -item.nomilabs.hand_framing_tool.desc6=When right clicking any wood-type drawers in world, they will be turned into framed drawers. -item.nomilabs.hand_framing_tool.desc7=The frames/decorations will also be applied to them. +item.nomilabs.hand_framing_tool.desc6=When right clicking any wood-type drawers in world, they will also be turned into framed drawers. item.nomilabs.pulsatingdust.name=Pulsating Dust item.nomilabs.pulsatingmesh.name=Pulsating Mesh @@ -459,12 +458,12 @@ tooltip.nomilabs.general.press_shift_for_usages=Press [Shift] for More Usages. tooltip.nomilabs.general.press_ctrl_for_usages=Press [Ctrl] for More Usages. tooltip.nomilabs.general.press_shift_for_info=Press [Shift] for More Info. tooltip.nomilabs.general.press_ctrl_for_info=Press [Ctrl] for More Info. +tooltip.nomilabs.general.crafting_component=§7Crafting Component Only.§r # Items -tooltip.nomilabs.excitationcoil.description_block=Crafting Component Only. -tooltip.nomilabs.excitationcoil.description_item=Crafting Component Only... Except: -tooltip.nomilabs.excitationcoil.placeable=Placeable! -tooltip.nomilabs.excitationcoil.wearable=Wearable on your head! +tooltip.nomilabs.excitationcoil.description=§7Crafting Component Only... Except:§r +tooltip.nomilabs.excitationcoil.placeable=§7Placeable!§r +tooltip.nomilabs.excitationcoil.wearable=§7Wearable on your head!§r tooltip.nomilabs.excitationcoil.night_vision=Gives Night Vision when worn! tooltip.nomilabs.hand_framing_tool.not_set=Put this tool in a Framing Table or a Crafting Table to set its Framing Data! @@ -472,45 +471,43 @@ tooltip.nomilabs.hand_framing_tool.side=Side: %s tooltip.nomilabs.hand_framing_tool.trim=Trim: %s tooltip.nomilabs.hand_framing_tool.front=Front: %s -tooltip.nomilabs.ultimate_items.description=Crafting Component Only. +tooltip.nomilabs.universalnavigator.description=§9See you later, navigator!§r -tooltip.nomilabs.universalnavigator.description=See you later, navigator! +tooltip.nomilabs.eternalcatalyst.description=§8Gaze into the Abyss...§r -tooltip.nomilabs.eternalcatalyst.description=Gaze into the Abyss... +tooltip.nomilabs.tieroneship.description=§f§oHarvests Titanium and other light metals from asteroids in the microverse.§r +tooltip.nomilabs.tiertwoship.description=§f§oHarvests Tungsten and other heavy metals from asteroids in the microverse.§r +tooltip.nomilabs.tierthreeship.description=§f§oHarvests ultra hot metals and gems from Nether microverses.§r +tooltip.nomilabs.tierfourship.description=§f§oHarvests ultra cold materials from the deepest parts of empty space.§r +tooltip.nomilabs.tierfourandhalfship.description=§f§oKills mobs in dangerous microverses and collects their highly prized skeletons and parts.§r +tooltip.nomilabs.tierfiveship.description=§f§oHarvests strange materials from End microverses.§r +tooltip.nomilabs.tiersixship.description=§f§oHarvests extremely rare materials from every concievable reality.§r +tooltip.nomilabs.tiersevenship.description=§f§oHunts Wyrms and End Dragons from the microverse and returns with parts from their carapaces.§r +tooltip.nomilabs.tiereightship.description=§f§oHunts inconcievable monstrosities from beyond the End and returns with bizzare trinkets.§r +tooltip.nomilabs.tiereightandhalfship.description=§f§oHarvests exclusive Gems and Metals from unexplored corners, from beyond the microverse.§r +tooltip.nomilabs.tiernineship.description=§f§oCollapses microversian stars and harvests their delicious neutronium cores.§r +tooltip.nomilabs.tiertenship.description1=§f§oCollapses an entire microverse and harvests it whole.§r +tooltip.nomilabs.tiertenship.description2=§f§oTry to aim for uninhabited ones.§r -tooltip.nomilabs.tieroneship.description=Harvests Titanium and other light metals from asteroids in the microverse. -tooltip.nomilabs.tiertwoship.description=Harvests Tungsten and other heavy metals from asteroids in the microverse. -tooltip.nomilabs.tierthreeship.description=Harvests ultra hot metals and gems from Nether microverses. -tooltip.nomilabs.tierfourship.description=Harvests ultra cold materials from the deepest parts of empty space. -tooltip.nomilabs.tierfourandhalfship.description=Kills mobs in dangerous microverses and collects their highly prized skeletons and parts. -tooltip.nomilabs.tierfiveship.description=Harvests strange materials from End microverses. -tooltip.nomilabs.tiersixship.description=Harvests extremely rare materials from every concievable reality. -tooltip.nomilabs.tiersevenship.description=Hunts Wyrms and End Dragons from the microverse and returns with parts from their carapaces. -tooltip.nomilabs.tiereightship.description=Hunts inconcievable monstrosities from beyond the End and returns with bizzare trinkets. -tooltip.nomilabs.tiereightandhalfship.description=Harvests exclusive Gems and Metals from unexplored corners, from beyond the microverse. -tooltip.nomilabs.tiernineship.description=Collapses microversian stars and harvests their delicious neutronium cores. -tooltip.nomilabs.tiertenship.description1=Collapses an entire microverse and harvests it whole. -tooltip.nomilabs.tiertenship.description2=Try to aim for uninhabited ones. +tooltip.stabilized_miners.description1=§f§oA stabilized version, injected with a Heart of a Universe.§r +tooltip.stabilized_miners.description2=§f§oLasts indefinitely. Reusable. Totally not overpowered.§r +tooltip.stabilized_miners.description3=§f§oIt looks oddly familiar.§r -tooltip.stabilized_miners.description1=A stabilized version, injected with a Heart of a Universe. -tooltip.stabilized_miners.description2=Lasts indefinitely. Reusable. Totally not overpowered. -tooltip.stabilized_miners.description3=It looks oddly familiar. - -tooltip.stabilized_matters.description=An infinite and incomprehensible abyss of materials. +tooltip.stabilized_matters.description=§f§oAn infinite and incomprehensible abyss of materials.§r tooltip.nomilabs.capacitors.description=Ender IO Machine Upgrade -tooltip.nomilabs.capacitors.level=Level: %s +tooltip.nomilabs.capacitors.level=§5Level: %s§r # Multiblocks -tooltip.nomilabs.microverse_projector_1.description=A machine capable of stabilizing projection into microverses for basic micro miner missions. -tooltip.nomilabs.microverse_projector_2.description=An advanced machine capable of stabilizing projection into microverses for complex missions into the deepest parts of space. -tooltip.nomilabs.microverse_projector_3.description=An elite machine capable of stabilizing projection into microverses for exotic missions, including collapsing the microverse whole. -tooltip.nomilabs.creative_tank_provider.description=A complex machine capable of turning buckets and molds into infinite resovoirs beyond human comprehension. -tooltip.nomilabs.naquadah_reactor_1.description=An advanced reactor that produces energy from the decay of Enriched Naquadah and Naquadria bolts. -tooltip.nomilabs.naquadah_reactor_2.description=An elite reactor capable of capturing more energy from the decay of Enriched Naquadah and Naquadria bolts. -tooltip.nomilabs.naquadah_reactor.produces=Produces exactly %s amps of %s. +tooltip.nomilabs.microverse_projector_1.description=§8A machine capable of stabilizing projection into microverses for basic micro miner missions.§r +tooltip.nomilabs.microverse_projector_2.description=§8An advanced machine capable of stabilizing projection into microverses for complex missions into the deepest parts of space.§r +tooltip.nomilabs.microverse_projector_3.description=§8An elite machine capable of stabilizing projection into microverses for exotic missions, including collapsing the microverse whole.§r +tooltip.nomilabs.creative_tank_provider.description=§8A complex machine capable of turning buckets and molds into infinite resovoirs beyond human comprehension.§r +tooltip.nomilabs.naquadah_reactor_1.description=§8An advanced reactor that produces energy from the decay of Enriched Naquadah and Naquadria bolts.§r +tooltip.nomilabs.naquadah_reactor_2.description=§8An elite reactor capable of capturing more energy from the decay of Enriched Naquadah and Naquadria bolts.§r +tooltip.nomilabs.naquadah_reactor.produces=§fProduces exactly %s amps of %s.§r tooltip.nomilabs.naquadah_reactor.overclock=Does not overclock! -tooltip.nomilabs.actualization_chamber.description=A powerful machine that harnesses the most complex of matters and turns it into raw materials. -tooltip.nomilabs.universal_crystallizer.description=An immense device, capable of turning raw materials into complex matters. -tooltip.nomilabs.dme_sim_chamber.description=A high powered simulation device, capable of performing more complex simulations faster than ever. -tooltip.nomilabs.greenhouse.description=A high powered growing chamber, capable of mass-growing even the most incomprehensible plants. +tooltip.nomilabs.actualization_chamber.description=§8A powerful machine that harnesses the most complex of matters and turns it into raw materials.§r +tooltip.nomilabs.universal_crystallizer.description=§8An immense device, capable of turning raw materials into complex matters.§r +tooltip.nomilabs.dme_sim_chamber.description=§8A high powered simulation device, capable of performing more complex simulations faster than ever.§r +tooltip.nomilabs.greenhouse.description=§8A high powered growing chamber, capable of mass-growing even the most incomprehensible plants.§r diff --git a/src/main/resources/mixins.nomilabs.jei.json b/src/main/resources/mixins.nomilabs.jei.json new file mode 100644 index 00000000..a0beaab6 --- /dev/null +++ b/src/main/resources/mixins.nomilabs.jei.json @@ -0,0 +1,12 @@ +{ + "package": "com.nomiceu.nomilabs.mixin.jei", + "refmap": "mixins.nomilabs.refmap.json", + "target": "@env(DEFAULT)", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "CraftingRecipeCategoryMixin" + ], + "client": [], + "server": [] +}