|
| 1 | +package hiiragi283.ragium.api.data.recipe |
| 2 | + |
| 3 | +import hiiragi283.ragium.api.extension.commonTag |
| 4 | +import hiiragi283.ragium.api.material.HTMaterialKey |
| 5 | +import hiiragi283.ragium.api.material.HTTagPrefix |
| 6 | +import hiiragi283.ragium.common.init.RagiumVirtualFluids |
| 7 | +import net.minecraft.tags.TagKey |
| 8 | +import net.minecraft.world.item.Item |
| 9 | +import net.minecraft.world.item.crafting.Ingredient |
| 10 | +import net.minecraft.world.level.ItemLike |
| 11 | +import net.minecraft.world.level.material.Fluid |
| 12 | +import net.neoforged.neoforge.common.Tags |
| 13 | +import net.neoforged.neoforge.common.crafting.ICustomIngredient |
| 14 | +import net.neoforged.neoforge.common.crafting.SizedIngredient |
| 15 | +import net.neoforged.neoforge.fluids.FluidType |
| 16 | +import net.neoforged.neoforge.fluids.crafting.FluidIngredient |
| 17 | +import net.neoforged.neoforge.fluids.crafting.SizedFluidIngredient |
| 18 | +import net.neoforged.neoforge.registries.DeferredHolder |
| 19 | + |
| 20 | +data object HTIngredientBuilder { |
| 21 | + // Item // |
| 22 | + |
| 23 | + @JvmStatic |
| 24 | + fun item(item: ItemLike, count: Int = 1): SizedIngredient = item(Ingredient.of(item), count) |
| 25 | + |
| 26 | + @JvmStatic |
| 27 | + fun item(prefix: HTTagPrefix, material: HTMaterialKey, count: Int = 1): SizedIngredient = item(prefix.createTag(material), count) |
| 28 | + |
| 29 | + @JvmStatic |
| 30 | + fun item(tagKey: TagKey<Item>, count: Int = 1): SizedIngredient = item(Ingredient.of(tagKey), count) |
| 31 | + |
| 32 | + @JvmStatic |
| 33 | + fun item(ingredient: ICustomIngredient, count: Int = 1): SizedIngredient = item(ingredient.toVanilla(), count) |
| 34 | + |
| 35 | + @JvmStatic |
| 36 | + fun item(ingredient: Ingredient, count: Int = 1): SizedIngredient = SizedIngredient(ingredient, count) |
| 37 | + |
| 38 | + // Fluid // |
| 39 | + |
| 40 | + @JvmStatic |
| 41 | + fun fluid(content: RagiumVirtualFluids, amount: Int = FluidType.BUCKET_VOLUME): SizedFluidIngredient = |
| 42 | + fluid(content.fluidHolder, amount) |
| 43 | + |
| 44 | + @JvmStatic |
| 45 | + fun fluid(fluid: DeferredHolder<Fluid, *>, amount: Int = FluidType.BUCKET_VOLUME): SizedFluidIngredient = fluid(fluid.commonTag, amount) |
| 46 | + |
| 47 | + @JvmStatic |
| 48 | + fun fluid(fluid: Fluid, amount: Int = FluidType.BUCKET_VOLUME): SizedFluidIngredient = fluid(FluidIngredient.of(fluid), amount) |
| 49 | + |
| 50 | + @JvmStatic |
| 51 | + fun fluid(tagKey: TagKey<Fluid>, amount: Int = FluidType.BUCKET_VOLUME): SizedFluidIngredient = |
| 52 | + fluid(FluidIngredient.tag(tagKey), amount) |
| 53 | + |
| 54 | + @JvmStatic |
| 55 | + fun fluid(ingredient: FluidIngredient, amount: Int = FluidType.BUCKET_VOLUME): SizedFluidIngredient = |
| 56 | + SizedFluidIngredient(ingredient, amount) |
| 57 | + |
| 58 | + @JvmStatic |
| 59 | + fun water(amount: Int = FluidType.BUCKET_VOLUME): SizedFluidIngredient = fluid(Tags.Fluids.WATER, amount) |
| 60 | + |
| 61 | + @JvmStatic |
| 62 | + fun milk(amount: Int = FluidType.BUCKET_VOLUME): SizedFluidIngredient = fluid(Tags.Fluids.MILK, amount) |
| 63 | +} |
0 commit comments