diff --git a/build.gradle b/build.gradle index 01e54ec..2569d60 100644 --- a/build.gradle +++ b/build.gradle @@ -77,7 +77,7 @@ dependencies { switch (recipe_viewer.toLowerCase(Locale.ROOT)) { case "jei": modLocalRuntime("mezz.jei:jei-${minecraft_version}-fabric:${jei_version}"); break case "rei": modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:${rei_version}"); break - case "emi": modLocalRuntime("dev.emi:emi:${emi_version}"); break + case "emi": modLocalRuntime("maven.modrinth:emi:${emi_version}"); break case "disabled": break default: println("Unknown recipe viewer specified: ${recipe_viewer}. Must be JEI, REI, EMI, or disabled.") } @@ -86,7 +86,7 @@ dependencies { // modCompileOnly("mezz.jei:jei-${minecraft_version}-common:${jei_fabric_version}") // modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:${rei_version}") // modCompileOnly("me.shedaniel:RoughlyEnoughItems-default-plugin-fabric:${rei_version}") -// modCompileOnly("dev.emi:emi:${emi_version}") + modCompileOnly("maven.modrinth:emi:${emi_version}") } processResources { diff --git a/gradle.properties b/gradle.properties index e51df92..c6be362 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,7 +25,7 @@ create_version = 0.5.1-d-build.1161+mc1.20.1 # Development QOL # Create supports all 3 recipe viewers: JEI, REI, and EMI. This decides which is enabled at runtime. # set to disabled to have none of them. -recipe_viewer = unspecified +recipe_viewer = EMI # JEI - https://www.curseforge.com/minecraft/mc-mods/jei/files/all jei_version = 10.2.1.283 # REI - https://modrinth.com/mod/roughly-enough-items/versions diff --git a/src/generated/resources/.cache/88367cf7312056ae2fbd6a36564e7a0ade559139 b/src/generated/resources/.cache/88367cf7312056ae2fbd6a36564e7a0ade559139 index 3074789..75f2af4 100644 --- a/src/generated/resources/.cache/88367cf7312056ae2fbd6a36564e7a0ade559139 +++ b/src/generated/resources/.cache/88367cf7312056ae2fbd6a36564e7a0ade559139 @@ -1,10 +1,10 @@ -// 1.20.1 2023-09-13T17:58:50.441746 Create: Sandpaper Overhaul/Registrate Provider for create_so [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] -a76ce33ae00a27baa4eda76f326d69a50809204b assets/create_so/lang/en_ud.json +// 1.20.1 2023-09-18T20:20:22.193453 Create: Sandpaper Overhaul/Registrate Provider for create_so [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] +e6ba883012056e1b704e624d4e701edbbab0ed13 assets/create_so/lang/en_ud.json 09b7b42ebfd951db23d40928f784e8b9ffb2bcfa data/create_so/advancements/recipes/tools/iron_sandpaper.json 5fa8e37f2719558a26122cd719a8569f95f760b8 assets/create_so/models/item/unrefined_lapis_lazuli.json 6183056b14f9697590050c3fdc9838f6fe53edab data/create_so/advancements/recipes/tools/obsidian_sandpaper.json f71c982c977c60dff1cb08121771916c65ecafc4 data/create_so/recipes/diamond_sandpaper.json -7f6d4ac0158bf800d2e475f0f31a866c0fa9a5d4 assets/create_so/lang/en_us.json +5c24317d7718425982a7f198403295eca793e619 assets/create_so/lang/en_us.json 004a6c2036ca80aa4361135b506081b19b0d1b99 data/create/tags/items/sandpaper.json 6e0ac9b9da4ee33f9cd036698d812e0d53d743d9 data/create_so/loot_tables/blocks/polishing_wheel.json 6e8fdee69adadc74221e1c65308fd32467b7a471 data/create_so/advancements/recipes/tools/diamond_sandpaper.json @@ -17,5 +17,5 @@ f064f582da2fe48dc732ea7edabd0c72a1579dcc data/minecraft/tags/blocks/mineable/pic 4b0e51a1c10685f7d432467339afc9c2e24793b0 assets/create_so/blockstates/polishing_wheel_controller.json 22866fa23344eda3baad5a317080e7112fb88ba9 assets/create_so/blockstates/polishing_wheel.json 777f0bef0990a81f8662e071fb40478ef9ac098f assets/create_so/models/item/crushed_iron.json -b69fee687ce4c8ef34426bee57f9ff5b6a3dd6e3 assets/create_so/models/item/diamond_sandpaper.json 1de3f1f90c293f68de1ffd59e4489073ccba053e assets/create_so/models/item/crushed_diamonds.json +b69fee687ce4c8ef34426bee57f9ff5b6a3dd6e3 assets/create_so/models/item/diamond_sandpaper.json diff --git a/src/generated/resources/.cache/89111a76195d73c279f4f0f24afedf84338f085b b/src/generated/resources/.cache/89111a76195d73c279f4f0f24afedf84338f085b index a21a3f6..a5c52cb 100644 --- a/src/generated/resources/.cache/89111a76195d73c279f4f0f24afedf84338f085b +++ b/src/generated/resources/.cache/89111a76195d73c279f4f0f24afedf84338f085b @@ -1,2 +1,2 @@ -// 1.20.1 2023-09-13T17:58:50.441093 Create: Sandpaper Overhaul/Create Sandpaper Overhaul's Damage Type Data +// 1.20.1 2023-09-18T20:20:22.192754 Create: Sandpaper Overhaul/Create Sandpaper Overhaul's Damage Type Data 132c7d6042e5e957f5eebe5fdbbb2dcd39c07ff7 data/create_so/damage_type/sandpaper.json diff --git a/src/generated/resources/assets/create_so/lang/en_ud.json b/src/generated/resources/assets/create_so/lang/en_ud.json index e7554b7..7f2e4cc 100644 --- a/src/generated/resources/assets/create_so/lang/en_ud.json +++ b/src/generated/resources/assets/create_so/lang/en_ud.json @@ -4,6 +4,7 @@ "block.create_so.polishing_wheel.tooltip.summary": "˙sʇunoɯɐ ǝbɹɐן uı sɯǝʇı ‾ɥsıןoԀ‾ uɐɔ ʇɐɥʇ ‾ןǝǝɥM buıɥsnɹƆ‾ ǝɥʇ oʇ ɹɐןıɯıs ʞɔoןq ɐ sı ‾ןǝǝɥM buıɥsıןoԀ‾ ǝɥ⟘", "block.create_so.polishing_wheel_controller": "ɹǝןןoɹʇuoƆ ןǝǝɥM buıɥsıןoԀ", "death.attack.create_so.sandpaper": "ɹǝdɐdpuɐs ɐ ɥʇıʍ ɥʇɐǝp oʇ pǝqqnɹɔs ʎןןɐʇnɹq sɐʍ %1$s", + "emi.category.create_so.polishing": "sןǝǝɥM buıɥsıןoԀ", "item.create.powdered_obsidian": "uɐıpısqO pǝɥsnɹƆ", "item.create_so.crushed_diamonds": "spuoɯɐıᗡ pǝɥsnɹƆ", "item.create_so.crushed_iron": "uoɹI pǝɥsnɹƆ", diff --git a/src/generated/resources/assets/create_so/lang/en_us.json b/src/generated/resources/assets/create_so/lang/en_us.json index 7eae2c1..200734f 100644 --- a/src/generated/resources/assets/create_so/lang/en_us.json +++ b/src/generated/resources/assets/create_so/lang/en_us.json @@ -4,6 +4,7 @@ "block.create_so.polishing_wheel.tooltip.summary": "The _Polishing Wheel_ is a block similar to the _Crushing Wheel_ that can _Polish_ items in large amounts.", "block.create_so.polishing_wheel_controller": "Polishing Wheel Controller", "death.attack.create_so.sandpaper": "%1$s was brutally scrubbed to death with a sandpaper", + "emi.category.create_so.polishing": "Polishing Wheels", "item.create.powdered_obsidian": "Crushed Obsidian", "item.create_so.crushed_diamonds": "Crushed Diamonds", "item.create_so.crushed_iron": "Crushed Iron", diff --git a/src/main/java/com/ghasto/create_so/ModCustomLangEntries.java b/src/main/java/com/ghasto/create_so/ModCustomLangEntries.java index 133c46d..98ada3f 100644 --- a/src/main/java/com/ghasto/create_so/ModCustomLangEntries.java +++ b/src/main/java/com/ghasto/create_so/ModCustomLangEntries.java @@ -16,6 +16,9 @@ public class ModCustomLangEntries { lang("item.create_so.obsidian_sandpaper.tooltip.condition1", "When Used"); lang("item.create_so.obsidian_sandpaper.tooltip.behaviour1", "Applies polish to items held in the _offhand_ or lying on the _floor_ when _looking at them_"); + //Emi + lang("emi.category.create_so.polishing", "Polishing Wheels"); + //Misc lang("item.create.powdered_obsidian", "Crushed Obsidian"); } diff --git a/src/main/java/com/ghasto/create_so/compat/emi/ModEMICompat.java b/src/main/java/com/ghasto/create_so/compat/emi/ModEMICompat.java new file mode 100644 index 0000000..b4d0fd0 --- /dev/null +++ b/src/main/java/com/ghasto/create_so/compat/emi/ModEMICompat.java @@ -0,0 +1,41 @@ +package com.ghasto.create_so.compat.emi; + +import com.ghasto.create_so.CreateSandpaperOverhaul; +import com.ghasto.create_so.ModBlocks; +import com.ghasto.create_so.ModRecipeTypes; +import com.ghasto.create_so.content.polishing_wheel.PolishingRecipe; +import com.simibubi.create.AllItems; +import com.simibubi.create.compat.emi.DoubleItemIcon; +import dev.emi.emi.api.EmiPlugin; +import dev.emi.emi.api.EmiRegistry; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.render.EmiRenderable; +import dev.emi.emi.api.stack.EmiStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.RecipeManager; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class ModEMICompat implements EmiPlugin { + public static final Map ALL = new LinkedHashMap<>(); + public static final EmiRecipeCategory + POLISHING = register("polishing", DoubleItemIcon.of(ModBlocks.POLISHING_WHEEL.get(), AllItems.SAND_PAPER.get())); + @Override + public void register(EmiRegistry registry) { + ALL.forEach((id, category) -> registry.addCategory(category)); + registry.addWorkstation(POLISHING, EmiStack.of(ModBlocks.POLISHING_WHEEL.get())); + RecipeManager manager = registry.getRecipeManager(); + List polishingRecipes = (List) (List) manager.getAllRecipesFor(ModRecipeTypes.POLISHING.getType()); + for (PolishingRecipe recipe : polishingRecipes) { + registry.addRecipe(new PolishingEmiRecipe(recipe)); + } + } + private static EmiRecipeCategory register(String name, EmiRenderable icon) { + ResourceLocation id = CreateSandpaperOverhaul.id(name); + EmiRecipeCategory category = new EmiRecipeCategory(id, icon); + ALL.put(id, category); + return category; + } +} diff --git a/src/main/java/com/ghasto/create_so/compat/emi/ModEmiAnimations.java b/src/main/java/com/ghasto/create_so/compat/emi/ModEmiAnimations.java new file mode 100644 index 0000000..d2d46d2 --- /dev/null +++ b/src/main/java/com/ghasto/create_so/compat/emi/ModEmiAnimations.java @@ -0,0 +1,34 @@ +package com.ghasto.create_so.compat.emi; + +import com.ghasto.create_so.ModBlocks; +import com.mojang.blaze3d.vertex.PoseStack; +import dev.emi.emi.api.widget.WidgetHolder; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; + +import static com.simibubi.create.compat.emi.CreateEmiAnimations.blockElement; +import static com.simibubi.create.compat.emi.CreateEmiAnimations.getCurrentAngle; + +public class ModEmiAnimations { + private static final BlockState WHEEL = ModBlocks.POLISHING_WHEEL.getDefaultState().setValue(BlockStateProperties.AXIS, Direction.Axis.X); + public static void addPolishingWheels(WidgetHolder widgets, int x, int y) { + widgets.addDrawable(x, y, 0, 0, (graphics, mouseX, mouseY, delta) -> { + PoseStack matrices = graphics.pose(); + matrices.translate(0, 0, 100); + matrices.mulPose(com.mojang.math.Axis.YP.rotationDegrees(-22.5f)); + int scale = 22; + + blockElement(WHEEL) + .rotateBlock(0, 90, -getCurrentAngle()) + .scale(scale) + .render(graphics); + + blockElement(WHEEL) + .rotateBlock(0, 90, getCurrentAngle()) + .atLocal(2, 0, 0) + .scale(scale) + .render(graphics); + }); + } +} diff --git a/src/main/java/com/ghasto/create_so/compat/emi/PolishingEmiRecipe.java b/src/main/java/com/ghasto/create_so/compat/emi/PolishingEmiRecipe.java new file mode 100644 index 0000000..58e8583 --- /dev/null +++ b/src/main/java/com/ghasto/create_so/compat/emi/PolishingEmiRecipe.java @@ -0,0 +1,31 @@ +package com.ghasto.create_so.compat.emi; + +import com.ghasto.create_so.content.polishing_wheel.PolishingRecipe; +import com.simibubi.create.compat.emi.recipes.CreateEmiRecipe; +import com.simibubi.create.content.kinetics.crusher.AbstractCrushingRecipe; +import com.simibubi.create.foundation.gui.AllGuiTextures; +import dev.emi.emi.api.widget.WidgetHolder; +import net.minecraft.resources.ResourceLocation; + +public class PolishingEmiRecipe extends CreateEmiRecipe { + + public PolishingEmiRecipe(PolishingRecipe recipe) { + super(ModEMICompat.POLISHING, recipe, 134, 110); + ResourceLocation rid = recipe.getId(); + this.id = new ResourceLocation("emi", "create_so/polishing/" + rid.getNamespace() + "/" + rid.getPath()); + } + + @Override + public void addWidgets(WidgetHolder widgets) { + addTexture(widgets, AllGuiTextures.JEI_DOWN_ARROW, 51, 11); + + addSlot(widgets, input.get(0), 29, 6); + + int xOff = -output.size() * 19 / 2; + for (int i = 0; i < output.size(); i++) { + addSlot(widgets, output.get(i), 67 + xOff + 19 * i, 82).recipeContext(this); + } + + ModEmiAnimations.addPolishingWheels(widgets, 41, 63); + } +} diff --git a/src/main/java/com/ghasto/create_so/compat/rei/ModReiCompat.java b/src/main/java/com/ghasto/create_so/compat/rei/ModReiCompat.java new file mode 100644 index 0000000..e54dea6 --- /dev/null +++ b/src/main/java/com/ghasto/create_so/compat/rei/ModReiCompat.java @@ -0,0 +1,4 @@ +package com.ghasto.create_so.compat.rei; + +public class ModReiCompat { +} diff --git a/src/main/java/com/ghasto/create_so/mixin/BeltInventoryAccess.java b/src/main/java/com/ghasto/create_so/mixin/BeltInventoryAccess.java deleted file mode 100644 index 8657baa..0000000 --- a/src/main/java/com/ghasto/create_so/mixin/BeltInventoryAccess.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ghasto.create_so.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import com.simibubi.create.content.kinetics.belt.BeltBlockEntity; -import com.simibubi.create.content.kinetics.belt.transport.BeltInventory; - -@Mixin(value = BeltInventory.class, remap = false) -public interface BeltInventoryAccess { - @Accessor - public BeltBlockEntity getBelt(); - @Accessor - public boolean getBeltMovementPositive(); -} diff --git a/src/main/resources/create_so.mixins.json b/src/main/resources/create_so.mixins.json index a9c0a24..adf8434 100644 --- a/src/main/resources/create_so.mixins.json +++ b/src/main/resources/create_so.mixins.json @@ -4,7 +4,6 @@ "package": "com.ghasto.create_so.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "BeltInventoryAccess", "SandpaperItemMixin" ], "client": [ diff --git a/src/main/resources/data/create_so/recipes/polishing/test_polishing.json b/src/main/resources/data/create_so/recipes/polishing/test_polishing.json deleted file mode 100644 index 35df847..0000000 --- a/src/main/resources/data/create_so/recipes/polishing/test_polishing.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "create_so:polishing", - "ingredients": [ - { - "item": "create:rose_quartz" - } - ], - "processingTime": 100, - "results": [ - { - "count": 1, - "item": "create:polished_rose_quartz" - } - ] -} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 393e5b3..792348f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -17,6 +17,9 @@ ], "fabric-datagen": [ "com.ghasto.create_so.CreateSandpaperOverhaul" + ], + "emi": [ + "com.ghasto.create_so.compat.emi.ModEMICompat" ] }, "mixins": [