diff --git a/build.gradle b/build.gradle index a747a67..7e952f8 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'org.parchmentmc.librarian.forgegradle' version '1.+' } -version = '1.19.2-1.2.1' +version = "${project.minecraft_version}-${project.version}" group = 'com.christofmeg.${mod_name}' archivesBaseName = 'ic2cuumatter' @@ -66,28 +66,34 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.19.2-43.2.0' - - // CURSEMAVEN - // IC2 CLASSIC - if (project.hasProperty('ic2_version')) { - implementation fg.deobf("curse.maven:ic2_classic-242942:${ic2_version}") - } - + minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}" + + // IC2 CLASSIC + if (project.hasProperty('ic2_version')) { + implementation fg.deobf("curse.maven:ic2_classic-242942:${ic2_version}") + } // JEI if (project.hasProperty('jei_version')) { compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")) compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")) runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")) } - // CONFIGURED - if (project.hasProperty('configured_version')) { - implementation fg.deobf("curse.maven:configured-457570:${configured_version}") - } // CATALOGUE if (project.hasProperty('catalogue_version')) { implementation fg.deobf("curse.maven:catalogue-459701:${catalogue_version}") } + // REI + if (project.hasProperty('rei_version')) { + compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:11.+")) + compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:11.+")) + + implementation fg.deobf("curse.maven:roughly-enough-items-310111:${rei_version}") + + runtimeOnly fg.deobf("curse.maven:roughly-enough-items-hacks-521393:${rei_hacks_version}") + runtimeOnly fg.deobf("curse.maven:cloth-config-348521:${cloth_config_version}") + runtimeOnly fg.deobf("curse.maven:architectury-api-419699:${architectury_version}") + } + } diff --git a/gradle.properties b/gradle.properties index c79758f..cfcc403 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,13 +3,24 @@ org.gradle.daemon=false minecraft_version = 1.19.2 parchment_version = 2022.11.27 +forge_version = 43.2.0 -#IC2-Classic-1.19.2-2.0.5 -ic2_version = 4441313 +version = 1.2.2 + +#IC2-Classic-1.19.2-2.0.6.2 +ic2_version = 4563059 + +# JEI jei_version = 11.+ # Configured-1.19.2-2.1.1 https://www.curseforge.com/minecraft/mc-mods/configured configured_version = 4462837 # Catalogue-1.19-1.7.0 https://www.curseforge.com/minecraft/mc-mods/catalogue -catalogue_version = 4171024 \ No newline at end of file +catalogue_version = 4171024 + +# REI +#rei_version = 4647683 +rei_hacks_version = 4647810 +cloth_config_version = 4633416 +architectury_version = 4555749 \ No newline at end of file diff --git a/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/GuiClickableArea.java b/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/GuiClickableArea.java index b047bf6..10bfc1f 100644 --- a/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/GuiClickableArea.java +++ b/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/GuiClickableArea.java @@ -1,6 +1,5 @@ package com.christofmeg.ic2cuumatter.integration.jei; -import ic2.api.recipes.registries.IMachineRecipeList; import ic2.core.block.machines.components.hv.MassFabricatorComponent; import ic2.core.block.machines.containers.ev.PlasmafierContainer; import ic2.core.block.machines.containers.hv.MassFabricatorContainer; @@ -10,13 +9,12 @@ import ic2.core.utils.collection.CollectionUtils; import mezz.jei.api.gui.handlers.IGuiClickableArea; import mezz.jei.api.gui.handlers.IGuiContainerHandler; -import mezz.jei.api.recipe.RecipeType; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.List; -import java.util.Map; @OnlyIn(Dist.CLIENT) public class GuiClickableArea implements IGuiContainerHandler { @@ -24,10 +22,10 @@ public class GuiClickableArea implements IGuiContainerHandler { public GuiClickableArea() { } - public Collection getGuiClickableAreas(IC2Screen containerScreen, double mouseX, double mouseY) { + public @NotNull Collection getGuiClickableAreas(@NotNull IC2Screen containerScreen, double mouseX, double mouseY) { List areas = CollectionUtils.createList(); if (containerScreen instanceof ComponentContainerScreen) { - ContainerComponent comp = (ContainerComponent)containerScreen.getCastedContainer(ContainerComponent.class); + ContainerComponent comp = containerScreen.getCastedContainer(ContainerComponent.class); if (comp != null) { if (comp.getHolder() != null) { if (comp instanceof MassFabricatorContainer && comp.getComponent(MassFabricatorComponent.class) != null) { diff --git a/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/JEIPlugin.java b/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/JEIPlugin.java index c2706b3..0eb0788 100644 --- a/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/JEIPlugin.java +++ b/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/JEIPlugin.java @@ -9,26 +9,26 @@ import mezz.jei.api.JeiPlugin; import mezz.jei.api.registration.*; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; +import java.util.List; @JeiPlugin public class JEIPlugin implements IModPlugin { @Override - public ResourceLocation getPluginUid() { + public @NotNull ResourceLocation getPluginUid() { return new ResourceLocation("ic2cuumatter", "jei_plugin"); } @Override public void registerCategories(IRecipeCategoryRegistration registration) { registration.addRecipeCategories( - new MassFabricatorCategory(registration.getJeiHelpers().getGuiHelper(), MassFabricatorContainer.TEXTURE, - IC2Blocks.MASS_FABRICATOR), + new MassFabricatorCategory(registration.getJeiHelpers().getGuiHelper(), IC2Blocks.MASS_FABRICATOR), new PlasmafierCategory(registration.getJeiHelpers().getGuiHelper(), PlasmafierContainer.TEXTURE, IC2Blocks.PLASMAFIER)); } @@ -50,7 +50,7 @@ public void registerRecipes(IRecipeRegistration registration) { new ItemStack(IC2Items.UUMATTER), "100,000"))); registration.addRecipes(PlasmafierCategory.TYPE, - Arrays.asList( + List.of( new PlasmafierCategory.PlasmafierRecipe(Ingredient.of(new ItemStack(IC2Items.UUMATTER, 10)), Ingredient.of(IC2Items.CELL_EMPTY), new ItemStack(IC2Items.CELL_PLASMA)))); } diff --git a/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/MassFabricatorCategory.java b/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/MassFabricatorCategory.java index fb0b7e2..902878d 100644 --- a/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/MassFabricatorCategory.java +++ b/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/MassFabricatorCategory.java @@ -18,68 +18,86 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.ItemLike; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; public class MassFabricatorCategory implements IRecipeCategory { public static final RecipeType TYPE = new RecipeType<>( new ResourceLocation("ic2cuumatter", "mass_fabricator"), MassFabricatorRecipe.class); + public static final ResourceLocation slotVanilla = new ResourceLocation("jei", + "textures/gui/slot.png"); + public static final ResourceLocation guiVanilla = new ResourceLocation("jei", + "textures/gui/gui_vanilla.png"); + IDrawable background; IDrawable icon; + IDrawable slot; + IDrawable bigSlot; - public MassFabricatorCategory(IGuiHelper helper, ResourceLocation texture, ItemLike itemStack) { - background = helper.createDrawable(texture, 13, 14, 133, 69); + public MassFabricatorCategory(IGuiHelper helper, ItemLike itemStack) { + background = helper.createBlankDrawable(133, 69); icon = helper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(itemStack)); + slot = helper.drawableBuilder(slotVanilla, 0, 0, 18, 18).setTextureSize(18, 18).build(); + bigSlot = helper.drawableBuilder(guiVanilla, 90, 74, 26, 26).build(); } @Override - public RecipeType getRecipeType() { + public @NotNull RecipeType getRecipeType() { return TYPE; } @Override - public Component getTitle() { + public @NotNull Component getTitle() { return Component.translatable("block.ic2.mass_fabricator"); } @Override - public IDrawable getBackground() { + public @NotNull IDrawable getBackground() { return background; } @Override - public IDrawable getIcon() { + public @NotNull IDrawable getIcon() { return icon; } @Override public void setRecipe(IRecipeLayoutBuilder iRecipeLayoutBuilder, MassFabricatorRecipe recipe, - IFocusGroup iFocusGroup) { + @NotNull IFocusGroup iFocusGroup) { iRecipeLayoutBuilder.addSlot(RecipeIngredientRole.INPUT, 67, 42).addIngredients(recipe.item()); iRecipeLayoutBuilder.addSlot(RecipeIngredientRole.OUTPUT, 67, 5).addItemStack(recipe.output()); } - @SuppressWarnings("resource") @Override - public void draw(MassFabricatorRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, - double mouseY) { + public void draw(MassFabricatorRecipe recipe, @NotNull IRecipeSlotsView recipeSlotsView, @NotNull PoseStack stack, double mouseX, + double mouseY) { + + slot.draw(stack, 66, 41); + bigSlot.draw(stack, 62, 0); Font font = Minecraft.getInstance().font; - Component tierHV = Component.translatable("translation.ic2cuumatter.tier.hv"); + Component tier = Component.translatable("translation.ic2cuumatter.tier"); + Component HV = Component.translatable("translation.ic2cuumatter.tier.hv"); + Component tierHV = Component.translatable("translation.ic2cuumatter.format2", tier, HV); font.draw(stack, tierHV, 0.0F, 0.0F, 4210752); Component energy = Component.translatable("translation.ic2cuumatter.energy"); - font.draw(stack, energy, 0.0F, 52.0F, 4210752); + Component energyFormat = Component.translatable("translation.ic2cuumatter.format1", energy); + font.draw(stack, energyFormat, 0.0F, 52.0F, 4210752); font.draw(stack, Component.nullToEmpty("7,000,000 EU"), 0.0F, 62.0F, 4210752); font.draw(stack, Component.nullToEmpty("512 EU/p"), 88.0F, 62.0F, 4210752); - if (recipe.getEnergy() != "0") { + if (!Objects.equals(recipe.getEnergy(), "0")) { Component amplifier = Component.translatable("translation.ic2cuumatter.amplifier"); - font.draw(stack, amplifier, 90.0F, 20.0F, 4210752); - if (recipe.getEnergy() == "100,000") { + Component amplifierFormat = Component.translatable("translation.ic2cuumatter.format1", amplifier); + font.draw(stack, amplifierFormat, 90.0F, 20.0F, 4210752); + if (Objects.equals(recipe.getEnergy(), "100,000")) { font.draw(stack, Component.nullToEmpty("+ " + recipe.getEnergy()), 86.0F, 30.0F, 4210752); - } else if (recipe.getEnergy() == "45,000") { + } else if (Objects.equals(recipe.getEnergy(), "45,000")) { font.draw(stack, Component.nullToEmpty("+ " + recipe.getEnergy()), 92.0F, 30.0F, 4210752); } else { font.draw(stack, Component.nullToEmpty("+ " + recipe.getEnergy()), 98.0F, 30.0F, 4210752); diff --git a/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/PlasmafierCategory.java b/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/PlasmafierCategory.java index 09467f5..d56f414 100644 --- a/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/PlasmafierCategory.java +++ b/src/main/java/com/christofmeg/ic2cuumatter/integration/jei/PlasmafierCategory.java @@ -19,6 +19,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.ItemLike; +import org.jetbrains.annotations.NotNull; public class PlasmafierCategory implements IRecipeCategory { @@ -27,6 +28,9 @@ public class PlasmafierCategory implements IRecipeCategory getRecipeType() { + public @NotNull RecipeType getRecipeType() { return TYPE; } @Override - public Component getTitle() { + public @NotNull Component getTitle() { return Component.translatable("block.ic2.plasmafier"); } @Override - public IDrawable getBackground() { + public @NotNull IDrawable getBackground() { return background; } @Override - public IDrawable getIcon() { + public @NotNull IDrawable getIcon() { return icon; } @Override - public void setRecipe(IRecipeLayoutBuilder iRecipeLayoutBuilder, PlasmafierRecipe recipe, IFocusGroup iFocusGroup) { - iRecipeLayoutBuilder.addSlot(RecipeIngredientRole.INPUT, 31, 21).addIngredients(recipe.tool()); - iRecipeLayoutBuilder.addSlot(RecipeIngredientRole.INPUT, 103, 9).addIngredients(recipe.block()); - iRecipeLayoutBuilder.addSlot(RecipeIngredientRole.OUTPUT, 103, 31).addItemStack(recipe.output()); + public void setRecipe(IRecipeLayoutBuilder iRecipeLayoutBuilder, PlasmafierRecipe recipe, @NotNull IFocusGroup iFocusGroup) { + iRecipeLayoutBuilder.addSlot(RecipeIngredientRole.INPUT, input1X, input1Y).addIngredients(recipe.tool()); + iRecipeLayoutBuilder.addSlot(RecipeIngredientRole.INPUT, input2X, input2Y).addIngredients(recipe.block()); + iRecipeLayoutBuilder.addSlot(RecipeIngredientRole.OUTPUT, outputX, outputY).addItemStack(recipe.output()); } - @SuppressWarnings("resource") @Override - public void draw(PlasmafierRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, - double mouseY) { + public void draw(@NotNull PlasmafierRecipe recipe, @NotNull IRecipeSlotsView recipeSlotsView, @NotNull PoseStack stack, double mouseX, + double mouseY) { + slot.draw(stack, input1X - 1, input1Y - 1); + slot.draw(stack, input2X - 1, input2Y - 1); + slot.draw(stack, outputX - 1, outputY - 1); + + frame.draw(stack, 65, 1); + frameBottom.draw(stack, 66, 53); + frameTop.draw(stack, 66, 0); + press1.draw(stack, 69, 45); press2.draw(stack, 69, 46); press2.draw(stack, 69, 47); @@ -94,11 +122,14 @@ public void draw(PlasmafierRecipe recipe, IRecipeSlotsView recipeSlotsView, Pose glass.draw(stack, 68, 4); Font font = Minecraft.getInstance().font; - Component tierEV = Component.translatable("translation.ic2cuumatter.tier.ev"); + Component tier = Component.translatable("translation.ic2cuumatter.tier"); + Component EV = Component.translatable("translation.ic2cuumatter.tier.ev"); + Component tierEV = Component.translatable("translation.ic2cuumatter.format2", tier, EV); font.draw(stack, tierEV, 0.0F, 0.0F, 4210752); Component ticks = Component.translatable("translation.ic2cuumatter.ticks"); - font.draw(stack, ticks, 0.0F, 57.0F, 4210752); + Component ticksFormat = Component.translatable("translation.ic2cuumatter.format2", ticks, "2,500"); + font.draw(stack, ticksFormat, 0.0F, 57.0F, 4210752); font.draw(stack, Component.nullToEmpty("2,048 EU/p"), 79.0F, 57.0F, 4210752); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index a5d1925..c700bc6 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,10 +1,10 @@ modLoader="javafml" loaderVersion="[43,)" issueTrackerURL="https://github.com/Christofmeg/IC2C-UU-Matter/issues" #optional -license="MIT License https://github.com/Christofmeg/IC2C-UU-Matter/blob/1.19.2/LICENSE" +license="The MIT License (MIT)" [[mods]] modId="ic2cuumatter" -version="1.19.2-1.2.1" +version="${file.jarVersion}" displayName="IC2C UU-Matter" displayURL="https://github.com/Christofmeg/IC2C-UU-Matter" #optional logoFile="pack.png" @@ -33,7 +33,7 @@ Addon for IC2-Classic adding JEI pages for UU-Matter and Plasma Cell creation. side="BOTH" [[dependencies.ic2cuumatter]] modId="jei" - mandatory=true + mandatory=false versionRange="[11.4.0.287,)" ordering="NONE" side="BOTH" diff --git a/src/main/resources/assets/ic2cuumatter/lang/en_us.json b/src/main/resources/assets/ic2cuumatter/lang/en_us.json index 4f795dd..70b76e4 100644 --- a/src/main/resources/assets/ic2cuumatter/lang/en_us.json +++ b/src/main/resources/assets/ic2cuumatter/lang/en_us.json @@ -1,7 +1,10 @@ { - "translation.ic2cuumatter.amplifier": "Amplifier:", - "translation.ic2cuumatter.energy": "Energy:", - "translation.ic2cuumatter.tier.hv": "Tier: HV", - "translation.ic2cuumatter.tier.ev": "Tier: EV", - "translation.ic2cuumatter.ticks": "Ticks: 2,500" + "translation.ic2cuumatter.amplifier": "Amplifier", + "translation.ic2cuumatter.energy": "Energy", + "translation.ic2cuumatter.tier": "Tier", + "translation.ic2cuumatter.tier.hv": "HV", + "translation.ic2cuumatter.tier.ev": "EV", + "translation.ic2cuumatter.ticks": "Ticks", + "translation.ic2cuumatter.format1": "%s: ", + "translation.ic2cuumatter.format2": "%s: %s" } \ No newline at end of file diff --git a/src/main/resources/assets/ic2cuumatter/lang/no_no.json b/src/main/resources/assets/ic2cuumatter/lang/no_no.json index eb5ff5c..2767321 100644 --- a/src/main/resources/assets/ic2cuumatter/lang/no_no.json +++ b/src/main/resources/assets/ic2cuumatter/lang/no_no.json @@ -1,7 +1,10 @@ { - "translation.ic2cuumatter.amplifier": "Buffer:", - "translation.ic2cuumatter.energy": "Energi:", - "translation.ic2cuumatter.tier.hv": "Klasse: HV", - "translation.ic2cuumatter.tier.ev": "Klasse: EV", - "translation.ic2cuumatter.ticks": "Tikk: 2500" + "translation.ic2cuumatter.amplifier": "Buffer", + "translation.ic2cuumatter.energy": "Energi", + "translation.ic2cuumatter.tier": "Klasse", + "translation.ic2cuumatter.tier.hv": "HV", + "translation.ic2cuumatter.tier.ev": "EV", + "translation.ic2cuumatter.ticks": "Tikk", + "translation.ic2cuumatter.format1": "%s: ", + "translation.ic2cuumatter.format2": "%s: %s" } \ No newline at end of file