From ccdae3be4099cffdb56c5e4646d5c0e0e66dd788 Mon Sep 17 00:00:00 2001 From: thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> Date: Fri, 5 Apr 2024 23:27:35 -0700 Subject: [PATCH 1/3] EMI compatibility --- build.gradle | 11 ++++ gradle.properties | 4 +- .../resources/assets/exdeorum/lang/en_us.json | 10 +++- .../thedarkcolour/exdeorum/compat/ModIds.java | 1 + .../compat/emi/ExDeorumEmiPlugin.java | 57 +++++++++++++++++++ .../exdeorum/compat/emi/package-info.java | 21 +++++++ .../compat/jei/ExDeorumJeiPlugin.java | 6 +- .../thedarkcolour/exdeorum/data/English.java | 17 +++++- .../exdeorum/recipe/defaults/exdeorum.json | 5 ++ 9 files changed, 124 insertions(+), 8 deletions(-) create mode 100644 src/main/java/thedarkcolour/exdeorum/compat/emi/ExDeorumEmiPlugin.java create mode 100644 src/main/java/thedarkcolour/exdeorum/compat/emi/package-info.java create mode 100644 src/main/resources/assets/exdeorum/recipe/defaults/exdeorum.json diff --git a/build.gradle b/build.gradle index dbe7d14b..a58f30e6 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,8 @@ minecraft { client { workingDirectory project.file('run') + jvmArgument '-XX:+AllowEnhancedClassRedefinition' + property 'forge.logging.console.level', 'debug' mods { @@ -36,6 +38,8 @@ minecraft { server { workingDirectory project.file('run/server') + jvmArgument '-XX:+AllowEnhancedClassRedefinition' + property 'forge.logging.console.level', 'debug' mods { @@ -131,6 +135,10 @@ repositories { url 'https://jitpack.io' content { includeGroup 'com.github.thedarkcolour' } } + maven { + name = 'TerraformersMC' + url = 'https://maven.terraformersmc.com' + } maven { name = "Modrinth" url = "https://api.modrinth.com/maven" @@ -164,6 +172,9 @@ dependencies { implementation(fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}")) implementation(fg.deobf("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}")) implementation(fg.deobf("curse.maven:reipc-521393:4837449")) + // EMI OPTIONAL + compileOnly("dev.emi:emi-forge:${emi_version}:api") + runtimeOnly("dev.emi:emi-forge:${emi_version}") // KubeJS OPTIONAL implementation fg.deobf("dev.architectury:architectury-forge:${architectury_version}") implementation fg.deobf("dev.latvian.mods:rhino-forge:${rhino_version}") diff --git a/gradle.properties b/gradle.properties index 2ec3b600..f4f115a6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,12 +8,10 @@ mc_version=1.20.1 forge_version=47.1.43 parchment_mappings=1.20.1-2023.06.26 -geckolib_version=4.2 -modonomicon_version=1.36.0 jei_version=15.2.0.23 rei_version=12.0.684 +emi_version=1.1.4+1.20.1 cloth_config_version=11.1.118 -curios_version=5.2.0-beta.3 top_version=10.0.1-3 kubejs_version=2001.6.3-build.47 diff --git a/src/generated/resources/assets/exdeorum/lang/en_us.json b/src/generated/resources/assets/exdeorum/lang/en_us.json index 38d55891..d143b388 100644 --- a/src/generated/resources/assets/exdeorum/lang/en_us.json +++ b/src/generated/resources/assets/exdeorum/lang/en_us.json @@ -278,5 +278,13 @@ "item.exdeorum.wooden_hammer": "Wooden Hammer", "item.exdeorum.wooden_watering_can": "Wooden Watering Can", "item.exdeorum.zinc_ore_chunk": "Zinc Ore Chunk", - "itemGroup.exdeorum.main": "Ex Deorum" + "itemGroup.exdeorum.main": "Ex Deorum", + "tag.item.exdeorum.barrels": "Barrels", + "tag.item.exdeorum.crooks": "Crooks", + "tag.item.exdeorum.end_cake_materials": "End Cake Materials", + "tag.item.exdeorum.hammers": "Hammers", + "tag.item.exdeorum.pebbles": "Pebbles", + "tag.item.exdeorum.sieve_meshes": "Sieve Meshes", + "tag.item.exdeorum.stone_barrels": "Stone Barrels", + "tag.item.exdeorum.wooden_barrels": "Wooden Barrels" } \ No newline at end of file diff --git a/src/main/java/thedarkcolour/exdeorum/compat/ModIds.java b/src/main/java/thedarkcolour/exdeorum/compat/ModIds.java index 9ad32d80..13e5cccf 100644 --- a/src/main/java/thedarkcolour/exdeorum/compat/ModIds.java +++ b/src/main/java/thedarkcolour/exdeorum/compat/ModIds.java @@ -44,6 +44,7 @@ public class ModIds { public static final String PAMS_HARVESTCRAFT_CROPS = "pamhc2crops"; public static final String NUCLEARCRAFT_NEOTERIC = "nuclearcraft"; public static final String JEI = "jei"; + public static final String EMI = "emi"; public static final String INVENTORY_SORTER = "inventorysorter"; public static final String REI_PC = "rei_plugin_compatibilities"; } diff --git a/src/main/java/thedarkcolour/exdeorum/compat/emi/ExDeorumEmiPlugin.java b/src/main/java/thedarkcolour/exdeorum/compat/emi/ExDeorumEmiPlugin.java new file mode 100644 index 00000000..ab7b4abb --- /dev/null +++ b/src/main/java/thedarkcolour/exdeorum/compat/emi/ExDeorumEmiPlugin.java @@ -0,0 +1,57 @@ +/* + * Ex Deorum + * Copyright (c) 2024 thedarkcolour + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package thedarkcolour.exdeorum.compat.emi; + +import dev.emi.emi.api.EmiEntrypoint; +import dev.emi.emi.api.EmiInitRegistry; +import dev.emi.emi.api.EmiPlugin; +import dev.emi.emi.api.EmiRegistry; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; +import thedarkcolour.exdeorum.compat.CompatUtil; + +import java.util.HashSet; +import java.util.Set; + +@EmiEntrypoint +public class ExDeorumEmiPlugin implements EmiPlugin { + @Override + public void register(EmiRegistry emiRegistry) { + } + + @Override + public void initialize(EmiInitRegistry registry) { + Set toRemove = new HashSet<>(); + + toRemove.addAll(CompatUtil.getAvailableBarrels(false)); + toRemove.addAll(CompatUtil.getAvailableSieves(false, false)); + toRemove.addAll(CompatUtil.getAvailableLavaCrucibles(false)); + toRemove.addAll(CompatUtil.getAvailableWaterCrucibles(false)); + + Set toRemoveItems = new HashSet<>(); + + for (var itemLike : toRemove) { + toRemoveItems.add(itemLike.asItem()); + } + + registry.disableStacks(stack -> { + return toRemoveItems.contains(stack.getItemStack().getItem()); + }); + } +} diff --git a/src/main/java/thedarkcolour/exdeorum/compat/emi/package-info.java b/src/main/java/thedarkcolour/exdeorum/compat/emi/package-info.java new file mode 100644 index 00000000..3eb8e366 --- /dev/null +++ b/src/main/java/thedarkcolour/exdeorum/compat/emi/package-info.java @@ -0,0 +1,21 @@ +/* + * Ex Deorum + * Copyright (c) 2024 thedarkcolour + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +@net.minecraft.MethodsReturnNonnullByDefault +@javax.annotation.ParametersAreNonnullByDefault +package thedarkcolour.exdeorum.compat.emi; diff --git a/src/main/java/thedarkcolour/exdeorum/compat/jei/ExDeorumJeiPlugin.java b/src/main/java/thedarkcolour/exdeorum/compat/jei/ExDeorumJeiPlugin.java index 78d89dec..e83dac94 100644 --- a/src/main/java/thedarkcolour/exdeorum/compat/jei/ExDeorumJeiPlugin.java +++ b/src/main/java/thedarkcolour/exdeorum/compat/jei/ExDeorumJeiPlugin.java @@ -43,11 +43,13 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.WallTorchBlock; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.ModList; import thedarkcolour.exdeorum.ExDeorum; import thedarkcolour.exdeorum.client.screen.MechanicalHammerScreen; import thedarkcolour.exdeorum.client.screen.MechanicalSieveScreen; import thedarkcolour.exdeorum.compat.CompatHelper; import thedarkcolour.exdeorum.compat.GroupedSieveRecipe; +import thedarkcolour.exdeorum.compat.ModIds; import thedarkcolour.exdeorum.data.TranslationKeys; import thedarkcolour.exdeorum.item.WateringCanItem; import thedarkcolour.exdeorum.recipe.RecipeUtil; @@ -243,7 +245,7 @@ public class ExDeorumJeiPlugin implements IModPlugin { @Override public Collection getGuiClickableAreas(MechanicalSieveScreen containerScreen, double mouseX, double mouseY) { IGuiClickableArea clickableArea = IGuiClickableArea.createBasic(MechanicalSieveScreen.RECIPE_CLICK_AREA_POS_X, MechanicalSieveScreen.RECIPE_CLICK_AREA_POS_Y, MechanicalSieveScreen.RECIPE_CLICK_AREA_WIDTH, MechanicalSieveScreen.RECIPE_CLICK_AREA_HEIGHT, SIEVE); - return List.of(clickableArea); + return ModList.get().isLoaded(ModIds.EMI) ? List.of() : List.of(clickableArea); } @Override @@ -259,7 +261,7 @@ public class ExDeorumJeiPlugin implements IModPlugin { @Override public Collection getGuiClickableAreas(MechanicalHammerScreen containerScreen, double mouseX, double mouseY) { IGuiClickableArea clickableArea = IGuiClickableArea.createBasic(MechanicalHammerScreen.RECIPE_CLICK_AREA_POS_X, MechanicalHammerScreen.RECIPE_CLICK_AREA_POS_Y, MechanicalHammerScreen.RECIPE_CLICK_AREA_WIDTH, MechanicalHammerScreen.RECIPE_CLICK_AREA_HEIGHT, HAMMER); - return List.of(clickableArea); + return ModList.get().isLoaded(ModIds.EMI) ? List.of() : List.of(clickableArea); } @Override diff --git a/src/main/java/thedarkcolour/exdeorum/data/English.java b/src/main/java/thedarkcolour/exdeorum/data/English.java index 192c95e1..4c2fe2e8 100644 --- a/src/main/java/thedarkcolour/exdeorum/data/English.java +++ b/src/main/java/thedarkcolour/exdeorum/data/English.java @@ -18,14 +18,27 @@ package thedarkcolour.exdeorum.data; -import thedarkcolour.exdeorum.ExDeorum; +import net.minecraft.tags.TagKey; import thedarkcolour.exdeorum.client.screen.RedstoneControlWidget; import thedarkcolour.exdeorum.material.DefaultMaterials; +import thedarkcolour.exdeorum.registry.EFluids; +import thedarkcolour.exdeorum.tag.EItemTags; import thedarkcolour.modkit.data.MKEnglishProvider; class English { static void addTranslations(MKEnglishProvider english) { - english.add("fluid_type." + ExDeorum.ID + ".witch_water", "Witch Water"); + english.addTranslationHandler(TagKey.class, tag -> "tag.item." + tag.location().toString().replaceAll("[:/]", ".")); + + english.add(EItemTags.CROOKS, "Crooks"); + english.add(EItemTags.HAMMERS, "Hammers"); + english.add(EItemTags.SIEVE_MESHES, "Sieve Meshes"); + english.add(EItemTags.PEBBLES, "Pebbles"); + english.add(EItemTags.END_CAKE_MATERIAL, "End Cake Materials"); + english.add(EItemTags.WOODEN_BARRELS, "Wooden Barrels"); + english.add(EItemTags.STONE_BARRELS, "Stone Barrels"); + english.add(EItemTags.BARRELS, "Barrels"); + + english.add(EFluids.WITCH_WATER_TYPE.get(), "Witch Water"); english.add(TranslationKeys.MAIN_CREATIVE_TAB, "Ex Deorum"); english.add(TranslationKeys.VOID_WORLD_TYPE, "Void World"); diff --git a/src/main/resources/assets/exdeorum/recipe/defaults/exdeorum.json b/src/main/resources/assets/exdeorum/recipe/defaults/exdeorum.json new file mode 100644 index 00000000..399286b6 --- /dev/null +++ b/src/main/resources/assets/exdeorum/recipe/defaults/exdeorum.json @@ -0,0 +1,5 @@ +{ + "added": [ + "exdeorum:unfired_crucible" + ] +} \ No newline at end of file From 8d22d798916aa2e3c06edaab4e0cbaeccace52d5 Mon Sep 17 00:00:00 2001 From: thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:37:46 -0700 Subject: [PATCH 2/3] Use DCEVM in genIntellijRuns --- build.gradle | 40 +------------------ .../93943142017732f21fbc4fa325d116c728b69767 | 2 +- 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/build.gradle b/build.gradle index a58f30e6..b9e84636 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ minecraft { client { workingDirectory project.file('run') - jvmArgument '-XX:+AllowEnhancedClassRedefinition' + jvmArgs.add('-XX:+AllowEnhancedClassRedefinition') property 'forge.logging.console.level', 'debug' @@ -38,7 +38,7 @@ minecraft { server { workingDirectory project.file('run/server') - jvmArgument '-XX:+AllowEnhancedClassRedefinition' + jvmArgs.add('-XX:+AllowEnhancedClassRedefinition') property 'forge.logging.console.level', 'debug' @@ -62,42 +62,6 @@ minecraft { } } } - - testmodClient { - workingDirectory project.file('run') - - property 'forge.logging.console.level', 'debug' - - parent runs.client - ideaModule "${project.name}.test" - - mods { - modkit { - source sourceSets.main - } - orestestmod { - source sourceSets.test - } - } - } - - testmodServer { - workingDirectory project.file('run/server') - - property 'forge.logging.console.level', 'debug' - - parent runs.server - ideaModule "${project.name}.test" - - mods { - modkit { - source sourceSets.main - } - orestestmod { - source sourceSets.test - } - } - } } } diff --git a/src/generated/resources/.cache/93943142017732f21fbc4fa325d116c728b69767 b/src/generated/resources/.cache/93943142017732f21fbc4fa325d116c728b69767 index f470a2e2..ae294a44 100644 --- a/src/generated/resources/.cache/93943142017732f21fbc4fa325d116c728b69767 +++ b/src/generated/resources/.cache/93943142017732f21fbc4fa325d116c728b69767 @@ -1,2 +1,2 @@ // 1.20.1 2024-03-24T13:45:21.353088 ModKit Language: en_us for mod 'exdeorum' -5e6a83850878d393c5ca110eb4e47fe760b12046 assets/exdeorum/lang/en_us.json +b26b3ea427dcf21fe2bf7474735584d282e9fc6e assets/exdeorum/lang/en_us.json From d940b05597ee5d9ad18d6af8e565e98f1c7fc4bf Mon Sep 17 00:00:00 2001 From: thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:43:25 -0700 Subject: [PATCH 3/3] Switch to EMI for testing --- build.gradle | 9 ++++----- .../exdeorum/compat/emi/ExDeorumEmiPlugin.java | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index b9e84636..bcf85e72 100644 --- a/build.gradle +++ b/build.gradle @@ -129,13 +129,12 @@ dependencies { // JADE OPTIONAL implementation(fg.deobf("curse.maven:jade-324717:4986594")) // JEI OPTIONAL - compileOnly(fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")) compileOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")) - compileOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")) + runtimeOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")) // REI OPTIONAL - implementation(fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}")) - implementation(fg.deobf("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}")) - implementation(fg.deobf("curse.maven:reipc-521393:4837449")) + compileOnly(fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}")) + compileOnly(fg.deobf("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}")) + compileOnly(fg.deobf("curse.maven:reipc-521393:4837449")) // EMI OPTIONAL compileOnly("dev.emi:emi-forge:${emi_version}:api") runtimeOnly("dev.emi:emi-forge:${emi_version}") diff --git a/src/main/java/thedarkcolour/exdeorum/compat/emi/ExDeorumEmiPlugin.java b/src/main/java/thedarkcolour/exdeorum/compat/emi/ExDeorumEmiPlugin.java index ab7b4abb..c946d9de 100644 --- a/src/main/java/thedarkcolour/exdeorum/compat/emi/ExDeorumEmiPlugin.java +++ b/src/main/java/thedarkcolour/exdeorum/compat/emi/ExDeorumEmiPlugin.java @@ -24,7 +24,7 @@ import dev.emi.emi.api.EmiPlugin; import dev.emi.emi.api.EmiRegistry; import net.minecraft.world.item.Item; import net.minecraft.world.level.ItemLike; -import thedarkcolour.exdeorum.compat.CompatUtil; +import thedarkcolour.exdeorum.compat.CompatHelper; import java.util.HashSet; import java.util.Set; @@ -39,10 +39,10 @@ public class ExDeorumEmiPlugin implements EmiPlugin { public void initialize(EmiInitRegistry registry) { Set toRemove = new HashSet<>(); - toRemove.addAll(CompatUtil.getAvailableBarrels(false)); - toRemove.addAll(CompatUtil.getAvailableSieves(false, false)); - toRemove.addAll(CompatUtil.getAvailableLavaCrucibles(false)); - toRemove.addAll(CompatUtil.getAvailableWaterCrucibles(false)); + toRemove.addAll(CompatHelper.getAvailableBarrels(false)); + toRemove.addAll(CompatHelper.getAvailableSieves(false, false)); + toRemove.addAll(CompatHelper.getAvailableLavaCrucibles(false)); + toRemove.addAll(CompatHelper.getAvailableWaterCrucibles(false)); Set toRemoveItems = new HashSet<>();