From 748ef78b3a75f72cc2307b87c69f3f0fbb357a10 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 30 Mar 2020 21:24:07 -0500 Subject: [PATCH] Petal recipes to json --- .../botania/recipes/petal/agricarnation.json | 26 +++ .../botania/recipes/petal/bellethorn.json | 26 +++ .../data/botania/recipes/petal/bergamute.json | 20 ++ .../data/botania/recipes/petal/bubbell.json | 35 ++++ .../data/botania/recipes/petal/clayconia.json | 23 +++ .../data/botania/recipes/petal/daffomill.json | 26 +++ .../botania/recipes/petal/dandelifeon.json | 35 ++++ .../botania/recipes/petal/dreadthorn.json | 26 +++ .../data/botania/recipes/petal/endoflame.json | 20 ++ .../botania/recipes/petal/entropinnyum.json | 32 +++ .../data/botania/recipes/petal/exoflame.json | 26 +++ .../botania/recipes/petal/fallen_kanade.json | 26 +++ .../botania/recipes/petal/gourmaryllis.json | 29 +++ .../botania/recipes/petal/heisei_dream.json | 26 +++ .../botania/recipes/petal/hopperhock.json | 26 +++ .../data/botania/recipes/petal/hyacidus.json | 32 +++ .../botania/recipes/petal/hydroangeas.json | 20 ++ .../recipes/petal/jaded_amaranthus.json | 23 +++ .../data/botania/recipes/petal/jiyuulia.json | 26 +++ .../data/botania/recipes/petal/kekimurus.json | 32 +++ .../data/botania/recipes/petal/loonium.json | 38 ++++ .../data/botania/recipes/petal/manastar.json | 20 ++ .../botania/recipes/petal/marimorphosis.json | 29 +++ .../data/botania/recipes/petal/medumone.json | 26 +++ .../data/botania/recipes/petal/munchdew.json | 26 +++ .../botania/recipes/petal/narslimmus.json | 29 +++ .../data/botania/recipes/petal/orechid.json | 35 ++++ .../botania/recipes/petal/orechid_ignem.json | 35 ++++ .../botania/recipes/petal/pollidisiac.json | 29 +++ .../botania/recipes/petal/pure_daisy.json | 20 ++ .../botania/recipes/petal/rafflowsia.json | 32 +++ .../botania/recipes/petal/rannuncarpus.json | 23 +++ .../botania/recipes/petal/rosa_arcana.json | 26 +++ .../botania/recipes/petal/shulk_me_not.json | 32 +++ .../botania/recipes/petal/solegnolia.json | 23 +++ .../botania/recipes/petal/spectranthemum.json | 35 ++++ .../botania/recipes/petal/spectrolus.json | 41 ++++ .../botania/recipes/petal/tangleberrie.json | 26 +++ .../botania/recipes/petal/thermalily.json | 23 +++ .../data/botania/recipes/petal/tigerseye.json | 23 +++ .../botania/recipes/petal/vazkii_head.json | 59 ++++++ .../botania/recipes/petal/vinculotus.json | 35 ++++ .../botania/api/recipe/RecipePetals.java | 113 +++++++--- .../integration/jei/JEIBotaniaPlugin.java | 2 +- .../PetalApothecaryRecipeCategory.java | 4 +- .../component/RotatingRecipeComponent.java | 13 +- .../processor/PetalApothecaryProcessor.java | 12 +- .../processor/RunicAltarProcessor.java | 2 +- .../botania/common/block/tile/TileAltar.java | 64 +++--- .../common/crafting/ModPetalRecipes.java | 140 ------------- .../common/crafting/ModRecipeTypes.java | 12 +- .../botania/common/crafting/SyncHandler.java | 5 +- .../common/network/PacketSyncRecipes.java | 18 +- .../vazkii/botania/data/DataGenerators.java | 1 + .../botania/data/recipes/PetalProvider.java | 193 ++++++++++++++++++ 55 files changed, 1545 insertions(+), 234 deletions(-) create mode 100644 src/generated/resources/data/botania/recipes/petal/agricarnation.json create mode 100644 src/generated/resources/data/botania/recipes/petal/bellethorn.json create mode 100644 src/generated/resources/data/botania/recipes/petal/bergamute.json create mode 100644 src/generated/resources/data/botania/recipes/petal/bubbell.json create mode 100644 src/generated/resources/data/botania/recipes/petal/clayconia.json create mode 100644 src/generated/resources/data/botania/recipes/petal/daffomill.json create mode 100644 src/generated/resources/data/botania/recipes/petal/dandelifeon.json create mode 100644 src/generated/resources/data/botania/recipes/petal/dreadthorn.json create mode 100644 src/generated/resources/data/botania/recipes/petal/endoflame.json create mode 100644 src/generated/resources/data/botania/recipes/petal/entropinnyum.json create mode 100644 src/generated/resources/data/botania/recipes/petal/exoflame.json create mode 100644 src/generated/resources/data/botania/recipes/petal/fallen_kanade.json create mode 100644 src/generated/resources/data/botania/recipes/petal/gourmaryllis.json create mode 100644 src/generated/resources/data/botania/recipes/petal/heisei_dream.json create mode 100644 src/generated/resources/data/botania/recipes/petal/hopperhock.json create mode 100644 src/generated/resources/data/botania/recipes/petal/hyacidus.json create mode 100644 src/generated/resources/data/botania/recipes/petal/hydroangeas.json create mode 100644 src/generated/resources/data/botania/recipes/petal/jaded_amaranthus.json create mode 100644 src/generated/resources/data/botania/recipes/petal/jiyuulia.json create mode 100644 src/generated/resources/data/botania/recipes/petal/kekimurus.json create mode 100644 src/generated/resources/data/botania/recipes/petal/loonium.json create mode 100644 src/generated/resources/data/botania/recipes/petal/manastar.json create mode 100644 src/generated/resources/data/botania/recipes/petal/marimorphosis.json create mode 100644 src/generated/resources/data/botania/recipes/petal/medumone.json create mode 100644 src/generated/resources/data/botania/recipes/petal/munchdew.json create mode 100644 src/generated/resources/data/botania/recipes/petal/narslimmus.json create mode 100644 src/generated/resources/data/botania/recipes/petal/orechid.json create mode 100644 src/generated/resources/data/botania/recipes/petal/orechid_ignem.json create mode 100644 src/generated/resources/data/botania/recipes/petal/pollidisiac.json create mode 100644 src/generated/resources/data/botania/recipes/petal/pure_daisy.json create mode 100644 src/generated/resources/data/botania/recipes/petal/rafflowsia.json create mode 100644 src/generated/resources/data/botania/recipes/petal/rannuncarpus.json create mode 100644 src/generated/resources/data/botania/recipes/petal/rosa_arcana.json create mode 100644 src/generated/resources/data/botania/recipes/petal/shulk_me_not.json create mode 100644 src/generated/resources/data/botania/recipes/petal/solegnolia.json create mode 100644 src/generated/resources/data/botania/recipes/petal/spectranthemum.json create mode 100644 src/generated/resources/data/botania/recipes/petal/spectrolus.json create mode 100644 src/generated/resources/data/botania/recipes/petal/tangleberrie.json create mode 100644 src/generated/resources/data/botania/recipes/petal/thermalily.json create mode 100644 src/generated/resources/data/botania/recipes/petal/tigerseye.json create mode 100644 src/generated/resources/data/botania/recipes/petal/vazkii_head.json create mode 100644 src/generated/resources/data/botania/recipes/petal/vinculotus.json delete mode 100644 src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java create mode 100644 src/main/java/vazkii/botania/data/recipes/PetalProvider.java diff --git a/src/generated/resources/data/botania/recipes/petal/agricarnation.json b/src/generated/resources/data/botania/recipes/petal/agricarnation.json new file mode 100644 index 000000000..03a24ea88 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/agricarnation.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:agricarnation" + }, + "ingredients": [ + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:runes/spring" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/bellethorn.json b/src/generated/resources/data/botania/recipes/petal/bellethorn.json new file mode 100644 index 000000000..d9ee00636 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/bellethorn.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:bellethorn" + }, + "ingredients": [ + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:petals/cyan" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/bergamute.json b/src/generated/resources/data/botania/recipes/petal/bergamute.json new file mode 100644 index 000000000..c6d68083d --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/bergamute.json @@ -0,0 +1,20 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:bergamute" + }, + "ingredients": [ + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/green" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/bubbell.json b/src/generated/resources/data/botania/recipes/petal/bubbell.json new file mode 100644 index 000000000..c1918b9ee --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/bubbell.json @@ -0,0 +1,35 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:bubbell" + }, + "ingredients": [ + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:petals/light_blue" + }, + { + "tag": "botania:petals/light_blue" + }, + { + "tag": "botania:petals/blue" + }, + { + "tag": "botania:petals/blue" + }, + { + "tag": "botania:runes/water" + }, + { + "tag": "botania:runes/summer" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/clayconia.json b/src/generated/resources/data/botania/recipes/petal/clayconia.json new file mode 100644 index 000000000..07faf9c13 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/clayconia.json @@ -0,0 +1,23 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:clayconia" + }, + "ingredients": [ + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:runes/earth" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/daffomill.json b/src/generated/resources/data/botania/recipes/petal/daffomill.json new file mode 100644 index 000000000..3a3d4b905 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/daffomill.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:daffomill" + }, + "ingredients": [ + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:runes/air" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/dandelifeon.json b/src/generated/resources/data/botania/recipes/petal/dandelifeon.json new file mode 100644 index 000000000..baf7b9834 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/dandelifeon.json @@ -0,0 +1,35 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:dandelifeon" + }, + "ingredients": [ + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:runes/water" + }, + { + "tag": "botania:runes/fire" + }, + { + "tag": "botania:runes/earth" + }, + { + "tag": "botania:runes/air" + }, + { + "item": "botania:life_essence" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/dreadthorn.json b/src/generated/resources/data/botania/recipes/petal/dreadthorn.json new file mode 100644 index 000000000..ba9a471ea --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/dreadthorn.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:dreadthorn" + }, + "ingredients": [ + { + "tag": "botania:petals/black" + }, + { + "tag": "botania:petals/black" + }, + { + "tag": "botania:petals/black" + }, + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:petals/cyan" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/endoflame.json b/src/generated/resources/data/botania/recipes/petal/endoflame.json new file mode 100644 index 000000000..5fd693b1d --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/endoflame.json @@ -0,0 +1,20 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:endoflame" + }, + "ingredients": [ + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/light_gray" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/entropinnyum.json b/src/generated/resources/data/botania/recipes/petal/entropinnyum.json new file mode 100644 index 000000000..1f3fb0d0b --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/entropinnyum.json @@ -0,0 +1,32 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:entropinnyum" + }, + "ingredients": [ + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:runes/wrath" + }, + { + "tag": "botania:runes/fire" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/exoflame.json b/src/generated/resources/data/botania/recipes/petal/exoflame.json new file mode 100644 index 000000000..e4eb3c335 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/exoflame.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:exoflame" + }, + "ingredients": [ + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:runes/fire" + }, + { + "tag": "botania:runes/summer" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/fallen_kanade.json b/src/generated/resources/data/botania/recipes/petal/fallen_kanade.json new file mode 100644 index 000000000..7c6a0c9bf --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/fallen_kanade.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:fallen_kanade" + }, + "ingredients": [ + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:runes/spring" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/gourmaryllis.json b/src/generated/resources/data/botania/recipes/petal/gourmaryllis.json new file mode 100644 index 000000000..5e8bbc112 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/gourmaryllis.json @@ -0,0 +1,29 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:gourmaryllis" + }, + "ingredients": [ + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:runes/fire" + }, + { + "tag": "botania:runes/summer" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/heisei_dream.json b/src/generated/resources/data/botania/recipes/petal/heisei_dream.json new file mode 100644 index 000000000..c4774f786 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/heisei_dream.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:heisei_dream" + }, + "ingredients": [ + { + "tag": "botania:petals/magenta" + }, + { + "tag": "botania:petals/magenta" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:runes/wrath" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/hopperhock.json b/src/generated/resources/data/botania/recipes/petal/hopperhock.json new file mode 100644 index 000000000..ec63e5aae --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/hopperhock.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:hopperhock" + }, + "ingredients": [ + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:runes/air" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/hyacidus.json b/src/generated/resources/data/botania/recipes/petal/hyacidus.json new file mode 100644 index 000000000..989f9a844 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/hyacidus.json @@ -0,0 +1,32 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:hyacidus" + }, + "ingredients": [ + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/magenta" + }, + { + "tag": "botania:petals/magenta" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:runes/water" + }, + { + "tag": "botania:runes/autumn" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/hydroangeas.json b/src/generated/resources/data/botania/recipes/petal/hydroangeas.json new file mode 100644 index 000000000..d070d8beb --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/hydroangeas.json @@ -0,0 +1,20 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:hydroangeas" + }, + "ingredients": [ + { + "tag": "botania:petals/blue" + }, + { + "tag": "botania:petals/blue" + }, + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:petals/cyan" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/jaded_amaranthus.json b/src/generated/resources/data/botania/recipes/petal/jaded_amaranthus.json new file mode 100644 index 000000000..66030d269 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/jaded_amaranthus.json @@ -0,0 +1,23 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:jaded_amaranthus" + }, + "ingredients": [ + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:runes/spring" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/jiyuulia.json b/src/generated/resources/data/botania/recipes/petal/jiyuulia.json new file mode 100644 index 000000000..aabe2372c --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/jiyuulia.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:jiyuulia" + }, + "ingredients": [ + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:runes/water" + }, + { + "tag": "botania:runes/air" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/kekimurus.json b/src/generated/resources/data/botania/recipes/petal/kekimurus.json new file mode 100644 index 000000000..c65181aa2 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/kekimurus.json @@ -0,0 +1,32 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:kekimurus" + }, + "ingredients": [ + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:runes/gluttony" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/loonium.json b/src/generated/resources/data/botania/recipes/petal/loonium.json new file mode 100644 index 000000000..4b4bd6957 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/loonium.json @@ -0,0 +1,38 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:loonium" + }, + "ingredients": [ + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:runes/sloth" + }, + { + "tag": "botania:runes/gluttony" + }, + { + "tag": "botania:runes/envy" + }, + { + "item": "botania:redstone_root" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/manastar.json b/src/generated/resources/data/botania/recipes/petal/manastar.json new file mode 100644 index 000000000..f2daa0923 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/manastar.json @@ -0,0 +1,20 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:manastar" + }, + "ingredients": [ + { + "tag": "botania:petals/light_blue" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/cyan" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/marimorphosis.json b/src/generated/resources/data/botania/recipes/petal/marimorphosis.json new file mode 100644 index 000000000..8eae9f326 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/marimorphosis.json @@ -0,0 +1,29 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:marimorphosis" + }, + "ingredients": [ + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:runes/earth" + }, + { + "tag": "botania:runes/fire" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/medumone.json b/src/generated/resources/data/botania/recipes/petal/medumone.json new file mode 100644 index 000000000..478ff6f6b --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/medumone.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:medumone" + }, + "ingredients": [ + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:runes/earth" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/munchdew.json b/src/generated/resources/data/botania/recipes/petal/munchdew.json new file mode 100644 index 000000000..2ec18bb17 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/munchdew.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:munchdew" + }, + "ingredients": [ + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:runes/gluttony" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/narslimmus.json b/src/generated/resources/data/botania/recipes/petal/narslimmus.json new file mode 100644 index 000000000..2c75ccc4b --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/narslimmus.json @@ -0,0 +1,29 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:narslimmus" + }, + "ingredients": [ + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/black" + }, + { + "tag": "botania:runes/summer" + }, + { + "tag": "botania:runes/water" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/orechid.json b/src/generated/resources/data/botania/recipes/petal/orechid.json new file mode 100644 index 000000000..1f5ccf0d1 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/orechid.json @@ -0,0 +1,35 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:orechid" + }, + "ingredients": [ + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:runes/pride" + }, + { + "tag": "botania:runes/greed" + }, + { + "item": "botania:redstone_root" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/orechid_ignem.json b/src/generated/resources/data/botania/recipes/petal/orechid_ignem.json new file mode 100644 index 000000000..4d75aa630 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/orechid_ignem.json @@ -0,0 +1,35 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:orechid_ignem" + }, + "ingredients": [ + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:runes/pride" + }, + { + "tag": "botania:runes/greed" + }, + { + "item": "botania:redstone_root" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/pollidisiac.json b/src/generated/resources/data/botania/recipes/petal/pollidisiac.json new file mode 100644 index 000000000..4c0640da5 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/pollidisiac.json @@ -0,0 +1,29 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:pollidisiac" + }, + "ingredients": [ + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:runes/lust" + }, + { + "tag": "botania:runes/fire" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/pure_daisy.json b/src/generated/resources/data/botania/recipes/petal/pure_daisy.json new file mode 100644 index 000000000..d19a09cc6 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/pure_daisy.json @@ -0,0 +1,20 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:pure_daisy" + }, + "ingredients": [ + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/rafflowsia.json b/src/generated/resources/data/botania/recipes/petal/rafflowsia.json new file mode 100644 index 000000000..18521771a --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/rafflowsia.json @@ -0,0 +1,32 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:rafflowsia" + }, + "ingredients": [ + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/black" + }, + { + "tag": "botania:runes/earth" + }, + { + "tag": "botania:runes/pride" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/rannuncarpus.json b/src/generated/resources/data/botania/recipes/petal/rannuncarpus.json new file mode 100644 index 000000000..0004fce94 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/rannuncarpus.json @@ -0,0 +1,23 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:rannuncarpus" + }, + "ingredients": [ + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:runes/earth" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/rosa_arcana.json b/src/generated/resources/data/botania/recipes/petal/rosa_arcana.json new file mode 100644 index 000000000..ae4b542c3 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/rosa_arcana.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:rosa_arcana" + }, + "ingredients": [ + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:runes/mana" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/shulk_me_not.json b/src/generated/resources/data/botania/recipes/petal/shulk_me_not.json new file mode 100644 index 000000000..3098e2fa9 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/shulk_me_not.json @@ -0,0 +1,32 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:shulk_me_not" + }, + "ingredients": [ + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/magenta" + }, + { + "tag": "botania:petals/magenta" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "item": "botania:life_essence" + }, + { + "tag": "botania:runes/envy" + }, + { + "tag": "botania:runes/wrath" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/solegnolia.json b/src/generated/resources/data/botania/recipes/petal/solegnolia.json new file mode 100644 index 000000000..635d00cb2 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/solegnolia.json @@ -0,0 +1,23 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:solegnolia" + }, + "ingredients": [ + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/blue" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/spectranthemum.json b/src/generated/resources/data/botania/recipes/petal/spectranthemum.json new file mode 100644 index 000000000..19ec20e13 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/spectranthemum.json @@ -0,0 +1,35 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:spectranthemum" + }, + "ingredients": [ + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:runes/envy" + }, + { + "tag": "botania:runes/water" + }, + { + "item": "botania:redstone_root" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/spectrolus.json b/src/generated/resources/data/botania/recipes/petal/spectrolus.json new file mode 100644 index 000000000..6d3bdf22f --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/spectrolus.json @@ -0,0 +1,41 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:spectrolus" + }, + "ingredients": [ + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:petals/blue" + }, + { + "tag": "botania:petals/blue" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:petals/white" + }, + { + "tag": "botania:runes/winter" + }, + { + "tag": "botania:runes/air" + }, + { + "item": "botania:pixie_dust" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/tangleberrie.json b/src/generated/resources/data/botania/recipes/petal/tangleberrie.json new file mode 100644 index 000000000..268835f41 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/tangleberrie.json @@ -0,0 +1,26 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:tangleberrie" + }, + "ingredients": [ + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:petals/cyan" + }, + { + "tag": "botania:petals/gray" + }, + { + "tag": "botania:petals/light_gray" + }, + { + "tag": "botania:runes/air" + }, + { + "tag": "botania:runes/earth" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/thermalily.json b/src/generated/resources/data/botania/recipes/petal/thermalily.json new file mode 100644 index 000000000..35b1a9f59 --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/thermalily.json @@ -0,0 +1,23 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:thermalily" + }, + "ingredients": [ + { + "tag": "botania:petals/red" + }, + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:runes/earth" + }, + { + "tag": "botania:runes/fire" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/tigerseye.json b/src/generated/resources/data/botania/recipes/petal/tigerseye.json new file mode 100644 index 000000000..babcd2d6d --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/tigerseye.json @@ -0,0 +1,23 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:tigerseye" + }, + "ingredients": [ + { + "tag": "botania:petals/yellow" + }, + { + "tag": "botania:petals/brown" + }, + { + "tag": "botania:petals/orange" + }, + { + "tag": "botania:petals/lime" + }, + { + "tag": "botania:runes/autumn" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/vazkii_head.json b/src/generated/resources/data/botania/recipes/petal/vazkii_head.json new file mode 100644 index 000000000..57da1737d --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/vazkii_head.json @@ -0,0 +1,59 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "minecraft:player_head", + "tag": { + "SkullOwner": "Vazkii" + } + }, + "ingredients": [ + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + }, + { + "tag": "botania:petals/pink" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/botania/recipes/petal/vinculotus.json b/src/generated/resources/data/botania/recipes/petal/vinculotus.json new file mode 100644 index 000000000..c3b27eaaf --- /dev/null +++ b/src/generated/resources/data/botania/recipes/petal/vinculotus.json @@ -0,0 +1,35 @@ +{ + "type": "botania:petal_apothecary", + "output": { + "item": "botania:vinculotus" + }, + "ingredients": [ + { + "tag": "botania:petals/black" + }, + { + "tag": "botania:petals/black" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/purple" + }, + { + "tag": "botania:petals/green" + }, + { + "tag": "botania:runes/water" + }, + { + "tag": "botania:runes/sloth" + }, + { + "tag": "botania:runes/lust" + }, + { + "item": "botania:redstone_root" + } + ] +} \ No newline at end of file diff --git a/src/main/java/vazkii/botania/api/recipe/RecipePetals.java b/src/main/java/vazkii/botania/api/recipe/RecipePetals.java index f47384ffd..9b29cc39c 100644 --- a/src/main/java/vazkii/botania/api/recipe/RecipePetals.java +++ b/src/main/java/vazkii/botania/api/recipe/RecipePetals.java @@ -8,32 +8,45 @@ */ package vazkii.botania.api.recipe; -import com.google.common.collect.ImmutableList; - +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.IRecipeSerializer; +import net.minecraft.item.crafting.IRecipeType; import net.minecraft.item.crafting.Ingredient; import net.minecraft.network.PacketBuffer; +import net.minecraft.util.JSONUtils; +import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.items.IItemHandler; +import net.minecraft.world.World; +import net.minecraftforge.common.crafting.CraftingHelper; +import net.minecraftforge.items.wrapper.RecipeWrapper; +import net.minecraftforge.registries.ForgeRegistryEntry; +import vazkii.botania.common.block.ModBlocks; +import vazkii.botania.common.crafting.ModRecipeTypes; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; -public class RecipePetals implements IModRecipe { +public class RecipePetals implements IRecipe { private final ResourceLocation id; private final ItemStack output; - private final ImmutableList inputs; + private final NonNullList inputs; public RecipePetals(ResourceLocation id, ItemStack output, Ingredient... inputs) { this.id = id; this.output = output; - this.inputs = ImmutableList.copyOf(inputs); + this.inputs = NonNullList.from(null, inputs); } - public boolean matches(IItemHandler inv) { + @Override + public boolean matches(RecipeWrapper inv, @Nonnull World world) { List ingredientsMissing = new ArrayList<>(inputs); - for (int i = 0; i < inv.getSlots(); i++) { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack input = inv.getStackInSlot(i); if (input.isEmpty()) { break; @@ -59,36 +72,84 @@ public class RecipePetals implements IModRecipe { return ingredientsMissing.isEmpty(); } + @Nonnull + @Override + public ItemStack getRecipeOutput() { + return output; + } + + @Nonnull + @Override + public NonNullList getIngredients() { + return inputs; + } + + @Nonnull + @Override public ItemStack getIcon() { + return new ItemStack(ModBlocks.defaultAltar); + } + + @Nonnull @Override public ResourceLocation getId() { return id; } - public List getInputs() { - return inputs; + @Nonnull + @Override + public IRecipeSerializer getSerializer() { + return ModRecipeTypes.PETAL_SERIALIZER; } - public ItemStack getOutput() { - return output; + @Nonnull + @Override + public IRecipeType getType() { + return ModRecipeTypes.PETAL_TYPE; } - public void write(PacketBuffer buf) { - buf.writeResourceLocation(id); - buf.writeVarInt(inputs.size()); - for (Ingredient input : inputs) { - input.write(buf); + // Ignored IRecipe methods + @Nonnull + @Override + public ItemStack getCraftingResult(@Nonnull RecipeWrapper inv) { + return getRecipeOutput(); + } + + @Override + public boolean canFit(int width, int height) { + return false; + } + + public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + @Nonnull + @Override + public RecipePetals read(@Nonnull ResourceLocation id, @Nonnull JsonObject json) { + ItemStack output = CraftingHelper.getItemStack(JSONUtils.getJsonObject(json, "output"), true); + JsonArray ingrs = JSONUtils.getJsonArray(json, "ingredients"); + List inputs = new ArrayList<>(); + for (JsonElement e : ingrs) { + inputs.add(Ingredient.deserialize(e)); + } + return new RecipePetals(id, output, inputs.toArray(new Ingredient[0])); } - buf.writeItemStack(output, false); - } - public static RecipePetals read(PacketBuffer buf) { - ResourceLocation id = buf.readResourceLocation(); - Ingredient[] inputs = new Ingredient[buf.readVarInt()]; - for (int i = 0; i < inputs.length; i++) { - inputs[i] = Ingredient.read(buf); + @Override + public RecipePetals read(@Nonnull ResourceLocation id, @Nonnull PacketBuffer buf) { + Ingredient[] inputs = new Ingredient[buf.readVarInt()]; + for (int i = 0; i < inputs.length; i++) { + inputs[i] = Ingredient.read(buf); + } + ItemStack output = buf.readItemStack(); + return new RecipePetals(id, output, inputs); } - ItemStack output = buf.readItemStack(); - return new RecipePetals(id, output, inputs); + + @Override + public void write(@Nonnull PacketBuffer buf, @Nonnull RecipePetals recipe) { + buf.writeVarInt(recipe.getIngredients().size()); + for (Ingredient input : recipe.getIngredients()) { + input.write(buf); + } + } + } } diff --git a/src/main/java/vazkii/botania/client/integration/jei/JEIBotaniaPlugin.java b/src/main/java/vazkii/botania/client/integration/jei/JEIBotaniaPlugin.java index 46038827b..0bfa6007f 100644 --- a/src/main/java/vazkii/botania/client/integration/jei/JEIBotaniaPlugin.java +++ b/src/main/java/vazkii/botania/client/integration/jei/JEIBotaniaPlugin.java @@ -123,7 +123,7 @@ public class JEIBotaniaPlugin implements IModPlugin { public void registerRecipes(@Nonnull IRecipeRegistration registry) { registry.addRecipes(Minecraft.getInstance().world.getRecipeManager().getRecipes(ModRecipeTypes.BREW_TYPE).values(), BreweryRecipeCategory.UID); registry.addRecipes(Minecraft.getInstance().world.getRecipeManager().getRecipes(ModRecipeTypes.PURE_DAISY_TYPE).values(), PureDaisyRecipeCategory.UID); - registry.addRecipes(BotaniaAPI.petalRecipes.values(), PetalApothecaryRecipeCategory.UID); + registry.addRecipes(Minecraft.getInstance().world.getRecipeManager().getRecipes(ModRecipeTypes.PETAL_TYPE).values(), PetalApothecaryRecipeCategory.UID); registry.addRecipes(TileAlfPortal.elvenTradeRecipes(Minecraft.getInstance().world.getRecipeManager()), ElvenTradeRecipeCategory.UID); registry.addRecipes(BotaniaAPI.runeAltarRecipes.values(), RunicAltarRecipeCategory.UID); registry.addRecipes(TilePool.manaInfusionRecipes(Minecraft.getInstance().world.getRecipeManager()), ManaPoolRecipeCategory.UID); diff --git a/src/main/java/vazkii/botania/client/integration/jei/petalapothecary/PetalApothecaryRecipeCategory.java b/src/main/java/vazkii/botania/client/integration/jei/petalapothecary/PetalApothecaryRecipeCategory.java index c63215e17..710554992 100644 --- a/src/main/java/vazkii/botania/client/integration/jei/petalapothecary/PetalApothecaryRecipeCategory.java +++ b/src/main/java/vazkii/botania/client/integration/jei/petalapothecary/PetalApothecaryRecipeCategory.java @@ -83,11 +83,11 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory> list = new ArrayList<>(); - for (Ingredient ingr : recipe.getInputs()) { + for (Ingredient ingr : recipe.getIngredients()) { list.add(Arrays.asList(ingr.getMatchingStacks())); } iIngredients.setInputLists(VanillaTypes.ITEM, list); - iIngredients.setOutput(VanillaTypes.ITEM, recipe.getOutput()); + iIngredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); } @Override diff --git a/src/main/java/vazkii/botania/client/patchouli/component/RotatingRecipeComponent.java b/src/main/java/vazkii/botania/client/patchouli/component/RotatingRecipeComponent.java index 3278ec769..4b1011e57 100644 --- a/src/main/java/vazkii/botania/client/patchouli/component/RotatingRecipeComponent.java +++ b/src/main/java/vazkii/botania/client/patchouli/component/RotatingRecipeComponent.java @@ -10,12 +10,16 @@ package vazkii.botania.client.patchouli.component; import com.google.gson.annotations.SerializedName; +import net.minecraft.client.Minecraft; +import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.IModRecipe; +import vazkii.botania.common.crafting.ModRecipeTypes; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -30,16 +34,15 @@ public class RotatingRecipeComponent extends RotatingItemListComponentBase { @Override protected List makeIngredients() { - Map map; + Map> map; if ("runic_altar".equals(recipeType)) { - map = BotaniaAPI.runeAltarRecipes; + map = Collections.emptyMap(); // BotaniaAPI.runeAltarRecipes; } else if ("petal_apothecary".equals(recipeType)) { - map = BotaniaAPI.petalRecipes; + map = Minecraft.getInstance().world.getRecipeManager().getRecipes(ModRecipeTypes.PETAL_TYPE); } else { throw new IllegalArgumentException("Type must be 'runic_altar' or 'petal_apothecary'!"); } - IModRecipe recipe = map.get(new ResourceLocation(recipeName)); - return recipe.getInputs(); + return map.get(new ResourceLocation(recipeName)).getIngredients(); } @Override diff --git a/src/main/java/vazkii/botania/client/patchouli/processor/PetalApothecaryProcessor.java b/src/main/java/vazkii/botania/client/patchouli/processor/PetalApothecaryProcessor.java index 154c6b34a..1d4786791 100644 --- a/src/main/java/vazkii/botania/client/patchouli/processor/PetalApothecaryProcessor.java +++ b/src/main/java/vazkii/botania/client/patchouli/processor/PetalApothecaryProcessor.java @@ -8,20 +8,24 @@ */ package vazkii.botania.client.patchouli.processor; +import net.minecraft.client.Minecraft; +import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.IModRecipe; +import vazkii.botania.common.crafting.ModRecipeTypes; import vazkii.patchouli.api.IComponentProcessor; import vazkii.patchouli.api.IVariableProvider; import vazkii.patchouli.api.PatchouliAPI; public class PetalApothecaryProcessor implements IComponentProcessor { - protected IModRecipe recipe; + protected IRecipe recipe; @Override public void setup(IVariableProvider variables) { - this.recipe = BotaniaAPI.petalRecipes.get(new ResourceLocation(variables.get("recipe"))); + ResourceLocation id = new ResourceLocation(variables.get("recipe")); + this.recipe = Minecraft.getInstance().world.getRecipeManager().getRecipes(ModRecipeTypes.PETAL_TYPE).get(id); } @Override @@ -33,9 +37,9 @@ public class PetalApothecaryProcessor implements IComponentProcessor { case "recipe": return recipe.getId().toString(); case "output": - return PatchouliAPI.instance.serializeItemStack(recipe.getOutput()); + return PatchouliAPI.instance.serializeItemStack(recipe.getRecipeOutput()); case "heading": - return recipe.getOutput().getDisplayName().getString(); + return recipe.getRecipeOutput().getDisplayName().getString(); } return null; } diff --git a/src/main/java/vazkii/botania/client/patchouli/processor/RunicAltarProcessor.java b/src/main/java/vazkii/botania/client/patchouli/processor/RunicAltarProcessor.java index 9a8f238d7..fd84cfc46 100644 --- a/src/main/java/vazkii/botania/client/patchouli/processor/RunicAltarProcessor.java +++ b/src/main/java/vazkii/botania/client/patchouli/processor/RunicAltarProcessor.java @@ -17,7 +17,7 @@ import vazkii.patchouli.api.IVariableProvider; public class RunicAltarProcessor extends PetalApothecaryProcessor { @Override public void setup(IVariableProvider variables) { - this.recipe = BotaniaAPI.runeAltarRecipes.get(new ResourceLocation(variables.get("recipe"))); + this.recipe = null; //BotaniaAPI.runeAltarRecipes.get(new ResourceLocation(variables.get("recipe"))); } @Override diff --git a/src/main/java/vazkii/botania/common/block/tile/TileAltar.java b/src/main/java/vazkii/botania/common/block/tile/TileAltar.java index ca9a845fb..b298a5df0 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileAltar.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileAltar.java @@ -39,6 +39,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.wrapper.RecipeWrapper; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; @@ -52,6 +53,7 @@ import vazkii.botania.client.core.helper.RenderHelper; import vazkii.botania.client.fx.SparkleParticleData; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.core.handler.ModSounds; +import vazkii.botania.common.crafting.ModRecipeTypes; import vazkii.botania.common.lib.LibBlockNames; import vazkii.botania.common.lib.LibMisc; @@ -60,6 +62,7 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.regex.Pattern; public class TileAltar extends TileSimpleInventory implements IPetalApothecary, ITickableTileEntity { @@ -144,29 +147,27 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary, } if (SEED_PATTERN.matcher(stack.getTranslationKey()).find()) { - for (RecipePetals recipe : BotaniaAPI.petalRecipes.values()) { - if (recipe.matches(itemHandler)) { - saveLastRecipe(); + Optional maybeRecipe = world.getRecipeManager().getRecipe(ModRecipeTypes.PETAL_TYPE, new RecipeWrapper(itemHandler), world); + maybeRecipe.ifPresent(recipe -> { + saveLastRecipe(); - for (int i = 0; i < getSizeInventory(); i++) { - itemHandler.setStackInSlot(i, ItemStack.EMPTY); - } - - stack.shrink(1); - - ItemStack output = recipe.getOutput().copy(); - ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output); - outputItem.addTag(ITEM_TAG_APOTHECARY_SPAWNED); - world.addEntity(outputItem); - - setFluid(Fluids.EMPTY); - world.updateComparatorOutputLevel(pos, getBlockState().getBlock()); - - world.addBlockEvent(getPos(), getBlockState().getBlock(), CRAFT_EFFECT_EVENT, 0); - - return true; + for (int i = 0; i < getSizeInventory(); i++) { + itemHandler.setStackInSlot(i, ItemStack.EMPTY); } - } + + stack.shrink(1); + + ItemStack output = recipe.getRecipeOutput().copy(); + ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output); + outputItem.addTag(ITEM_TAG_APOTHECARY_SPAWNED); + world.addEntity(outputItem); + + setFluid(Fluids.EMPTY); + world.updateComparatorOutputLevel(pos, getBlockState().getBlock()); + + world.addBlockEvent(getPos(), getBlockState().getBlock(), CRAFT_EFFECT_EVENT, 0); + }); + return maybeRecipe.isPresent(); } else if (!hasFluidCapability && !item.getTags().contains(ITEM_TAG_APOTHECARY_SPAWNED)) { if (!itemHandler.getStackInSlot(getSizeInventory() - 1).isEmpty()) { return false; @@ -387,19 +388,18 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary, if (amt > 0) { float anglePer = 360F / amt; - for (RecipePetals recipe : BotaniaAPI.petalRecipes.values()) { - if (recipe.matches(itemHandler)) { - RenderSystem.color4f(1F, 1F, 1F, 1F); - mc.textureManager.bindTexture(HUDHandler.manaBar); - RenderHelper.drawTexturedModalRect(xc + radius + 9, yc - 8, 0, 8, 22, 15); + Optional maybeRecipe = world.getRecipeManager().getRecipe(ModRecipeTypes.PETAL_TYPE, new RecipeWrapper(itemHandler), world); + maybeRecipe.ifPresent(recipe -> { + RenderSystem.color4f(1F, 1F, 1F, 1F); + mc.textureManager.bindTexture(HUDHandler.manaBar); + RenderHelper.drawTexturedModalRect(xc + radius + 9, yc - 8, 0, 8, 22, 15); - ItemStack stack = recipe.getOutput(); + ItemStack stack = recipe.getRecipeOutput(); - mc.getItemRenderer().renderItemIntoGUI(stack, xc + radius + 32, yc - 8); - mc.getItemRenderer().renderItemIntoGUI(new ItemStack(Items.WHEAT_SEEDS), xc + radius + 16, yc + 6); - mc.fontRenderer.drawStringWithShadow("+", xc + radius + 14, yc + 10, 0xFFFFFF); - } - } + mc.getItemRenderer().renderItemIntoGUI(stack, xc + radius + 32, yc - 8); + mc.getItemRenderer().renderItemIntoGUI(new ItemStack(Items.WHEAT_SEEDS), xc + radius + 16, yc + 6); + mc.fontRenderer.drawStringWithShadow("+", xc + radius + 14, yc + 10, 0xFFFFFF); + }); for (int i = 0; i < amt; i++) { double xPos = xc + Math.cos(angle * Math.PI / 180D) * radius - 8; diff --git a/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java b/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java deleted file mode 100644 index 56aeeade7..000000000 --- a/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This class is distributed as part of the Botania Mod. - * Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - */ -package vazkii.botania.common.crafting; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ItemTags; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; - -import vazkii.botania.api.recipe.RecipePetals; -import vazkii.botania.api.recipe.RegisterRecipesEvent; -import vazkii.botania.common.Botania; -import vazkii.botania.common.block.ModSubtiles; -import vazkii.botania.common.core.handler.ConfigHandler; -import vazkii.botania.common.core.helper.ItemNBTHelper; -import vazkii.botania.common.item.ModItems; -import vazkii.botania.common.lib.LibMisc; - -import java.util.Arrays; - -import static vazkii.botania.common.lib.ResourceLocationHelper.prefix; - -@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID) -public final class ModPetalRecipes { - @SubscribeEvent - public static void register(RegisterRecipesEvent evt) { - Ingredient white = tagIngr("petals/white"); - Ingredient orange = tagIngr("petals/orange"); - Ingredient magenta = tagIngr("petals/magenta"); - Ingredient lightBlue = tagIngr("petals/light_blue"); - Ingredient yellow = tagIngr("petals/yellow"); - Ingredient lime = tagIngr("petals/lime"); - Ingredient pink = tagIngr("petals/pink"); - Ingredient gray = tagIngr("petals/gray"); - Ingredient lightGray = tagIngr("petals/light_gray"); - Ingredient cyan = tagIngr("petals/cyan"); - Ingredient purple = tagIngr("petals/purple"); - Ingredient blue = tagIngr("petals/blue"); - Ingredient brown = tagIngr("petals/brown"); - Ingredient green = tagIngr("petals/green"); - Ingredient red = tagIngr("petals/red"); - Ingredient black = tagIngr("petals/black"); - Ingredient runeWater = tagIngr("runes/water"); - Ingredient runeFire = tagIngr("runes/fire"); - Ingredient runeEarth = tagIngr("runes/earth"); - Ingredient runeAir = tagIngr("runes/air"); - Ingredient runeSpring = tagIngr("runes/spring"); - Ingredient runeSummer = tagIngr("runes/summer"); - Ingredient runeAutumn = tagIngr("runes/autumn"); - Ingredient runeWinter = tagIngr("runes/winter"); - Ingredient runeMana = tagIngr("runes/mana"); - Ingredient runeLust = tagIngr("runes/lust"); - Ingredient runeGluttony = tagIngr("runes/gluttony"); - Ingredient runeGreed = tagIngr("runes/greed"); - Ingredient runeSloth = tagIngr("runes/sloth"); - Ingredient runeWrath = tagIngr("runes/wrath"); - Ingredient runeEnvy = tagIngr("runes/envy"); - Ingredient runePride = tagIngr("runes/pride"); - - Ingredient redstoneRoot = Ingredient.fromItems(ModItems.redstoneRoot); - Ingredient pixieDust = Ingredient.fromItems(ModItems.pixieDust); - Ingredient gaiaSpirit = Ingredient.fromItems(ModItems.lifeEssence); - - evt.apothecary().accept(make(ModSubtiles.pureDaisy, white, white, white, white)); - evt.apothecary().accept(make(ModSubtiles.manastar, lightBlue, green, red, cyan)); - - evt.apothecary().accept(make(ModSubtiles.endoflame, brown, brown, red, lightGray)); - evt.apothecary().accept(make(ModSubtiles.hydroangeas, blue, blue, cyan, cyan)); - evt.apothecary().accept(make(ModSubtiles.thermalily, red, orange, orange, runeEarth, runeFire)); - evt.apothecary().accept(make(ModSubtiles.rosaArcana, pink, pink, purple, purple, lime, runeMana)); - evt.apothecary().accept(make(ModSubtiles.munchdew, lime, lime, red, red, green, runeGluttony)); - evt.apothecary().accept(make(ModSubtiles.entropinnyum, red, red, gray, gray, white, white, runeWrath, runeFire)); - evt.apothecary().accept(make(ModSubtiles.kekimurus, white, white, orange, orange, brown, brown, runeGluttony, pixieDust)); - evt.apothecary().accept(make(ModSubtiles.gourmaryllis, lightGray, lightGray, yellow, yellow, red, runeFire, runeSummer)); - evt.apothecary().accept(make(ModSubtiles.narslimmus, lime, lime, green, green, black, runeSummer, runeWater)); - evt.apothecary().accept(make(ModSubtiles.spectrolus, red, red, green, green, blue, blue, white, white, runeWinter, runeAir, pixieDust)); - evt.apothecary().accept(make(ModSubtiles.rafflowsia, purple, purple, green, green, black, runeEarth, runePride, pixieDust)); - evt.apothecary().accept(make(ModSubtiles.shulkMeNot, purple, purple, magenta, magenta, lightGray, gaiaSpirit, runeEnvy, runeWrath)); - evt.apothecary().accept(make(ModSubtiles.dandelifeon, purple, purple, lime, green, runeWater, runeFire, runeEarth, runeAir, gaiaSpirit)); - - evt.apothecary().accept(make(ModSubtiles.jadedAmaranthus, purple, lime, green, runeSpring, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.bellethorn, red, red, red, cyan, cyan, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.dreadthorn, black, black, black, cyan, cyan, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.heiseiDream, magenta, magenta, purple, pink, runeWrath, pixieDust)); - evt.apothecary().accept(make(ModSubtiles.tigerseye, yellow, brown, orange, lime, runeAutumn)); - - if (Botania.gardenOfGlassLoaded) { - evt.apothecary().accept(make(ModSubtiles.orechid, gray, gray, yellow, yellow, green, green, red, red)); - } else { - evt.apothecary().accept(make(ModSubtiles.orechid, gray, gray, yellow, green, red, runePride, runeGreed, redstoneRoot, pixieDust)); - } - - evt.apothecary().accept(make(ModSubtiles.orechidIgnem, red, red, white, white, pink, runePride, runeGreed, redstoneRoot, pixieDust)); - if (ConfigHandler.COMMON.fallenKanadeEnabled.get()) { - evt.apothecary().accept(make(ModSubtiles.fallenKanade, white, white, yellow, yellow, orange, runeSpring)); - } - evt.apothecary().accept(make(ModSubtiles.exoflame, red, red, gray, lightGray, runeFire, runeSummer)); - evt.apothecary().accept(make(ModSubtiles.agricarnation, lime, lime, green, yellow, runeSpring, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.hopperhock, gray, gray, lightGray, lightGray, runeAir, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.tangleberrie, cyan, cyan, gray, lightGray, runeAir, runeEarth)); - evt.apothecary().accept(make(ModSubtiles.jiyuulia, pink, pink, purple, lightGray, runeWater, runeAir)); - evt.apothecary().accept(make(ModSubtiles.rannuncarpus, orange, orange, yellow, runeEarth, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.hyacidus, purple, purple, magenta, magenta, green, runeWater, runeAutumn, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.pollidisiac, red, red, pink, pink, orange, runeLust, runeFire)); - evt.apothecary().accept(make(ModSubtiles.clayconia, lightGray, lightGray, gray, cyan, runeEarth)); - evt.apothecary().accept(make(ModSubtiles.loonium, green, green, green, green, gray, runeSloth, runeGluttony, runeEnvy, redstoneRoot, pixieDust)); - evt.apothecary().accept(make(ModSubtiles.daffomill, white, white, brown, yellow, runeAir, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.vinculotus, black, black, purple, purple, green, runeWater, runeSloth, runeLust, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.spectranthemum, white, white, lightGray, lightGray, cyan, runeEnvy, runeWater, redstoneRoot, pixieDust)); - evt.apothecary().accept(make(ModSubtiles.medumone, brown, brown, gray, gray, runeEarth, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.marimorphosis, gray, yellow, green, red, runeEarth, runeFire, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.bubbell, cyan, cyan, lightBlue, lightBlue, blue, blue, runeWater, runeSummer, pixieDust)); - evt.apothecary().accept(make(ModSubtiles.solegnolia, brown, brown, red, blue, redstoneRoot)); - evt.apothecary().accept(make(ModSubtiles.bergamute, orange, green, green, redstoneRoot)); - - ItemStack stack = new ItemStack(Items.PLAYER_HEAD); - ItemNBTHelper.setString(stack, "SkullOwner", "Vazkii"); - Ingredient[] inputs = new Ingredient[16]; - Arrays.fill(inputs, pink); - evt.apothecary().accept(new RecipePetals(prefix("vazkii_head"), stack, inputs)); - } - - private static Ingredient tagIngr(String tag) { - return Ingredient.fromTag(new ItemTags.Wrapper(new ResourceLocation(LibMisc.MOD_ID, tag))); - } - - private static RecipePetals make(IItemProvider item, Ingredient... ingredients) { - return new RecipePetals(item.asItem().getRegistryName(), new ItemStack(item), ingredients); - } -} diff --git a/src/main/java/vazkii/botania/common/crafting/ModRecipeTypes.java b/src/main/java/vazkii/botania/common/crafting/ModRecipeTypes.java index fcb7fe211..35daafe20 100644 --- a/src/main/java/vazkii/botania/common/crafting/ModRecipeTypes.java +++ b/src/main/java/vazkii/botania/common/crafting/ModRecipeTypes.java @@ -18,10 +18,7 @@ import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import vazkii.botania.api.recipe.RecipeBrew; -import vazkii.botania.api.recipe.RecipeElvenTrade; -import vazkii.botania.api.recipe.RecipeManaInfusion; -import vazkii.botania.api.recipe.RecipePureDaisy; +import vazkii.botania.api.recipe.*; import vazkii.botania.common.lib.LibMisc; import static vazkii.botania.common.lib.ResourceLocationHelper.prefix; @@ -41,6 +38,9 @@ public class ModRecipeTypes { public static final IRecipeType BREW_TYPE = new RecipeType<>(); public static final IRecipeSerializer BREW_SERIALIZER = new RecipeBrew.Serializer(); + public static final IRecipeType PETAL_TYPE = new RecipeType<>(); + public static final IRecipeSerializer PETAL_SERIALIZER = new RecipePetals.Serializer(); + @SubscribeEvent public static void register(RegistryEvent.Register> evt) { ResourceLocation id = prefix("elven_trade"); @@ -59,6 +59,10 @@ public class ModRecipeTypes { id = prefix("brew"); Registry.register(Registry.RECIPE_TYPE, id, BREW_TYPE); evt.getRegistry().register(BREW_SERIALIZER.setRegistryName(id)); + + id = prefix("petal_apothecary"); + Registry.register(Registry.RECIPE_TYPE, id, PETAL_TYPE); + evt.getRegistry().register(PETAL_SERIALIZER.setRegistryName(id)); } private static class RecipeType> implements IRecipeType { diff --git a/src/main/java/vazkii/botania/common/crafting/SyncHandler.java b/src/main/java/vazkii/botania/common/crafting/SyncHandler.java index 9ca7d7ada..2eee9c74c 100644 --- a/src/main/java/vazkii/botania/common/crafting/SyncHandler.java +++ b/src/main/java/vazkii/botania/common/crafting/SyncHandler.java @@ -21,7 +21,6 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.network.PacketDistributor; import vazkii.botania.api.BotaniaAPI; -import vazkii.botania.api.recipe.RecipeBrew; import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.api.recipe.RecipeRuneAltar; import vazkii.botania.api.recipe.RegisterRecipesEvent; @@ -48,21 +47,19 @@ public class SyncHandler { ); MinecraftForge.EVENT_BUS.post(evt); - BotaniaAPI.petalRecipes = ImmutableMap.copyOf(apothecary); BotaniaAPI.runeAltarRecipes = ImmutableMap.copyOf(runeAltar); PacketHandler.HANDLER.send(PacketDistributor.ALL.noArg(), syncPacket()); } } private static PacketSyncRecipes syncPacket() { - return new PacketSyncRecipes(BotaniaAPI.petalRecipes, BotaniaAPI.runeAltarRecipes); + return new PacketSyncRecipes(BotaniaAPI.runeAltarRecipes); } @Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, value = Dist.CLIENT) public static class ClientEvents { @SubscribeEvent public static void clientLogout(ClientPlayerNetworkEvent.LoggedOutEvent evt) { - BotaniaAPI.petalRecipes = Collections.emptyMap(); BotaniaAPI.runeAltarRecipes = Collections.emptyMap(); } } diff --git a/src/main/java/vazkii/botania/common/network/PacketSyncRecipes.java b/src/main/java/vazkii/botania/common/network/PacketSyncRecipes.java index a29f09dbf..a38738171 100644 --- a/src/main/java/vazkii/botania/common/network/PacketSyncRecipes.java +++ b/src/main/java/vazkii/botania/common/network/PacketSyncRecipes.java @@ -14,7 +14,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.network.NetworkEvent; import vazkii.botania.api.BotaniaAPI; -import vazkii.botania.api.recipe.RecipeBrew; import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.api.recipe.RecipeRuneAltar; @@ -24,19 +23,13 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public class PacketSyncRecipes { - private Map petal; private Map runeAltar; - public PacketSyncRecipes(Map petal, Map runeAltar) { - this.petal = petal; + public PacketSyncRecipes(Map runeAltar) { this.runeAltar = runeAltar; } public void encode(PacketBuffer buf) { - buf.writeVarInt(petal.size()); - for (RecipePetals recipe : petal.values()) { - recipe.write(buf); - } buf.writeVarInt(runeAltar.size()); for (RecipeRuneAltar recipe : runeAltar.values()) { recipe.write(buf); @@ -44,15 +37,11 @@ public class PacketSyncRecipes { } public static PacketSyncRecipes decode(PacketBuffer buf) { - int petalCount = buf.readVarInt(); - Map petal = Stream.generate(() -> RecipePetals.read(buf)) - .limit(petalCount) - .collect(Collectors.toMap(RecipePetals::getId, r -> r)); int runeCount = buf.readVarInt(); Map rune = Stream.generate(() -> RecipeRuneAltar.read(buf)) .limit(runeCount) .collect(Collectors.toMap(RecipeRuneAltar::getId, r -> r)); - return new PacketSyncRecipes(petal, rune); + return new PacketSyncRecipes(rune); } public void handle(Supplier ctx) { @@ -61,7 +50,6 @@ public class PacketSyncRecipes { if (Minecraft.getInstance().isSingleplayer()) { return; } - BotaniaAPI.petalRecipes = petal; BotaniaAPI.runeAltarRecipes = runeAltar; }); } @@ -74,7 +62,7 @@ public class PacketSyncRecipes { private int loginIndex; public Login() { - this(new PacketSyncRecipes(BotaniaAPI.petalRecipes, BotaniaAPI.runeAltarRecipes)); + this(new PacketSyncRecipes(BotaniaAPI.runeAltarRecipes)); } public Login(PacketSyncRecipes packet) { diff --git a/src/main/java/vazkii/botania/data/DataGenerators.java b/src/main/java/vazkii/botania/data/DataGenerators.java index 1251b161d..3dfa47de1 100644 --- a/src/main/java/vazkii/botania/data/DataGenerators.java +++ b/src/main/java/vazkii/botania/data/DataGenerators.java @@ -33,6 +33,7 @@ public class DataGenerators { evt.getGenerator().addProvider(new ManaInfusionProvider(evt.getGenerator())); evt.getGenerator().addProvider(new PureDaisyProvider(evt.getGenerator())); evt.getGenerator().addProvider(new BrewProvider(evt.getGenerator())); + evt.getGenerator().addProvider(new PetalProvider(evt.getGenerator())); } } } diff --git a/src/main/java/vazkii/botania/data/recipes/PetalProvider.java b/src/main/java/vazkii/botania/data/recipes/PetalProvider.java new file mode 100644 index 000000000..2dca92418 --- /dev/null +++ b/src/main/java/vazkii/botania/data/recipes/PetalProvider.java @@ -0,0 +1,193 @@ +package vazkii.botania.data.recipes; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.IFinishedRecipe; +import net.minecraft.data.RecipeProvider; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.item.crafting.IRecipeSerializer; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.IItemProvider; +import net.minecraft.util.ResourceLocation; +import vazkii.botania.common.Botania; +import vazkii.botania.common.block.ModSubtiles; +import vazkii.botania.common.core.handler.ConfigHandler; +import vazkii.botania.common.core.helper.ItemNBTHelper; +import vazkii.botania.common.crafting.ModRecipeTypes; +import vazkii.botania.common.item.ModItems; +import vazkii.botania.common.lib.LibMisc; + +import javax.annotation.Nullable; +import java.util.Arrays; +import java.util.function.Consumer; + +import static vazkii.botania.common.lib.ResourceLocationHelper.prefix; + +public class PetalProvider extends RecipeProvider { + public PetalProvider(DataGenerator gen) { + super(gen); + } + + @Override + public String getName() { + return "Botania petal apothecary recipes"; + } + + @Override + protected void registerRecipes(Consumer consumer) { + Ingredient white = tagIngr("petals/white"); + Ingredient orange = tagIngr("petals/orange"); + Ingredient magenta = tagIngr("petals/magenta"); + Ingredient lightBlue = tagIngr("petals/light_blue"); + Ingredient yellow = tagIngr("petals/yellow"); + Ingredient lime = tagIngr("petals/lime"); + Ingredient pink = tagIngr("petals/pink"); + Ingredient gray = tagIngr("petals/gray"); + Ingredient lightGray = tagIngr("petals/light_gray"); + Ingredient cyan = tagIngr("petals/cyan"); + Ingredient purple = tagIngr("petals/purple"); + Ingredient blue = tagIngr("petals/blue"); + Ingredient brown = tagIngr("petals/brown"); + Ingredient green = tagIngr("petals/green"); + Ingredient red = tagIngr("petals/red"); + Ingredient black = tagIngr("petals/black"); + Ingredient runeWater = tagIngr("runes/water"); + Ingredient runeFire = tagIngr("runes/fire"); + Ingredient runeEarth = tagIngr("runes/earth"); + Ingredient runeAir = tagIngr("runes/air"); + Ingredient runeSpring = tagIngr("runes/spring"); + Ingredient runeSummer = tagIngr("runes/summer"); + Ingredient runeAutumn = tagIngr("runes/autumn"); + Ingredient runeWinter = tagIngr("runes/winter"); + Ingredient runeMana = tagIngr("runes/mana"); + Ingredient runeLust = tagIngr("runes/lust"); + Ingredient runeGluttony = tagIngr("runes/gluttony"); + Ingredient runeGreed = tagIngr("runes/greed"); + Ingredient runeSloth = tagIngr("runes/sloth"); + Ingredient runeWrath = tagIngr("runes/wrath"); + Ingredient runeEnvy = tagIngr("runes/envy"); + Ingredient runePride = tagIngr("runes/pride"); + + Ingredient redstoneRoot = Ingredient.fromItems(ModItems.redstoneRoot); + Ingredient pixieDust = Ingredient.fromItems(ModItems.pixieDust); + Ingredient gaiaSpirit = Ingredient.fromItems(ModItems.lifeEssence); + + consumer.accept(make(ModSubtiles.pureDaisy, white, white, white, white)); + consumer.accept(make(ModSubtiles.manastar, lightBlue, green, red, cyan)); + + consumer.accept(make(ModSubtiles.endoflame, brown, brown, red, lightGray)); + consumer.accept(make(ModSubtiles.hydroangeas, blue, blue, cyan, cyan)); + consumer.accept(make(ModSubtiles.thermalily, red, orange, orange, runeEarth, runeFire)); + consumer.accept(make(ModSubtiles.rosaArcana, pink, pink, purple, purple, lime, runeMana)); + consumer.accept(make(ModSubtiles.munchdew, lime, lime, red, red, green, runeGluttony)); + consumer.accept(make(ModSubtiles.entropinnyum, red, red, gray, gray, white, white, runeWrath, runeFire)); + consumer.accept(make(ModSubtiles.kekimurus, white, white, orange, orange, brown, brown, runeGluttony, pixieDust)); + consumer.accept(make(ModSubtiles.gourmaryllis, lightGray, lightGray, yellow, yellow, red, runeFire, runeSummer)); + consumer.accept(make(ModSubtiles.narslimmus, lime, lime, green, green, black, runeSummer, runeWater)); + consumer.accept(make(ModSubtiles.spectrolus, red, red, green, green, blue, blue, white, white, runeWinter, runeAir, pixieDust)); + consumer.accept(make(ModSubtiles.rafflowsia, purple, purple, green, green, black, runeEarth, runePride, pixieDust)); + consumer.accept(make(ModSubtiles.shulkMeNot, purple, purple, magenta, magenta, lightGray, gaiaSpirit, runeEnvy, runeWrath)); + consumer.accept(make(ModSubtiles.dandelifeon, purple, purple, lime, green, runeWater, runeFire, runeEarth, runeAir, gaiaSpirit)); + + consumer.accept(make(ModSubtiles.jadedAmaranthus, purple, lime, green, runeSpring, redstoneRoot)); + consumer.accept(make(ModSubtiles.bellethorn, red, red, red, cyan, cyan, redstoneRoot)); + consumer.accept(make(ModSubtiles.dreadthorn, black, black, black, cyan, cyan, redstoneRoot)); + consumer.accept(make(ModSubtiles.heiseiDream, magenta, magenta, purple, pink, runeWrath, pixieDust)); + consumer.accept(make(ModSubtiles.tigerseye, yellow, brown, orange, lime, runeAutumn)); + + consumer.accept(make(ModSubtiles.orechid, gray, gray, yellow, green, red, runePride, runeGreed, redstoneRoot, pixieDust)); + // todo 1.15 + if (Botania.gardenOfGlassLoaded) { + consumer.accept(make(ModSubtiles.orechid, gray, gray, yellow, yellow, green, green, red, red)); + } + + consumer.accept(make(ModSubtiles.orechidIgnem, red, red, white, white, pink, runePride, runeGreed, redstoneRoot, pixieDust)); + // todo 1.15 config flag + if (ConfigHandler.COMMON.fallenKanadeEnabled.get()) { + consumer.accept(make(ModSubtiles.fallenKanade, white, white, yellow, yellow, orange, runeSpring)); + } + consumer.accept(make(ModSubtiles.exoflame, red, red, gray, lightGray, runeFire, runeSummer)); + consumer.accept(make(ModSubtiles.agricarnation, lime, lime, green, yellow, runeSpring, redstoneRoot)); + consumer.accept(make(ModSubtiles.hopperhock, gray, gray, lightGray, lightGray, runeAir, redstoneRoot)); + consumer.accept(make(ModSubtiles.tangleberrie, cyan, cyan, gray, lightGray, runeAir, runeEarth)); + consumer.accept(make(ModSubtiles.jiyuulia, pink, pink, purple, lightGray, runeWater, runeAir)); + consumer.accept(make(ModSubtiles.rannuncarpus, orange, orange, yellow, runeEarth, redstoneRoot)); + consumer.accept(make(ModSubtiles.hyacidus, purple, purple, magenta, magenta, green, runeWater, runeAutumn, redstoneRoot)); + consumer.accept(make(ModSubtiles.pollidisiac, red, red, pink, pink, orange, runeLust, runeFire)); + consumer.accept(make(ModSubtiles.clayconia, lightGray, lightGray, gray, cyan, runeEarth)); + consumer.accept(make(ModSubtiles.loonium, green, green, green, green, gray, runeSloth, runeGluttony, runeEnvy, redstoneRoot, pixieDust)); + consumer.accept(make(ModSubtiles.daffomill, white, white, brown, yellow, runeAir, redstoneRoot)); + consumer.accept(make(ModSubtiles.vinculotus, black, black, purple, purple, green, runeWater, runeSloth, runeLust, redstoneRoot)); + consumer.accept(make(ModSubtiles.spectranthemum, white, white, lightGray, lightGray, cyan, runeEnvy, runeWater, redstoneRoot, pixieDust)); + consumer.accept(make(ModSubtiles.medumone, brown, brown, gray, gray, runeEarth, redstoneRoot)); + consumer.accept(make(ModSubtiles.marimorphosis, gray, yellow, green, red, runeEarth, runeFire, redstoneRoot)); + consumer.accept(make(ModSubtiles.bubbell, cyan, cyan, lightBlue, lightBlue, blue, blue, runeWater, runeSummer, pixieDust)); + consumer.accept(make(ModSubtiles.solegnolia, brown, brown, red, blue, redstoneRoot)); + consumer.accept(make(ModSubtiles.bergamute, orange, green, green, redstoneRoot)); + + ItemStack stack = new ItemStack(Items.PLAYER_HEAD); + ItemNBTHelper.setString(stack, "SkullOwner", "Vazkii"); + Ingredient[] inputs = new Ingredient[16]; + Arrays.fill(inputs, pink); + consumer.accept(new FinishedRecipe(idFor(prefix("vazkii_head")), stack, inputs)); + } + + private static Ingredient tagIngr(String tag) { + return Ingredient.fromTag(new ItemTags.Wrapper(new ResourceLocation(LibMisc.MOD_ID, tag))); + } + + private static FinishedRecipe make(IItemProvider item, Ingredient... ingredients) { + return new FinishedRecipe(idFor(item.asItem().getRegistryName()), new ItemStack(item), ingredients); + } + + private static ResourceLocation idFor(ResourceLocation name) { + return new ResourceLocation(name.getNamespace(), "petal/" + name.getPath()); + } + + private static class FinishedRecipe implements IFinishedRecipe { + private final ResourceLocation id; + private final ItemStack output; + private final Ingredient[] inputs; + + private FinishedRecipe(ResourceLocation id, ItemStack output, Ingredient... inputs) { + this.id = id; + this.output = output; + this.inputs = inputs; + } + + @Override + public void serialize(JsonObject json) { + json.add("output", ItemNBTHelper.serializeStack(output)); + JsonArray ingredients = new JsonArray(); + for (Ingredient ingr : inputs) { + ingredients.add(ingr.serialize()); + } + json.add("ingredients", ingredients); + } + + @Override + public ResourceLocation getID() { + return id; + } + + @Override + public IRecipeSerializer getSerializer() { + return ModRecipeTypes.PETAL_SERIALIZER; + } + + @Nullable + @Override + public JsonObject getAdvancementJson() { + return null; + } + + @Nullable + @Override + public ResourceLocation getAdvancementID() { + return null; + } + } +}