From 11753bb4ef3df4ea05e9172d4ba3ab24247afb81 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] EMI compatibility
---
build.gradle | 10 +++-
gradle.properties | 1 +
.../93943142017732f21fbc4fa325d116c728b69767 | 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/Data.java | 2 -
.../thedarkcolour/exdeorum/data/English.java | 16 +++++-
.../exdeorum/data/ModCompatData.java | 2 -
.../exdeorum/recipe/defaults/exdeorum.json | 5 ++
12 files changed, 124 insertions(+), 11 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 7833d5b1..8fc2a905 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,6 +19,8 @@ runs {
configureEach {
systemProperty 'forge.logging.console.level', 'debug'
+ jvmArgument '-XX:+AllowEnhancedClassRedefinition'
+
modSource project.sourceSets.main
}
@@ -76,6 +78,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"
@@ -102,12 +108,14 @@ dependencies {
// JADE OPTIONAL
implementation("curse.maven:jade-324717:5109393")
// JEI OPTIONAL
- compileOnly("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
compileOnly("mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}")
runtimeOnly("mezz.jei:jei-${mc_version}-neoforge:${jei_version}")
// REI OPTIONAL todo add
compileOnly("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}")
compileOnly("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}")
+ // EMI OPTIONAL
+ compileOnly("dev.emi:emi-neoforge:${emi_version}:api")
+ runtimeOnly("dev.emi:emi-neoforge:${emi_version}")
//implementation("curse.maven:reipc-521393:4837449")
// KubeJS OPTIONAL todo add when KubeJS updates
//implementation("dev.architectury:architectury-neoforge:${architectury_version}")
diff --git a/gradle.properties b/gradle.properties
index 12833f27..30ad0488 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -10,6 +10,7 @@ loader_version_range=[2,)
jei_version=17.3.0.49
rei_version=14.0.688
+emi_version=1.1.4+1.20.4
cloth_config_version=13.0.121
top_version=11.0.1-2
diff --git a/src/generated/resources/.cache/93943142017732f21fbc4fa325d116c728b69767 b/src/generated/resources/.cache/93943142017732f21fbc4fa325d116c728b69767
index cf0f37a3..bcffa489 100644
--- a/src/generated/resources/.cache/93943142017732f21fbc4fa325d116c728b69767
+++ b/src/generated/resources/.cache/93943142017732f21fbc4fa325d116c728b69767
@@ -1,2 +1,2 @@
-// 1.20.4 2024-03-17T23:56:02.8986265 ModKit Language: en_us for mod 'exdeorum'
-43e0f1f023ef626ab7571ad14c1ecdf5cd594823 assets/exdeorum/lang/en_us.json
+// 1.20.4 2024-04-05T23:17:35.8402168 ModKit Language: en_us for mod 'exdeorum'
+b26b3ea427dcf21fe2bf7474735584d282e9fc6e assets/exdeorum/lang/en_us.json
diff --git a/src/generated/resources/assets/exdeorum/lang/en_us.json b/src/generated/resources/assets/exdeorum/lang/en_us.json
index c5186d50..01c163c9 100644
--- a/src/generated/resources/assets/exdeorum/lang/en_us.json
+++ b/src/generated/resources/assets/exdeorum/lang/en_us.json
@@ -232,5 +232,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 e6f8bec6..41d6ff50 100644
--- a/src/main/java/thedarkcolour/exdeorum/compat/ModIds.java
+++ b/src/main/java/thedarkcolour/exdeorum/compat/ModIds.java
@@ -42,6 +42,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 cc677742..583c6385 100644
--- a/src/main/java/thedarkcolour/exdeorum/compat/jei/ExDeorumJeiPlugin.java
+++ b/src/main/java/thedarkcolour/exdeorum/compat/jei/ExDeorumJeiPlugin.java
@@ -41,12 +41,14 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.WallTorchBlock;
+import net.neoforged.fml.ModList;
import net.neoforged.neoforge.fluids.FluidStack;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.client.screen.MechanicalHammerScreen;
import thedarkcolour.exdeorum.client.screen.MechanicalSieveScreen;
import thedarkcolour.exdeorum.compat.CompatUtil;
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;
@@ -239,7 +241,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
@@ -255,7 +257,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/Data.java b/src/main/java/thedarkcolour/exdeorum/data/Data.java
index 07311ccd..db938332 100644
--- a/src/main/java/thedarkcolour/exdeorum/data/Data.java
+++ b/src/main/java/thedarkcolour/exdeorum/data/Data.java
@@ -19,14 +19,12 @@
package thedarkcolour.exdeorum.data;
import net.minecraft.core.registries.Registries;
-import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.data.event.GatherDataEvent;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.data.recipe.Recipes;
import thedarkcolour.modkit.data.DataHelper;
public class Data {
- // todo ensure this does not crash without ModKit
public static void generateData(GatherDataEvent event) {
// Two things used by data generators
var gen = event.getGenerator(); // writes to json
diff --git a/src/main/java/thedarkcolour/exdeorum/data/English.java b/src/main/java/thedarkcolour/exdeorum/data/English.java
index fe99b551..29b58b5a 100644
--- a/src/main/java/thedarkcolour/exdeorum/data/English.java
+++ b/src/main/java/thedarkcolour/exdeorum/data/English.java
@@ -18,15 +18,29 @@
package thedarkcolour.exdeorum.data;
+import net.minecraft.tags.TagKey;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.client.screen.RedstoneControlWidget;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.registry.EBlocks;
+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/java/thedarkcolour/exdeorum/data/ModCompatData.java b/src/main/java/thedarkcolour/exdeorum/data/ModCompatData.java
index 2ff3f6d0..fee401e3 100644
--- a/src/main/java/thedarkcolour/exdeorum/data/ModCompatData.java
+++ b/src/main/java/thedarkcolour/exdeorum/data/ModCompatData.java
@@ -18,13 +18,11 @@
package thedarkcolour.exdeorum.data;
-import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.neoforged.bus.api.IEventBus;
-import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.neoforge.data.loading.DatagenModLoader;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredItem;
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