diff --git a/build.gradle b/build.gradle index 80c733a1..8ea7b057 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1707604215 +//version: 1707682661 /* * DO NOT CHANGE THIS FILE! * Also, you may replace this file at any time if there is an update available. @@ -24,9 +24,9 @@ plugins { id 'eclipse' id 'maven-publish' id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7' - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.28' - id 'net.darkhax.curseforgegradle' version '1.1.17' apply false - id 'com.modrinth.minotaur' version '2.8.6' apply false + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.33' + id 'net.darkhax.curseforgegradle' version '1.1.18' apply false + id 'com.modrinth.minotaur' version '2.8.7' apply false id 'com.diffplug.spotless' version '6.13.0' apply false id 'com.palantir.git-version' version '3.0.0' apply false id 'com.github.johnrengelman.shadow' version '8.1.1' apply false @@ -495,7 +495,7 @@ configurations { testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable) } -String mixinProviderSpec = 'zone.rong:mixinbooter:8.9' +String mixinProviderSpec = 'zone.rong:mixinbooter:9.1' dependencies { if (usesMixins.toBoolean()) { annotationProcessor 'org.ow2.asm:asm-debug-all:5.2' @@ -523,8 +523,8 @@ dependencies { } if (enableModernJavaSyntax.toBoolean()) { - annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' - compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { + annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.1' + compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.1') { transitive = false } // workaround for https://github.com/bsideup/jabel/issues/174 @@ -533,8 +533,8 @@ dependencies { patchedMinecraft 'me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0' // allow Jabel to work in tests - testAnnotationProcessor "com.github.bsideup.jabel:jabel-javac-plugin:1.0.0" - testCompileOnly("com.github.bsideup.jabel:jabel-javac-plugin:1.0.0") { + testAnnotationProcessor "com.github.bsideup.jabel:jabel-javac-plugin:1.0.1" + testCompileOnly("com.github.bsideup.jabel:jabel-javac-plugin:1.0.1") { transitive = false // We only care about the 1 annotation class } testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0" @@ -547,9 +547,13 @@ dependencies { } if (includeCommonDevEnvMods.toBoolean()) { - implementation 'mezz.jei:jei_1.12.2:4.16.1.302' - //noinspection DependencyNotationArgument - implementation rfg.deobf('curse.maven:top-245211:2667280') // TOP 1.4.28 + if (!(modId.equals('jei'))) { + implementation 'mezz.jei:jei_1.12.2:4.16.1.302' + } + if (!(modId.equals('theoneprobe'))) { + //noinspection DependencyNotationArgument + implementation rfg.deobf('curse.maven:top-245211:2667280') // TOP 1.4.28 + } } } diff --git a/dependencies.gradle b/dependencies.gradle index 024a659e..6dfee4a3 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,46 +1,65 @@ //file:noinspection DependencyNotationArgument // TODO remove when fixed in RFG ^ /* - * Add your dependencies here. Common configurations: - * - implementation("group:name:version:classifier"): if you need this for internal implementation details of the mod. - * Available at compiletime and runtime for your environment. - * - * - compileOnlyApi("g:n:v:c"): if you need this for internal implementation details of the mod. - * Available at compiletime but not runtime for your environment. - * + * Add your dependencies here. Supported configurations: + * - api("group:name:version:classifier"): if you use the types from this dependency in the public API of this mod + * Available at runtime and compiletime for mods depending on this mod + * - implementation("g:n:v:c"): if you need this for internal implementation details of the mod, but none of it is visible via the public API + * Available at runtime but not compiletime for mods depending on this mod + * - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods + * Not available at all for mods depending on this mod, only visible at compiletime for this mod + * - compileOnlyApi("g:n:v:c"): like compileOnly, but also visible at compiletime for mods depending on this mod + * Available at compiletime but not runtime for mods depending on this mod + * - runtimeOnlyNonPublishable("g:n:v:c"): if you want to include a mod in this mod's runClient/runServer runs, but not publish it as a dependency + * Not available at all for mods depending on this mod, only visible at runtime for this mod + * - devOnlyNonPublishable("g:n:v:c"): a combination of runtimeOnlyNonPublishable and compileOnly for dependencies present at both compiletime and runtime, + * but not published as Maven dependencies - useful for RFG-deobfuscated dependencies or local testing + * - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime + * Available at runtime for mods depending on this mod * - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry + * - testCONFIG("g:n:v:c") - replace CONFIG by one of the above (except api), same as above but for the test sources instead of main + * + * - shadowImplementation("g:n:v:c"): effectively the same as API, but the dependency is included in your jar under a renamed package name + * Requires you to enable usesShadowedDependencies in gradle.properties + * For more info, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/shadow.md * - * - testCONFIG("g:n:v:c"): replace CONFIG by one of the above, same as above but for the test sources instead of main + * You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed, + * but use this sparingly as it can break using your mod as another mod's dependency if you're not careful. * - * You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed. + * To depend on obfuscated jars you can use `devOnlyNonPublishable(rfg.deobf("dep:spec:1.2.3"))` to fetch an obfuscated jar from maven, + * or `devOnlyNonPublishable(rfg.deobf(project.files("libs/my-mod-jar.jar")))` to use a file. * * To add a mod with CurseMaven, replace '("g:n:v:c")' in the above with 'rfg.deobf("curse.maven:project_slug-project_id:file_id")' - * Example: implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4527757") + * Example: devOnlyNonPublishable(rfg.deobf("curse.maven:top-245211:2667280")) * - * To shadow a dependency, use 'shadowImplementation'. For more info, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/shadow.md + * Gradle names for some of the configuration can be misleading, compileOnlyApi and runtimeOnly both get published as dependencies in Maven, but compileOnly does not. + * The buildscript adds runtimeOnlyNonPublishable to also have a runtime dependency that's not published. * - * For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph + * For more details, see https://docs.gradle.org/8.4/userguide/java_library_plugin.html#sec:java_library_configurations_graph */ dependencies { /* -------------------------------- Hard Deps -------------------------------- */ - // CCL, CT dep for GT (from CurseForge) + // CCL, CT dep for GT (from GTCEu Maven) // Included to allow compiling of certain Draconic Evolution Mixin Classes, and as transitive deps - implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // Version 3.2.3.358 + implementation ("codechicken:codechickenlib:3.2.3.358") // Version 3.2.3.358 - // GT and GCYM, pretty much the 'core' of this coremod (from Modrinth) + // GT and GCYM, pretty much the 'core' of this coremod (from GTCEu Maven) // GT Has Mixins! CHECK MIXINS FOR COMPAT AFTER UPDATING! - implementation rfg.deobf("maven.modrinth:gregtech-ce-unofficial:VpJ9gePM") // Version 2.8.5 - implementation rfg.deobf("maven.modrinth:gregicality-multiblocks:4BnBEiBw") // Version 1.2.7 + implementation ("gregtech:gregtech:2.8.7-beta") { + transitive = false + } // Version 2.8.7 + implementation ("gregicality:GregicalityMultiblocks:1.2.8") { + transitive = false + } // Version 1.2.8 // Pack Mode (from CurseForge) implementation rfg.deobf("curse.maven:packmode-278398:2567799") // Version 1.2.0 // GroovyScript (from Cleanroom Maven) - // IF THIS IS UPDATED, THE GROOVYSCRIPT MIXIN MAY NEED TO BE REMOVED!!! - implementation ("com.cleanroommc:groovyscript:0.7.3") { + implementation ("com.cleanroommc:groovyscript:0.8.0") { transitive = false - } // Version 0.7.3, transitive false is needed otherwise groovy pulls in extra JEI + } // Version 0.8.0 /* -------------------------------- Compile Time Only Deps -------------------------------- */ diff --git a/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java b/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java index 05583186..d27bfa9d 100644 --- a/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java +++ b/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java @@ -26,8 +26,7 @@ public class LabsLateMixin implements ILateMixinLoader { new AbstractMap.SimpleImmutableEntry<>(LabsValues.GREGTECH_MODID, true), new AbstractMap.SimpleImmutableEntry<>(LabsValues.JEI_MODID, true), new AbstractMap.SimpleImmutableEntry<>(LabsValues.ROCKETRY_MODID, - LabsConfig.modIntegration.enableAdvancedRocketryIntegration), - new AbstractMap.SimpleImmutableEntry<>(LabsValues.GROOVY_MODID, true)) + LabsConfig.modIntegration.enableAdvancedRocketryIntegration)) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); @Override diff --git a/src/main/java/com/nomiceu/nomilabs/groovy/LabsVirtualizedRegistries.java b/src/main/java/com/nomiceu/nomilabs/groovy/LabsVirtualizedRegistries.java index 4b1122a3..c687ed15 100644 --- a/src/main/java/com/nomiceu/nomilabs/groovy/LabsVirtualizedRegistries.java +++ b/src/main/java/com/nomiceu/nomilabs/groovy/LabsVirtualizedRegistries.java @@ -3,9 +3,11 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; import com.nomiceu.nomilabs.integration.jei.JEIPlugin; +import com.nomiceu.nomilabs.util.ItemMeta; import com.nomiceu.nomilabs.util.ItemTagMeta; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.stack.ItemMaterialInfo; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.item.ItemStack; import org.apache.commons.lang3.tuple.Pair; @@ -41,13 +43,13 @@ public void changeMaterialDecomp(CompositionSpecification spec) { } } - public static class ReplaceRecyclingManager extends VirtualizedRegistry> { - public final Map needReloading = new HashMap<>(); + public static class ReplaceRecyclingManager extends VirtualizedRegistry> { + public final Map needReloading = new Object2ObjectOpenHashMap<>(); @Override public void onReload() { restoreFromBackup().forEach((pair) -> { - OreDictUnifier.registerOre(pair.getLeft(), pair.getRight()); + OreDictUnifier.registerOre(pair.getLeft().toStack(), pair.getRight()); needReloading.put(pair.getLeft(), pair.getRight()); }); } @@ -59,13 +61,14 @@ public void afterScriptLoad() { } @Override - protected boolean compareRecipe(Pair a, Pair b) { - return ItemTagMeta.compare(a.getKey(), b.getKey()); + protected boolean compareRecipe(Pair a, Pair b) { + return a.getKey().equals(b.getKey()); } public void registerOre(ItemStack stack, ItemMaterialInfo info) { - addBackup(Pair.of(stack, OreDictUnifier.getMaterialInfo(stack))); - needReloading.put(stack, info); + var in = new ItemTagMeta(stack); + addBackup(Pair.of(in, OreDictUnifier.getMaterialInfo(stack))); + needReloading.put(in, info); 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 226dfab2..4d51c591 100644 --- a/src/main/java/com/nomiceu/nomilabs/groovy/ReplaceRecipe.java +++ b/src/main/java/com/nomiceu/nomilabs/groovy/ReplaceRecipe.java @@ -52,13 +52,14 @@ public static void reloadRecyclingRecipes() { reloadingRecycling = true; var time = System.currentTimeMillis(); for (var modified : LabsVirtualizedRegistries.REPLACE_RECYCLING_MANAGER.needReloading.entrySet()) { - var stack = modified.getKey(); - NomiLabs.LOGGER.debug("Removing Recycling Recipes for {} @ {}...", stack.getItem().getRegistryName(), stack.getMetadata()); + var itemMeta = modified.getKey(); + var stack = itemMeta.toStack(); + NomiLabs.LOGGER.debug("Removing Recycling Recipes for {} @ {}...", itemMeta.getItem().getRegistryName(), itemMeta.getMeta()); removeRecyclingRecipe(RecipeMaps.ARC_FURNACE_RECIPES, RecipeCategories.ARC_FURNACE_RECYCLING, stack, Materials.Oxygen.getFluid()); removeRecyclingRecipe(RecipeMaps.MACERATOR_RECIPES, RecipeCategories.MACERATOR_RECYCLING, stack, null); removeRecyclingRecipe(RecipeMaps.EXTRACTOR_RECIPES, RecipeCategories.EXTRACTOR_RECYCLING, stack, null); if (modified.getValue() == null) continue; - NomiLabs.LOGGER.debug("Adding Recycling Recipes for {} @ {}...", stack.getItem().getRegistryName(), stack.getMetadata()); + NomiLabs.LOGGER.debug("Adding Recycling Recipes for {} @ {}...", itemMeta.getItem().getRegistryName(), itemMeta.getMeta()); RecyclingRecipes.registerRecyclingRecipes(stack, modified.getValue().getMaterials(),false, null ); } NomiLabs.LOGGER.info("Reloading Recycling Recipes took {}ms", System.currentTimeMillis() - time); diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/groovyscript/ReloadableRegistryManagerMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/groovyscript/ReloadableRegistryManagerMixin.java deleted file mode 100644 index 9b2dfa2f..00000000 --- a/src/main/java/com/nomiceu/nomilabs/mixin/groovyscript/ReloadableRegistryManagerMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.nomiceu.nomilabs.mixin.groovyscript; - -import com.cleanroommc.groovyscript.registry.ReloadableRegistryManager; -import mezz.jei.Internal; -import mezz.jei.ingredients.IngredientFilter; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.lang.reflect.InvocationTargetException; - -// TODO Might Have to Remove this in GS Update, if they fix it there? -@Mixin(value = ReloadableRegistryManager.class, remap = false) -public class ReloadableRegistryManagerMixin { - @Inject(method = "reloadJei", at = @At("TAIL")) - private static void test(boolean msgPlayer, CallbackInfo ci) { - // Fix: HEI Removals Disappearing on Reload - // Reloads the Removed Ingredients (Actually removes them) - // Must use Internal, no other way to get IngredientFilter - // Reflection, method doesn't exist in JEI - var filter = Internal.getIngredientFilter(); - try { - IngredientFilter.class.getDeclaredMethod("block").invoke(filter); - } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ignored) {} - } -} diff --git a/src/main/java/com/nomiceu/nomilabs/util/ItemMeta.java b/src/main/java/com/nomiceu/nomilabs/util/ItemMeta.java index 65c6ea15..bb6c5608 100644 --- a/src/main/java/com/nomiceu/nomilabs/util/ItemMeta.java +++ b/src/main/java/com/nomiceu/nomilabs/util/ItemMeta.java @@ -39,4 +39,12 @@ public static boolean compare(ItemStack a, ItemStack b) { public ItemStack toStack() { return new ItemStack(item, 1, meta); } + + public Item getItem() { + return item; + } + + public int getMeta() { + return meta; + } } diff --git a/src/main/java/com/nomiceu/nomilabs/util/ItemTagMeta.java b/src/main/java/com/nomiceu/nomilabs/util/ItemTagMeta.java index 2ae18d7f..cdb5d54c 100644 --- a/src/main/java/com/nomiceu/nomilabs/util/ItemTagMeta.java +++ b/src/main/java/com/nomiceu/nomilabs/util/ItemTagMeta.java @@ -40,4 +40,8 @@ public ItemStack toStack() { if (tag != null) stack.setTagCompound(tag); return stack; } + + public NBTTagCompound getTag() { + return tag; + } } diff --git a/src/main/resources/mixins.nomilabs.groovyscript.json b/src/main/resources/mixins.nomilabs.groovyscript.json deleted file mode 100644 index 7d5c8744..00000000 --- a/src/main/resources/mixins.nomilabs.groovyscript.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "package": "com.nomiceu.nomilabs.mixin.groovyscript", - "refmap": "mixins.nomilabs.refmap.json", - "target": "@env(DEFAULT)", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_8", - "mixins": [ - "ReloadableRegistryManagerMixin" - ], - "client": [], - "server": [] -}