From 581dc8dfb4f4b303f2ef3555f6de3898c467761a Mon Sep 17 00:00:00 2001 From: Buuz135 Date: Sun, 18 Aug 2024 14:31:42 +0200 Subject: [PATCH] Added patchouli integration back --- .github/workflows/publish.yaml | 2 +- build.gradle | 2 ++ gradle.properties | 4 +++- .../sushigocrafting/compat/PatchouliPlugin.java | 12 ++++++++---- .../patchouli_books/sushigocrafting/book.json | 2 +- .../resources/data/sushigocrafting/recipe/book.json | 10 ++++++++-- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 2176db2..875e59d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -34,7 +34,7 @@ jobs: files-secondary: build/libs/*-@(dev|sources).jar version-type: beta version: ${{ github.ref_name }} - loaders: forge + loaders: neoforge game-versions: | 1.21 1.21.1 diff --git a/build.gradle b/build.gradle index 59f5488..698e4d7 100644 --- a/build.gradle +++ b/build.gradle @@ -74,6 +74,8 @@ dependencies { implementation project.dependencies.create('com.hrznstudio:titanium:1.21-4.0.12') implementation "curse.maven:jade-324717:5444008" implementation "curse.maven:crafttweaker-239197:5606075" + compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}" + runtimeOnly "vazkii.patchouli:Patchouli:${patchouli_version}" } // This block of code expands all declared replace properties in the specified resource targets. diff --git a/gradle.properties b/gradle.properties index 91b7401..52f36fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,4 +36,6 @@ mod_group_id=com.buuz135 mod_authors=Buuz135 # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. mod_description=Sushi! -jei_version=19.8.2.99 \ No newline at end of file + +jei_version=19.8.2.99 +patchouli_version=1.21-87-NEOFORGE-SNAPSHOT \ No newline at end of file diff --git a/src/main/java/com/buuz135/sushigocrafting/compat/PatchouliPlugin.java b/src/main/java/com/buuz135/sushigocrafting/compat/PatchouliPlugin.java index 1830f33..9d2d143 100644 --- a/src/main/java/com/buuz135/sushigocrafting/compat/PatchouliPlugin.java +++ b/src/main/java/com/buuz135/sushigocrafting/compat/PatchouliPlugin.java @@ -5,7 +5,12 @@ import com.hrznstudio.titanium.event.handler.EventManager; import com.hrznstudio.titanium.plugin.FeaturePluginInstance; import com.hrznstudio.titanium.plugin.PluginPhase; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; +import vazkii.patchouli.api.PatchouliAPI; +import vazkii.patchouli.common.item.PatchouliDataComponents; @FeaturePlugin(value = "patchouli", type = FeaturePlugin.FeaturePluginType.MOD) public class PatchouliPlugin implements FeaturePluginInstance { @@ -16,10 +21,9 @@ public void execute(PluginPhase phase) { if (phase == PluginPhase.CONSTRUCTION) { EventManager.mod(BuildCreativeModeTabContentsEvent.class).process(buildCreativeModeTabContentsEvent -> { if (SushiGoCrafting.TAB.getResourceLocation().equals(buildCreativeModeTabContentsEvent.getTabKey().location())) { - //TODO 1.21 - //var item = new ItemStack(ForgeRegistries.ITEMS.getValue(ResourceLocation.fromNamespaceAndPath("patchouli", "guide_book"))); - //item.getOrCreateTag().putString("patchouli:book", "sushigocrafting:sushigocrafting"); - //buildCreativeModeTabContentsEvent.accept(item); + var item = new ItemStack(BuiltInRegistries.ITEM.get(ResourceLocation.fromNamespaceAndPath("patchouli", "guide_book"))); + item.set(PatchouliDataComponents.BOOK, ResourceLocation.fromNamespaceAndPath("sushigocrafting", "sushigocrafting")); + buildCreativeModeTabContentsEvent.accept(item); } }).subscribe(); } diff --git a/src/main/resources/data/sushigocrafting/patchouli_books/sushigocrafting/book.json b/src/main/resources/data/sushigocrafting/patchouli_books/sushigocrafting/book.json index a6d4353..e54325c 100644 --- a/src/main/resources/data/sushigocrafting/patchouli_books/sushigocrafting/book.json +++ b/src/main/resources/data/sushigocrafting/patchouli_books/sushigocrafting/book.json @@ -1,7 +1,7 @@ { "name": "text.sushigocrafting.book.title", "landing_text": "Welcome to SushiGoCrafting, a deep food mod using sushi! $(br2)You can become my patreon $(l:https://www.patreon.com/buuz135)here$().", - "book_texture": "patchouli:textures/gui/book_cyan.png", + "book_texture": "patchouli:textures/gui/book_green.png", "version": "GRADLE:VERSION", "text_color": "5A5766", "header_color": "48435C", diff --git a/src/main/resources/data/sushigocrafting/recipe/book.json b/src/main/resources/data/sushigocrafting/recipe/book.json index 4de4355..01b80f0 100644 --- a/src/main/resources/data/sushigocrafting/recipe/book.json +++ b/src/main/resources/data/sushigocrafting/recipe/book.json @@ -1,4 +1,10 @@ { + "neoforge:conditions": [ + { + "type": "neoforge:mod_loaded", + "modid": "patchouli" + } + ], "type": "minecraft:crafting_shapeless", "ingredients": [ { @@ -12,8 +18,8 @@ } ], "result": { - "item": "patchouli:guide_book", - "nbt": { + "id": "patchouli:guide_book", + "components": { "patchouli:book": "sushigocrafting:sushigocrafting" } }