From d515ebb98a5e24335c9189bf65feaf80a4d2a757 Mon Sep 17 00:00:00 2001 From: Hiiragi Russell Tsubasa <97942736+Hiiragi283@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:51:43 +0900 Subject: [PATCH] Added recipes for filters Added new item Ragi-Ticket --- .../generated/assets/ragium/lang/en_us.json | 1 + .../generated/assets/ragium/lang/ja_jp.json | 1 + .../ragium/models/item/ragi_ticket.json | 6 ++++ .../recipes/misc/shapeless/fluid_filter.json | 32 +++++++++++++++++ .../recipes/misc/shapeless/item_filter.json | 32 +++++++++++++++++ .../ragium/recipe/shapeless/fluid_filter.json | 19 ++++++++++ .../ragium/recipe/shapeless/item_filter.json | 19 ++++++++++ .../ragium/api/extension/RagiumUtils.kt | 9 ++--- .../ragium/api/recipe/HTFluidIngredient.kt | 11 +++--- .../ragium/api/recipe/HTItemIngredient.kt | 9 ++++- .../block/entity/HTExporterBlockEntity.kt | 4 +-- .../ragium/common/init/RagiumItems.kt | 4 +++ .../common/internal/RagiumContentRegister.kt | 1 + .../ragium/data/RagiumLangProviders.kt | 34 +++++++++--------- .../recipe/RagiumVanillaRecipeProvider.kt | 16 +++++++++ .../ragium/textures/item/fluid_filter.png | Bin 0 -> 269 bytes .../ragium/textures/item/item_filter.png | Bin 0 -> 274 bytes .../ragium/textures/item/ragi_ticket.png | Bin 0 -> 334 bytes 18 files changed, 171 insertions(+), 27 deletions(-) create mode 100644 src/main/generated/assets/ragium/models/item/ragi_ticket.json create mode 100644 src/main/generated/data/ragium/advancement/recipes/misc/shapeless/fluid_filter.json create mode 100644 src/main/generated/data/ragium/advancement/recipes/misc/shapeless/item_filter.json create mode 100644 src/main/generated/data/ragium/recipe/shapeless/fluid_filter.json create mode 100644 src/main/generated/data/ragium/recipe/shapeless/item_filter.json create mode 100644 src/main/resources/assets/ragium/textures/item/fluid_filter.png create mode 100644 src/main/resources/assets/ragium/textures/item/item_filter.png create mode 100644 src/main/resources/assets/ragium/textures/item/ragi_ticket.png diff --git a/src/main/generated/assets/ragium/lang/en_us.json b/src/main/generated/assets/ragium/lang/en_us.json index 4e09b3c23..3fb2c275a 100644 --- a/src/main/generated/assets/ragium/lang/en_us.json +++ b/src/main/generated/assets/ragium/lang/en_us.json @@ -124,6 +124,7 @@ "item.ragium.pulp": "Pulp", "item.ragium.ragi_alloy_compound": "Ragi-Alloy Compound", "item.ragium.ragi_crystal_processor": "Ragi-Crystal Processor", + "item.ragium.ragi_ticket": "Ragi-Ticket", "item.ragium.refined_silicon": "Refined Silicon", "item.ragium.residual_coke": "Residual Coke", "item.ragium.silicon": "Silicon", diff --git a/src/main/generated/assets/ragium/lang/ja_jp.json b/src/main/generated/assets/ragium/lang/ja_jp.json index af3964a90..6d9c2aba7 100644 --- a/src/main/generated/assets/ragium/lang/ja_jp.json +++ b/src/main/generated/assets/ragium/lang/ja_jp.json @@ -124,6 +124,7 @@ "item.ragium.pulp": "パルプ", "item.ragium.ragi_alloy_compound": "ラギ合金混合物", "item.ragium.ragi_crystal_processor": "ラギクリスタリルプロセッサ", + "item.ragium.ragi_ticket": "らぎチケット", "item.ragium.refined_silicon": "精製シリコン", "item.ragium.residual_coke": "残渣油コークス", "item.ragium.silicon": "シリコン", diff --git a/src/main/generated/assets/ragium/models/item/ragi_ticket.json b/src/main/generated/assets/ragium/models/item/ragi_ticket.json new file mode 100644 index 000000000..adebdb87a --- /dev/null +++ b/src/main/generated/assets/ragium/models/item/ragi_ticket.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "ragium:item/ragi_ticket" + } +} \ No newline at end of file diff --git a/src/main/generated/data/ragium/advancement/recipes/misc/shapeless/fluid_filter.json b/src/main/generated/data/ragium/advancement/recipes/misc/shapeless/fluid_filter.json new file mode 100644 index 000000000..156d39dab --- /dev/null +++ b/src/main/generated/data/ragium/advancement/recipes/misc/shapeless/fluid_filter.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_item": { + "conditions": { + "items": [ + { + "items": "minecraft:paper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "ragium:shapeless/fluid_filter" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_the_item" + ] + ], + "rewards": { + "recipes": [ + "ragium:shapeless/fluid_filter" + ] + } +} \ No newline at end of file diff --git a/src/main/generated/data/ragium/advancement/recipes/misc/shapeless/item_filter.json b/src/main/generated/data/ragium/advancement/recipes/misc/shapeless/item_filter.json new file mode 100644 index 000000000..79260f29c --- /dev/null +++ b/src/main/generated/data/ragium/advancement/recipes/misc/shapeless/item_filter.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_item": { + "conditions": { + "items": [ + { + "items": "minecraft:paper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "ragium:shapeless/item_filter" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_the_item" + ] + ], + "rewards": { + "recipes": [ + "ragium:shapeless/item_filter" + ] + } +} \ No newline at end of file diff --git a/src/main/generated/data/ragium/recipe/shapeless/fluid_filter.json b/src/main/generated/data/ragium/recipe/shapeless/fluid_filter.json new file mode 100644 index 000000000..96139fbe2 --- /dev/null +++ b/src/main/generated/data/ragium/recipe/shapeless/fluid_filter.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "minecraft:paper" + }, + { + "tag": "c:dyes/light_blue" + }, + { + "tag": "c:dusts/raginite" + } + ], + "result": { + "count": 1, + "id": "ragium:fluid_filter" + } +} \ No newline at end of file diff --git a/src/main/generated/data/ragium/recipe/shapeless/item_filter.json b/src/main/generated/data/ragium/recipe/shapeless/item_filter.json new file mode 100644 index 000000000..7deae0fb6 --- /dev/null +++ b/src/main/generated/data/ragium/recipe/shapeless/item_filter.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "minecraft:paper" + }, + { + "tag": "c:dyes/orange" + }, + { + "tag": "c:dusts/raginite" + } + ], + "result": { + "count": 1, + "id": "ragium:item_filter" + } +} \ No newline at end of file diff --git a/src/main/kotlin/hiiragi283/ragium/api/extension/RagiumUtils.kt b/src/main/kotlin/hiiragi283/ragium/api/extension/RagiumUtils.kt index 2b6c8cc21..ea9d32f56 100644 --- a/src/main/kotlin/hiiragi283/ragium/api/extension/RagiumUtils.kt +++ b/src/main/kotlin/hiiragi283/ragium/api/extension/RagiumUtils.kt @@ -202,10 +202,11 @@ fun RegistryEntry.isOf(value: T): Boolean = value() == value operator fun RegistryEntryList.contains(value: T): Boolean = any { it.isOf(value) } -fun RegistryEntryList.asText(mapper: (T) -> Text): Text = storage.map( - { it.name }, - { Texts.join(this.map(RegistryEntry::value), mapper) }, -) +fun RegistryEntryList.asText(mapper: (T) -> Text): MutableText = storage + .map( + { it.name }, + { Texts.join(this.map(RegistryEntry::value), mapper) }, + ).copy() // ScreenHandler // diff --git a/src/main/kotlin/hiiragi283/ragium/api/recipe/HTFluidIngredient.kt b/src/main/kotlin/hiiragi283/ragium/api/recipe/HTFluidIngredient.kt index cc6da331d..bde2323d5 100644 --- a/src/main/kotlin/hiiragi283/ragium/api/recipe/HTFluidIngredient.kt +++ b/src/main/kotlin/hiiragi283/ragium/api/recipe/HTFluidIngredient.kt @@ -2,10 +2,7 @@ package hiiragi283.ragium.api.recipe import com.mojang.serialization.Codec import com.mojang.serialization.codecs.RecordCodecBuilder -import hiiragi283.ragium.api.extension.contains -import hiiragi283.ragium.api.extension.isOf -import hiiragi283.ragium.api.extension.longRangeCodec -import hiiragi283.ragium.api.extension.useTransaction +import hiiragi283.ragium.api.extension.* import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant import net.fabricmc.fabric.api.transfer.v1.storage.StorageUtil @@ -23,6 +20,7 @@ import net.minecraft.registry.RegistryKeys import net.minecraft.registry.entry.RegistryEntry import net.minecraft.registry.entry.RegistryEntryList import net.minecraft.registry.tag.TagKey +import net.minecraft.text.MutableText import java.util.function.BiPredicate class HTFluidIngredient private constructor(private val entryList: RegistryEntryList, val amount: Long) : BiPredicate { @@ -69,6 +67,9 @@ class HTFluidIngredient private constructor(private val entryList: RegistryEntry fun map(transform: (RegistryEntry, Long) -> T): List = entryList.map { transform(it, amount) } + val text: MutableText + get() = entryList.asText(Fluid::name) + val firstEntry: RegistryEntry? get() = entryList.firstOrNull() @@ -101,4 +102,6 @@ class HTFluidIngredient private constructor(private val entryList: RegistryEntry } } } + + override fun toString(): String = "HTFluidIngredient[entryList=${text.string},amount=$amount]" } diff --git a/src/main/kotlin/hiiragi283/ragium/api/recipe/HTItemIngredient.kt b/src/main/kotlin/hiiragi283/ragium/api/recipe/HTItemIngredient.kt index 2d911611c..5017f4751 100644 --- a/src/main/kotlin/hiiragi283/ragium/api/recipe/HTItemIngredient.kt +++ b/src/main/kotlin/hiiragi283/ragium/api/recipe/HTItemIngredient.kt @@ -19,6 +19,7 @@ import net.minecraft.registry.RegistryKeys import net.minecraft.registry.entry.RegistryEntry import net.minecraft.registry.entry.RegistryEntryList import net.minecraft.registry.tag.TagKey +import net.minecraft.text.MutableText import net.minecraft.util.StringIdentifiable import java.util.function.Predicate @@ -75,6 +76,9 @@ class HTItemIngredient private constructor(private val entryList: RegistryEntryL fun map(transform: (RegistryEntry, Int) -> T): List = entryList.map { transform(it, count) } + val text: MutableText + get() = entryList.asText(Item::getName) + val firstEntry: RegistryEntry? get() = entryList.firstOrNull() @@ -83,6 +87,9 @@ class HTItemIngredient private constructor(private val entryList: RegistryEntryL val valueMap: Map get() = entryMap.mapKeys { it.key.value() } + val matchingStacks: List + get() = valueMap.map { (item: Item, count: Int) -> ItemStack(item, count) } + override fun test(stack: ItemStack): Boolean = when (stack.isEmpty) { true -> this.isEmpty false -> stack.isIn(entryList) && stack.count >= count @@ -103,7 +110,7 @@ class HTItemIngredient private constructor(private val entryList: RegistryEntryL } } - override fun toString(): String = "HTItemIngredient[entryList=${entryList.asText(Item::getName)},count=$count]" + override fun toString(): String = "HTItemIngredient[entryList=${text.string},count=$count]" // ConsumeType // diff --git a/src/main/kotlin/hiiragi283/ragium/common/block/entity/HTExporterBlockEntity.kt b/src/main/kotlin/hiiragi283/ragium/common/block/entity/HTExporterBlockEntity.kt index 3aac280f3..437814572 100644 --- a/src/main/kotlin/hiiragi283/ragium/common/block/entity/HTExporterBlockEntity.kt +++ b/src/main/kotlin/hiiragi283/ragium/common/block/entity/HTExporterBlockEntity.kt @@ -34,8 +34,8 @@ class HTExporterBlockEntity(pos: BlockPos, state: BlockState) : this.tier = tier } - private var fluidFilter: RegistryEntryList = RegistryEntryList.empty() - private var itemFilter: RegistryEntryList = RegistryEntryList.empty() + var fluidFilter: RegistryEntryList = RegistryEntryList.empty() + var itemFilter: RegistryEntryList = RegistryEntryList.empty() override fun writeNbt(nbt: NbtCompound, wrapperLookup: RegistryWrapper.WrapperLookup) { super.writeNbt(nbt, wrapperLookup) diff --git a/src/main/kotlin/hiiragi283/ragium/common/init/RagiumItems.kt b/src/main/kotlin/hiiragi283/ragium/common/init/RagiumItems.kt index b7423c9fc..bf3d5e3d2 100644 --- a/src/main/kotlin/hiiragi283/ragium/common/init/RagiumItems.kt +++ b/src/main/kotlin/hiiragi283/ragium/common/init/RagiumItems.kt @@ -348,6 +348,9 @@ object RagiumItems { @JvmField val RAGI_CRYSTAL_PROCESSOR: Item = Item(itemSettings()) + @JvmField + val RAGI_TICKET: Item = Item(itemSettings().rarity(Rarity.EPIC)) + @JvmField val REFINED_SILICON: Item = Item(itemSettings()) @@ -387,6 +390,7 @@ object RagiumItems { PROCESSOR_SOCKET, RAGI_ALLOY_COMPOUND, RAGI_CRYSTAL_PROCESSOR, + RAGI_TICKET, REFINED_SILICON, RESIDUAL_COKE, SILICON, diff --git a/src/main/kotlin/hiiragi283/ragium/common/internal/RagiumContentRegister.kt b/src/main/kotlin/hiiragi283/ragium/common/internal/RagiumContentRegister.kt index e0f64f414..ee3147635 100644 --- a/src/main/kotlin/hiiragi283/ragium/common/internal/RagiumContentRegister.kt +++ b/src/main/kotlin/hiiragi283/ragium/common/internal/RagiumContentRegister.kt @@ -259,6 +259,7 @@ internal object RagiumContentRegister { registerItem("processor_socket", RagiumItems.PROCESSOR_SOCKET) registerItem("ragi_alloy_compound", RagiumItems.RAGI_ALLOY_COMPOUND) registerItem("ragi_crystal_processor", RagiumItems.RAGI_CRYSTAL_PROCESSOR) + registerItem("ragi_ticket", RagiumItems.RAGI_TICKET) registerItem("refined_silicon", RagiumItems.REFINED_SILICON) registerItem("residual_coke", RagiumItems.RESIDUAL_COKE) registerItem("silicon", RagiumItems.SILICON) diff --git a/src/main/kotlin/hiiragi283/ragium/data/RagiumLangProviders.kt b/src/main/kotlin/hiiragi283/ragium/data/RagiumLangProviders.kt index ff0af38d0..82bdb4126 100644 --- a/src/main/kotlin/hiiragi283/ragium/data/RagiumLangProviders.kt +++ b/src/main/kotlin/hiiragi283/ragium/data/RagiumLangProviders.kt @@ -267,6 +267,7 @@ object RagiumLangProviders { builder.add(RagiumItems.PROCESSOR_SOCKET, "Processor Socket") builder.add(RagiumItems.RAGI_ALLOY_COMPOUND, "Ragi-Alloy Compound") builder.add(RagiumItems.RAGI_CRYSTAL_PROCESSOR, "Ragi-Crystal Processor") + builder.add(RagiumItems.RAGI_TICKET, "Ragi-Ticket") builder.add(RagiumItems.REFINED_SILICON, "Refined Silicon") builder.add(RagiumItems.RESIDUAL_COKE, "Residual Coke") builder.add(RagiumItems.SILICON, "Silicon") @@ -468,22 +469,6 @@ object RagiumLangProviders { builder.add(RagiumBlocks.TELEPORT_ANCHOR, "テレポートアンカー") builder.add(RagiumBlocks.TRASH_BOX, "ゴミ箱") - builder.add(RagiumItems.STEEL_HELMET, "スチールのヘルメット") - builder.add(RagiumItems.STEEL_CHESTPLATE, "スチールのチェストプレート") - builder.add(RagiumItems.STEEL_LEGGINGS, "スチールのレギンス") - builder.add(RagiumItems.STEEL_BOOTS, "スチールのブーツ") - builder.add(RagiumItems.STELLA_GOGGLE, "S.T.E.L.L.A.ゴーグル") - builder.add(RagiumItems.STELLA_JACKET, "S.T.E.L.L.A.ジャケット") - builder.add(RagiumItems.STELLA_LEGGINGS, "S.T.E.L.L.A.レギンス") - builder.add(RagiumItems.STELLA_BOOTS, "S.T.E.L.L.A.ブーツ") - - builder.add(RagiumItems.STEEL_AXE, "スチールの斧") - builder.add(RagiumItems.STEEL_HOE, "スチールのクワ") - builder.add(RagiumItems.STEEL_PICKAXE, "スチールのツルハシ") - builder.add(RagiumItems.STEEL_SHOVEL, "スチールのショベル") - builder.add(RagiumItems.STEEL_SWORD, "スチールの剣") - builder.add(RagiumItems.BUJIN, "武刃") - builder.add(RagiumContents.Pipes.IRON, "鉄パイプ") builder.add(RagiumContents.Pipes.WOODEN, "木製パイプ") builder.add(RagiumContents.Pipes.STEEL, "鋼鉄パイプ") @@ -504,6 +489,22 @@ object RagiumLangProviders { builder.add(RagiumEnchantments.SLEDGE_HAMMER, "粉砕") builder.add(RagiumEnchantments.BUZZ_SAW, "製材") // Items + builder.add(RagiumItems.STEEL_HELMET, "スチールのヘルメット") + builder.add(RagiumItems.STEEL_CHESTPLATE, "スチールのチェストプレート") + builder.add(RagiumItems.STEEL_LEGGINGS, "スチールのレギンス") + builder.add(RagiumItems.STEEL_BOOTS, "スチールのブーツ") + builder.add(RagiumItems.STELLA_GOGGLE, "S.T.E.L.L.A.ゴーグル") + builder.add(RagiumItems.STELLA_JACKET, "S.T.E.L.L.A.ジャケット") + builder.add(RagiumItems.STELLA_LEGGINGS, "S.T.E.L.L.A.レギンス") + builder.add(RagiumItems.STELLA_BOOTS, "S.T.E.L.L.A.ブーツ") + + builder.add(RagiumItems.STEEL_AXE, "スチールの斧") + builder.add(RagiumItems.STEEL_HOE, "スチールのクワ") + builder.add(RagiumItems.STEEL_PICKAXE, "スチールのツルハシ") + builder.add(RagiumItems.STEEL_SHOVEL, "スチールのショベル") + builder.add(RagiumItems.STEEL_SWORD, "スチールの剣") + builder.add(RagiumItems.BUJIN, "武刃") + builder.add(RagiumItems.BEE_WAX, "蜜蠟") builder.add(RagiumItems.BUTTER, "バター") builder.add(RagiumItems.CARAMEL, "キャラメル") @@ -535,6 +536,7 @@ object RagiumLangProviders { builder.add(RagiumItems.PROCESSOR_SOCKET, "プロセッサソケット") builder.add(RagiumItems.RAGI_ALLOY_COMPOUND, "ラギ合金混合物") builder.add(RagiumItems.RAGI_CRYSTAL_PROCESSOR, "ラギクリスタリルプロセッサ") + builder.add(RagiumItems.RAGI_TICKET, "らぎチケット") builder.add(RagiumItems.REFINED_SILICON, "精製シリコン") builder.add(RagiumItems.RESIDUAL_COKE, "残渣油コークス") builder.add(RagiumItems.SILICON, "シリコン") diff --git a/src/main/kotlin/hiiragi283/ragium/data/recipe/RagiumVanillaRecipeProvider.kt b/src/main/kotlin/hiiragi283/ragium/data/recipe/RagiumVanillaRecipeProvider.kt index 68feca982..cc04d50c2 100644 --- a/src/main/kotlin/hiiragi283/ragium/data/recipe/RagiumVanillaRecipeProvider.kt +++ b/src/main/kotlin/hiiragi283/ragium/data/recipe/RagiumVanillaRecipeProvider.kt @@ -191,6 +191,22 @@ class RagiumVanillaRecipeProvider(output: FabricDataOutput, registriesFuture: Co .input('B', ConventionalItemTags.WOODEN_RODS) .unlockedBy(RagiumContents.Gems.RAGIUM) .offerTo(exporter) + // filter + HTShapelessRecipeJsonBuilder + .create(RagiumItems.FLUID_FILTER) + .input(Items.PAPER) + .input(ConventionalItemTags.LIGHT_BLUE_DYES) + .input(RagiumContents.Dusts.RAGINITE) + .unlockedBy(Items.PAPER) + .offerTo(exporter) + + HTShapelessRecipeJsonBuilder + .create(RagiumItems.ITEM_FILTER) + .input(Items.PAPER) + .input(ConventionalItemTags.ORANGE_DYES) + .input(RagiumContents.Dusts.RAGINITE) + .unlockedBy(Items.PAPER) + .offerTo(exporter) // steel HTShapedRecipeJsonBuilder .create(RagiumItems.STEEL_SWORD) diff --git a/src/main/resources/assets/ragium/textures/item/fluid_filter.png b/src/main/resources/assets/ragium/textures/item/fluid_filter.png new file mode 100644 index 0000000000000000000000000000000000000000..e5c7904d35713e374078468c95d5db93f6fff233 GIT binary patch literal 269 zcmV+o0rLKdP)Px#$4Nv%R5*>*l0OQ70HweaWRW)(wD!YP)Px#%t=H+R5*>*lD!SWFc5`5M_B;l4I)vwVg)L?$irj?1iK(QDptq)W9Wkj+<2V3kKTG{cQX*24{Jy`X Y7b_}NMaDW!`v3p{07*qoM6N<$f_~*|`~Uy| literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/ragium/textures/item/ragi_ticket.png b/src/main/resources/assets/ragium/textures/item/ragi_ticket.png new file mode 100644 index 0000000000000000000000000000000000000000..6176f3c22143db50d6ccf31b35fff1eaeab4de46 GIT binary patch literal 334 zcmV-U0kQsxP)Px$2uVaiR5*>*k+Dj{P!xv0E53uehC&t-0-=yiiDNT6ISJJ*OQmno<#u$cn{>(0 z4s|GQEws`Sr$FMH$Z@E)Ng6ey{&1Ib@Bf|ip9}v&?T(gqM@!Y+K^^n;RSU~Dse&B- zWCXBm6VEa59E16~0U-CiQ2p9G`P9z zlO-wBkya{iwrrE8-N18CUVN6Pc~Dy^)2p&B?`?t+GN40Q?}V z1u5@f`wP>NR)9bYU>5^Go_SFhbWe_9IR1KD1bhdXuise2DN%4*FjfM}kVTvl4afO< gefdGSzo