From f3996fdf4b48f9f3a9284062ac6019a7b33fc186 Mon Sep 17 00:00:00 2001 From: OffsetMonkey538 <71213040+OffsetMonkey538@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:02:59 +0200 Subject: [PATCH] Add sampling recipe to EMI --- .../client/emi/CompactMobFarmsEmiPlugin.java | 24 +++++++++++++++++-- .../language/ModEnglishLanguageProvider.java | 2 ++ .../language/ModEstonianLanguageProvider.java | 2 ++ src/main/resources/fabric.mod.json | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/client/java/top/offsetmonkey538/compactmobfarms/client/emi/CompactMobFarmsEmiPlugin.java b/src/client/java/top/offsetmonkey538/compactmobfarms/client/emi/CompactMobFarmsEmiPlugin.java index ff13436..06bb152 100644 --- a/src/client/java/top/offsetmonkey538/compactmobfarms/client/emi/CompactMobFarmsEmiPlugin.java +++ b/src/client/java/top/offsetmonkey538/compactmobfarms/client/emi/CompactMobFarmsEmiPlugin.java @@ -1,13 +1,17 @@ -package top.offsetmonkey538.compactmobfarms.emi; +package top.offsetmonkey538.compactmobfarms.client.emi; import dev.emi.emi.api.EmiPlugin; import dev.emi.emi.api.EmiRegistry; -import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.recipe.EmiInfoRecipe; import dev.emi.emi.api.recipe.EmiWorldInteractionRecipe; import dev.emi.emi.api.stack.Comparison; +import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; +import java.util.List; import net.minecraft.entity.EntityType; import net.minecraft.item.Items; +import net.minecraft.recipe.Ingredient; +import net.minecraft.text.Text; import top.offsetmonkey538.compactmobfarms.config.EntityTiers; import top.offsetmonkey538.compactmobfarms.item.ModItems; @@ -25,6 +29,22 @@ public void register(EmiRegistry registry) { .build() ); + for (EntityType entity : EntityTiers.INSTANCE.getSupported()) { + registry.addRecipe(new EmiInfoRecipe( + List.of( + EmiIngredient.of(Ingredient.ofItems(ModItems.SAMPLE_TAKER)), + EmiIngredient.of(Ingredient.ofStacks(ModItems.FILLED_SAMPLE_TAKER.forEntity(entity))) + ), + List.of( + Text.translatable( + "emi_info.compact_mob_farms.sampling", + Text.translatable(entity.getTranslationKey()) + ) + ), + id("/sampling/" + entity) + )); + } + registry.setDefaultComparison(ModItems.FILLED_SAMPLE_TAKER, Comparison.compareNbt()); } } diff --git a/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEnglishLanguageProvider.java b/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEnglishLanguageProvider.java index 1d90e11..c0c1343 100644 --- a/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEnglishLanguageProvider.java +++ b/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEnglishLanguageProvider.java @@ -12,6 +12,8 @@ public ModEnglishLanguageProvider(FabricDataOutput dataOutput) { @Override public void generateTranslations(TranslationBuilder translationBuilder) { + translationBuilder.add("emi_info.compact_mob_farms.sampling", "Use a sample taker on a(n) %s 10 times."); + translationBuilder.add("itemGroup.compact_mob_farms.main_group", "Compact Mob Farms"); translationBuilder.add("itemGroup.compact_mob_farms.filled_sample_takers_group", "Sample Takers"); diff --git a/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEstonianLanguageProvider.java b/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEstonianLanguageProvider.java index 4c9a9f7..a29b515 100644 --- a/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEstonianLanguageProvider.java +++ b/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEstonianLanguageProvider.java @@ -12,6 +12,8 @@ public ModEstonianLanguageProvider(FabricDataOutput dataOutput) { @Override public void generateTranslations(TranslationBuilder translationBuilder) { + translationBuilder.add("emi_info.compact_mob_farms.sampling", "Kasuta proovivõtjat olendi \"%s\" peal 10 korda."); + translationBuilder.add("itemGroup.compact_mob_farms.main_group", "Kompaktsed Olendi Farmid"); translationBuilder.add("itemGroup.compact_mob_farms.filled_sample_takers_group", "Proovivõtjad"); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 8ae3d23..a3a539b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,7 +29,7 @@ "com.llamalad7.mixinextras.MixinExtrasBootstrap::init" ], "emi": [ - "top.offsetmonkey538.compactmobfarms.emi.CompactMobFarmsEmiPlugin" + "top.offsetmonkey538.compactmobfarms.client.emi.CompactMobFarmsEmiPlugin" ] }, "mixins": [