Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/kotlin/hiiragi283/ragium/client/RagiumClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ data object RagiumClient : HTClientMod() {
tintSource =
FluidStackTintSource { stack: FluidStack ->
"ff000000".hexToInt() or
HTPotionHelper.getPotion(stack).color
HTPotionHelper.getContents(stack).color
}
}
register.register(RagiumFluids.OMINOUS_FLUX) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data object RagiumClientEventHandler {
fun onFluidTooltip(event: FluidTooltipEvent) {
val stack: FluidStack = event.fluidStack
if (stack.`is`(RagiumFluids.POTION.getOrThrow())) {
HTPotionHelper.getPotion(stack).addToTooltip(event.context, event.toolTip::add, event.flags, stack)
HTPotionHelper.getContents(stack).addToTooltip(event.context, event.toolTip::add, event.flags, stack)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import hiiragi283.lib.integration.jei.category.HTItemToDoubleItemRecipeCategory
import hiiragi283.lib.integration.jei.category.HTItemToItemAndFluidRecipeCategory
import hiiragi283.lib.integration.jei.category.HTSingleRecipeCategory
import hiiragi283.lib.item.HTPotionBasedItem
import hiiragi283.lib.item.alchemy.BottledPotionContents
import hiiragi283.lib.item.ItemStack
import hiiragi283.lib.item.alchemy.HTBottleType
import hiiragi283.lib.item.alchemy.HTPotionHelper
import hiiragi283.lib.recipe.ingredient.HTPotionFluidIngredient
import hiiragi283.lib.registry.getKeyOrThrow
import hiiragi283.ragium.api.RagiumAPI
import hiiragi283.ragium.api.RagiumRegistries
Expand Down Expand Up @@ -42,6 +44,8 @@ import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.ItemStackTemplate
import net.minecraft.world.item.alchemy.Potion
import net.minecraft.world.item.alchemy.Potions
import net.minecraft.world.item.crafting.display.SlotDisplay
import net.neoforged.neoforge.common.Tags
import net.neoforged.neoforge.fluids.FluidStack
Expand All @@ -50,11 +54,23 @@ import kotlin.streams.asSequence

@JeiPlugin
class RagiumJeiPlugin : HTJeiPlugin(RagiumAPI.MOD_ID) {
override fun registerItemSubtypes(registration: ISubtypeRegistration) {
// Potion-Based Item
HTPhysicalSideHelper
companion object {
@JvmStatic
private fun listItems(): Sequence<Holder.Reference<Item>> = HTPhysicalSideHelper
.filteredLookup(BuiltInRegistries.ITEM)
.listElements()
.asSequence()

@JvmStatic
private fun listPotions(): Sequence<Holder.Reference<Potion>> = HTPhysicalSideHelper
.filteredLookup(BuiltInRegistries.POTION)
.listElements()
.asSequence()
}

override fun registerItemSubtypes(registration: ISubtypeRegistration) {
// Potion-Based Item
listItems()
.map(Holder<Item>::value)
.forEach { item: Item ->
if (item is HTPotionBasedItem) {
Expand Down Expand Up @@ -82,12 +98,9 @@ class RagiumJeiPlugin : HTJeiPlugin(RagiumAPI.MOD_ID) {
override fun registerExtraIngredients(registration: IExtraIngredientRegistration) {
registration.addExtraIngredients(
NeoForgeTypes.FLUID_STACK,
HTPhysicalSideHelper
.filteredLookup(BuiltInRegistries.POTION)
.listElements()
.map(::BottledPotionContents)
.filter { !it.isWater }
.map(BottledPotionContents::toFluidStack)
listPotions()
.filter { !it.`is`(Potions.WATER) }
.map(HTPotionHelper::createFluid)
.toList()
)
registration.addExtraIngredients(
Expand Down Expand Up @@ -164,12 +177,50 @@ class RagiumJeiPlugin : HTJeiPlugin(RagiumAPI.MOD_ID) {
}

private fun registerDynamicRecipes(registration: IRecipeRegistration) {
// Mechanical
registration.addRecipes(
RagiumJeiRecipeTypes.DRAINING,
listPotions()
.flatMap { potion: Holder.Reference<Potion> ->
HTBottleType.entries.map { bottleType: HTBottleType ->
RagiumRecipeBuilders.draining {
+HTJeiRecipeHelper.fakeItem(
ItemStack(bottleType.filledItem, 1, HTPotionHelper.createPotionPatch(potion))
)
itemResult { +bottleType.emptyItem }
fluidResult { from(HTPotionHelper.createFluid(potion, HTPotionHelper.BOTTLE_AMOUNT)) }
recipeId replace potion.getKeyOrThrow()
.identifier()
.withPrefix("potion_bottle/${bottleType.serializedName}/")
}.buildSynthetic()
}
}.toList()
)
registration.addRecipes(
RagiumJeiRecipeTypes.FILLING,
listPotions()
.flatMap { potion: Holder.Reference<Potion> ->
HTBottleType.entries.map { bottleType: HTBottleType ->
RagiumRecipeBuilders.filling {
itemIngredient { items { +bottleType.emptyItem } }
fluidIngredient {
+HTPotionFluidIngredient(potion)
amount = HTPotionHelper.BOTTLE_AMOUNT
}
result {
from(ItemStack(bottleType.filledItem, 1, HTPotionHelper.createPotionPatch(potion)))
}
recipeId replace potion.getKeyOrThrow()
.identifier()
.withPrefix("potion_bottle/${bottleType.serializedName}/")
}.buildSynthetic()
}
}.toList()
)
// Chemical
registration.addRecipes(
RagiumJeiRecipeTypes.MIXING,
HTPhysicalSideHelper.filteredLookup(BuiltInRegistries.ITEM)
.listElements()
.asSequence()
listItems()
.mapNotNull { input: Holder<Item> ->
val result: FluidStack =
HTOreSlurryDataHelper.createFluid(input.components()) ?: return@mapNotNull null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class RagiumEnglishLangProvider(output: PackOutput) :
add(RagiumBlocks.MACHINE_CASING, "Machine Casing")
// Fluid
addFluid(RagiumFluids.HONEY, "Honey")
add(RagiumFluids.POTION.getFluidType().descriptionId, "Invalid Potion")
// add(RagiumFluids.POTION.getFluidType().descriptionId, "Invalid Potion")
add(RagiumFluids.POTION.bucketHolder, $$"%1$s Bucket")
addFluid(RagiumFluids.OMINOUS_FLUX, "Ominous Flux")
addFluid(RagiumFluids.MOLTEN_GLASS, "Molten Glass")
Expand Down Expand Up @@ -106,6 +106,8 @@ class RagiumEnglishLangProvider(output: PackOutput) :
add(RagiumItems.SYNTHETIC_FIBER, "Synthetic Fiber")
add(RagiumItems.SYNTHETIC_LEATHER, "Synthetic Leather")
add(RagiumItems.BEESWAX, "Beeswax")
add(RagiumItems.SPLASH_BOTTLE, "Splash Bottle")
add(RagiumItems.LINGERING_BOTTLE, "Lingering Bottle")
add(RagiumItems.ELDER_HEART, "Elder Heart")
add(RagiumItems.WITHER_DOLL, "Wither Doll")
add(RagiumItems.WITHER_STAR, "Wither Star")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class RagiumJapaneseLangProvider(output: PackOutput) :
add(RagiumBlocks.MACHINE_CASING, "機械ケーシング")
// Fluid
addFluid(RagiumFluids.HONEY, "ハチミツ")
add(RagiumFluids.POTION.getFluidType().descriptionId, "無効なポーション")
// add(RagiumFluids.POTION.getFluidType().descriptionId, "無効なポーション")
add(RagiumFluids.POTION.bucketHolder, $$"%1$s入りバケツ")
addFluid(RagiumFluids.OMINOUS_FLUX, "不吉な流動体")
addFluid(RagiumFluids.MOLTEN_GLASS, "溶融ガラス")
Expand Down Expand Up @@ -102,6 +102,8 @@ class RagiumJapaneseLangProvider(output: PackOutput) :
add(RagiumItems.SYNTHETIC_FIBER, "合成繊維")
add(RagiumItems.SYNTHETIC_LEATHER, "合成牛皮")
add(RagiumItems.BEESWAX, "密猟")
add(RagiumItems.SPLASH_BOTTLE, "スプラッシュ瓶")
add(RagiumItems.LINGERING_BOTTLE, "残留瓶")
add(RagiumItems.ELDER_HEART, "エルダーの心臓")
add(RagiumItems.WITHER_DOLL, "ウィザー人形")
add(RagiumItems.WITHER_STAR, "ウィザースター")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import hiiragi283.lib.registry.HTSimpleDeferredItem
import hiiragi283.lib.resource.HTSimpleBlockItemWithKey
import hiiragi283.lib.resource.HTValueWithId
import hiiragi283.lib.resource.blockId
import hiiragi283.lib.resource.vanillaId
import hiiragi283.ragium.api.RagiumAPI
import hiiragi283.ragium.api.tag.HTMachineType
import hiiragi283.ragium.common.block.HTMachineBlock
Expand Down Expand Up @@ -137,12 +138,23 @@ class RagiumModelProvider(output: PackOutput) : HTModelProvider(output, RagiumAP
buildSet {
addAll(RagiumItems.REGISTER.asSequence())

remove(RagiumItems.SPLASH_BOTTLE)
remove(RagiumItems.LINGERING_BOTTLE)

remove(RagiumItems.MEMORY_DISC)

removeAll(RagiumItems.MACHINE_PARTS.values)
removeAll(handheld)
}.forEach { generators.generateFlatItem(it) }

generators.generateFlatItem(
RagiumItems.SPLASH_BOTTLE,
layer = vanillaId(HTConstants.ITEM, "splash_potion")
)
generators.generateFlatItem(
RagiumItems.LINGERING_BOTTLE,
layer = vanillaId(HTConstants.ITEM, "lingering_potion")
)
generators.generateFlatItem(RagiumItems.MEMORY_DISC, template = ModelTemplates.MUSIC_DISC)

for ((machineType: HTMachineType, parts: HTSimpleDeferredItem) in RagiumItems.MACHINE_PARTS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,24 @@ class RagiumVanillaRecipeProvider(registries: HolderLookup.Provider, output: Rec
).unlockedBy(getHasName(HTCommonTags.Items.PLASTICS), has(HTCommonTags.Items.PLASTICS))
.save(output)
}
// Splash Bottle
shapeless(RecipeCategory.BREWING, RagiumItems.SPLASH_BOTTLE, 4)
.requires(Tags.Items.GUNPOWDERS)
.requires(Items.GLASS_BOTTLE)
.requires(Items.GLASS_BOTTLE)
.requires(Items.GLASS_BOTTLE)
.requires(Items.GLASS_BOTTLE)
.unlockedBy(getHasName(Tags.Items.GUNPOWDERS), has(Tags.Items.GUNPOWDERS))
.save(output)
// Lingering Bottle
shapeless(RecipeCategory.BREWING, RagiumItems.LINGERING_BOTTLE, 4)
.requires(Items.DRAGON_BREATH)
.requires(Items.GLASS_BOTTLE)
.requires(Items.GLASS_BOTTLE)
.requires(Items.GLASS_BOTTLE)
.requires(Items.GLASS_BOTTLE)
.unlockedBy(getHasName(Items.DRAGON_BREATH), has(Items.DRAGON_BREATH))
.save(output)

// XX Tools
registerTools(RagiumItems.SOOTY_IRON_TOOLS, RagiumToolMaterials.SOOTY_IRON)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "ragium:item/lingering_bottle"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "ragium:item/splash_bottle"
}
}
3 changes: 2 additions & 1 deletion src/generated/resources/assets/ragium/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"block.ragium.oxygen": "Oxygen",
"block.ragium.pink_dye": "Pink Dye",
"block.ragium.planter": "Planter",
"block.ragium.potion": "Invalid Potion",
"block.ragium.purple_dye": "Purple Dye",
"block.ragium.pyrolyzer": "Pyrolyzer",
"block.ragium.red_dye": "Red Dye",
Expand Down Expand Up @@ -197,6 +196,7 @@
"item.ragium.light_blue_dye_bucket": "Light Blue Dye Bucket",
"item.ragium.light_gray_dye_bucket": "Light Gray Dye Bucket",
"item.ragium.lime_dye_bucket": "Lime Dye Bucket",
"item.ragium.lingering_bottle": "Lingering Bottle",
"item.ragium.liquid_explosive_bucket": "Liquid Explosive Bucket",
"item.ragium.magenta_dye_bucket": "Magenta Dye Bucket",
"item.ragium.mechanical_machine_parts": "Machine Parts (Mechanical)",
Expand Down Expand Up @@ -236,6 +236,7 @@
"item.ragium.sooty_iron_pickaxe": "Sooty Iron Pickaxe",
"item.ragium.sooty_iron_shovel": "Sooty Iron Shovel",
"item.ragium.sooty_iron_sword": "Sooty Iron Sword",
"item.ragium.splash_bottle": "Splash Bottle",
"item.ragium.sulfur_dioxide_bucket": "Sulfur Dioxide Bucket",
"item.ragium.sulfur_dust": "Sulfur Dust",
"item.ragium.sulfur_trioxide_bucket": "Sulfur Trioxide Bucket",
Expand Down
3 changes: 2 additions & 1 deletion src/generated/resources/assets/ragium/lang/ja_jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"block.ragium.oxygen": "酸素",
"block.ragium.pink_dye": "桃色の染料",
"block.ragium.planter": "栽培機",
"block.ragium.potion": "無効なポーション",
"block.ragium.purple_dye": "紫色の染料",
"block.ragium.pyrolyzer": "熱分解炉",
"block.ragium.red_dye": "赤色の染料",
Expand Down Expand Up @@ -197,6 +196,7 @@
"item.ragium.light_blue_dye_bucket": "空色の染料入りバケツ",
"item.ragium.light_gray_dye_bucket": "薄灰色の染料入りバケツ",
"item.ragium.lime_dye_bucket": "黄緑色の染料入りバケツ",
"item.ragium.lingering_bottle": "残留瓶",
"item.ragium.liquid_explosive_bucket": "液体爆薬入りバケツ",
"item.ragium.magenta_dye_bucket": "赤紫色の染料入りバケツ",
"item.ragium.mechanical_machine_parts": "機械部品 (機械加工)",
Expand Down Expand Up @@ -236,6 +236,7 @@
"item.ragium.sooty_iron_pickaxe": "煤鉄のツルハシ",
"item.ragium.sooty_iron_shovel": "煤鉄のショベル",
"item.ragium.sooty_iron_sword": "煤鉄の剣",
"item.ragium.splash_bottle": "スプラッシュ瓶",
"item.ragium.sulfur_dioxide_bucket": "二酸化硫黄入りバケツ",
"item.ragium.sulfur_dust": "硫黄の粉",
"item.ragium.sulfur_trioxide_bucket": "三酸化硫黄入りバケツ",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/lingering_potion"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/splash_potion"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_dragon_breath": {
"conditions": {
"items": [
{
"items": "minecraft:dragon_breath"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "ragium:lingering_bottle"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_dragon_breath"
]
],
"rewards": {
"recipes": [
"ragium:lingering_bottle"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_gunpowders": {
"conditions": {
"items": [
{
"items": "#c:gunpowders"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "ragium:splash_bottle"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_gunpowders"
]
],
"rewards": {
"recipes": [
"ragium:splash_bottle"
]
}
}
Loading