Skip to content

Commit

Permalink
Split some contents from RagiumContents
Browse files Browse the repository at this point in the history
Added new processor machine "Multi Smelter"
  • Loading branch information
Hiiragi283 committed Nov 5, 2024
1 parent 85fcbd9 commit 5ed2b0f
Show file tree
Hide file tree
Showing 82 changed files with 1,325 additions and 885 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import net.minecraft.util.Identifier
object HTClientMachinePropertyKeys {
@JvmField
val DYNAMIC_RENDERER: HTPropertyKey.Simple<HTMachineEntityRenderer> =
HTPropertyKey.Simple(RagiumAPI.id("dynamic_renderer"))
HTPropertyKey.ofSimple(RagiumAPI.id("dynamic_renderer"))

@JvmField
val MODEL_ID: HTPropertyKey.Defaulted<Identifier> =
HTPropertyKey.Defaulted(RagiumAPI.id("model_id")) { HTProcessorMachineModel.MODEL_ID }
HTPropertyKey.ofDefaulted(RagiumAPI.id("model_id")) { HTProcessorMachineModel.MODEL_ID }
}
23 changes: 21 additions & 2 deletions src/client/kotlin/hiiragi283/ragium/client/RagiumClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import hiiragi283.ragium.api.RagiumAPI
import hiiragi283.ragium.api.content.HTRegistryContent
import hiiragi283.ragium.api.extension.getOrNull
import hiiragi283.ragium.api.gui.HTMachineScreenBase
import hiiragi283.ragium.api.machine.block.HTMachineBlockEntityBase
import hiiragi283.ragium.client.extension.getBlockEntity
import hiiragi283.ragium.client.extension.registerClientReceiver
import hiiragi283.ragium.client.gui.HTFireboxMachineScreen
Expand All @@ -14,6 +15,7 @@ import hiiragi283.ragium.client.model.HTFluidCubeModel
import hiiragi283.ragium.client.model.HTProcessorMachineModel
import hiiragi283.ragium.client.renderer.HTFireboxBlockEntityRenderer
import hiiragi283.ragium.client.renderer.HTItemDisplayBlockEntityRenderer
import hiiragi283.ragium.client.renderer.HTMachineBlockEntityRenderer
import hiiragi283.ragium.common.RagiumContents
import hiiragi283.ragium.common.init.*
import hiiragi283.ragium.common.network.HTFloatingItemPayload
Expand All @@ -33,6 +35,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant
import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.block.entity.BlockEntityType
import net.minecraft.client.gui.screen.Screen
import net.minecraft.client.gui.screen.ingame.HandledScreens
import net.minecraft.client.render.RenderLayer
Expand Down Expand Up @@ -61,6 +64,7 @@ object RagiumClient : ClientModInitializer {

// Blocks //

@JvmStatic
private fun registerBlocks() {
// cutout
buildList {
Expand All @@ -87,30 +91,41 @@ object RagiumClient : ClientModInitializer {
BlockEntityRendererFactories.register(RagiumBlockEntityTypes.FIREBOX) { HTFireboxBlockEntityRenderer }
BlockEntityRendererFactories.register(RagiumBlockEntityTypes.ITEM_DISPLAY) { HTItemDisplayBlockEntityRenderer }

registerMachineRenderer(RagiumBlockEntityTypes.MULTI_SMELTER)

ColorProviderRegistry.BLOCK.register({ state: BlockState, _: BlockRenderView?, _: BlockPos?, _: Int ->
state.getOrNull(RagiumBlockProperties.COLOR)?.fireworkColor ?: -1
}, RagiumBlocks.BACKPACK_INTERFACE)
}

@JvmStatic
private fun registerCutout(block: Block) {
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout())
}

@JvmStatic
private fun registerCutoutMipped(block: Block) {
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutoutMipped())
}

@JvmStatic
private fun <T : HTMachineBlockEntityBase> registerMachineRenderer(type: BlockEntityType<T>) {
BlockEntityRendererFactories.register(type) { HTMachineBlockEntityRenderer }
}

// Entities //

@JvmStatic
private fun registerEntities() {
EntityRendererRegistry.register(RagiumEntityTypes.REMOVER_DYNAMITE, ::FlyingItemEntityRenderer)
EntityRendererRegistry.register(RagiumEntityTypes.DYNAMITE, ::FlyingItemEntityRenderer)
}

// Fluids //

@JvmStatic
private fun registerFluids() {
RagiumContents.Fluids.entries.forEach { fluid: RagiumContents.Fluids ->
RagiumFluids.entries.forEach { fluid: RagiumFluids ->
FluidRenderHandlerRegistry.INSTANCE.register(
fluid.value,
SimpleFluidRenderHandler(
Expand All @@ -124,14 +139,16 @@ object RagiumClient : ClientModInitializer {

// Items //

@JvmStatic
private fun registerItems() {
ColorProviderRegistry.ITEM.register({ stack: ItemStack, _: Int ->
stack.get(RagiumComponentTypes.COLOR)?.entityColor ?: -1
}, RagiumContents.Misc.BACKPACK)
}, RagiumItems.BACKPACK)
}

// Screens //

@JvmStatic
private fun registerScreens() {
HandledScreens.register(RagiumScreenHandlerTypes.FIREBOX, ::HTFireboxMachineScreen)
HandledScreens.register(RagiumScreenHandlerTypes.LARGE_MACHINE, ::HTLargeMachineScreen)
Expand All @@ -141,6 +158,7 @@ object RagiumClient : ClientModInitializer {

// Events //

@JvmStatic
private fun registerEvents() {
ModelLoadingPlugin.register { context: ModelLoadingPlugin.Context ->
// register item model resolver
Expand All @@ -160,6 +178,7 @@ object RagiumClient : ClientModInitializer {

// Networks //

@JvmStatic
private fun registerNetworks() {
RagiumNetworks.FLOATING_ITEM.registerClientReceiver { payload: HTFloatingItemPayload, context: ClientPlayNetworking.Context ->
context.client().gameRenderer.showFloatingItem(payload.stack)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import hiiragi283.ragium.api.RagiumAPI
import hiiragi283.ragium.api.RagiumPlugin
import hiiragi283.ragium.api.extension.isClientEnv
import hiiragi283.ragium.api.machine.HTClientMachinePropertyKeys
import hiiragi283.ragium.api.machine.HTMachineKey
import hiiragi283.ragium.api.renderer.HTMultiblockPreviewRenderer
import hiiragi283.ragium.common.init.RagiumMachineKeys

Expand All @@ -14,7 +15,7 @@ object RagiumDefaultClientPlugin : RagiumPlugin {

override fun shouldLoad(): Boolean = isClientEnv()

override fun setupClientMachineProperties(helper: RagiumPlugin.PropertyHelper) {
override fun setupClientMachineProperties(helper: RagiumPlugin.PropertyHelper<HTMachineKey>) {
helper.modify(RagiumMachineKeys.BLAST_FURNACE) {
set(HTClientMachinePropertyKeys.DYNAMIC_RENDERER, HTMultiblockPreviewRenderer)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package hiiragi283.ragium.client.model
import hiiragi283.ragium.api.RagiumAPI
import hiiragi283.ragium.client.extension.FLUID_CUBE_TRANSFORM
import hiiragi283.ragium.client.extension.getSpriteAndColor
import hiiragi283.ragium.common.RagiumContents
import hiiragi283.ragium.common.init.RagiumComponentTypes
import hiiragi283.ragium.common.init.RagiumItems
import net.fabricmc.api.EnvType
import net.fabricmc.api.Environment
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView
Expand Down Expand Up @@ -75,7 +75,7 @@ data object HTFluidCubeModel : UnbakedModel, BakedModel {
.getInstance()
.itemRenderer
.models
.getModel(RagiumContents.Misc.EMPTY_FLUID_CUBE.asItem())
.getModel(RagiumItems.EMPTY_FLUID_CUBE.asItem())
?.emitItemQuads(stack, randomSupplier, context)
// render fluid
val (sprite: Sprite, color: Int) = stack.get(RagiumComponentTypes.FLUID)?.getSpriteAndColor() ?: return
Expand Down
139 changes: 69 additions & 70 deletions src/client/kotlin/hiiragi283/ragium/data/RagiumLangProviders.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ object RagiumLangProviders {
addAll(HTCrafterHammerItem.Behavior.entries)
}.forEach { item: HTContent<Item> -> builder.add(item, item.getTranslation(type)) }
// fluids
RagiumContents.Fluids.entries.forEach { fluid: RagiumContents.Fluids ->
RagiumFluids.entries.forEach { fluid: RagiumFluids ->
builder.add(
fluid.translationKey,
fluid.getTranslation(type),
Expand Down Expand Up @@ -130,34 +130,34 @@ object RagiumLangProviders {
builder.add(RagiumEnchantments.SLEDGE_HAMMER, "Sledge Hammer")
builder.add(RagiumEnchantments.BUZZ_SAW, "Buzz Saw")
// Items
builder.add(RagiumContents.Foods.BEE_WAX, "Bee Wax")
builder.add(RagiumContents.Foods.BUTTER, "Butter")
builder.add(RagiumContents.Foods.CARAMEL, "Caramel")
builder.add(RagiumContents.Foods.CHOCOLATE, "Chocolate")
builder.add(RagiumContents.Foods.CHOCOLATE_APPLE, "Chocolate Apple")
builder.add(RagiumContents.Foods.CHOCOLATE_BREAD, "Chocolate Bread")
builder.add(RagiumContents.Foods.FLOUR, "Flour")
builder.add(RagiumContents.Foods.DOUGH, "Dough")
builder.add(RagiumContents.Foods.MINCED_MEAT, "Minced Meat")
builder.add(RagiumContents.Foods.PULP, "Pulp")

builder.add(RagiumContents.Misc.BACKPACK, "Backpack")
builder.add(RagiumContents.Misc.BASALT_MESH, "Basalt Mesh")
builder.add(RagiumContents.Misc.CRAFTER_HAMMER, "Crafter's Hammer")
builder.add(RagiumContents.Misc.DYNAMITE, "Dynamite")
builder.add(RagiumContents.Misc.EMPTY_FLUID_CUBE, "Fluid Cube (Empty)")
builder.add(RagiumContents.Misc.FILLED_FLUID_CUBE, "Fluid Cube (%s)")
builder.add(RagiumContents.Misc.ENGINE, "V8 Engine")
builder.add(RagiumContents.Misc.FORGE_HAMMER, "Forge Hammer")
builder.add(RagiumContents.Misc.HEART_OF_THE_NETHER, "Heart of the Nether")
builder.add(RagiumContents.Misc.POLYMER_RESIN, "Polymer Resin")
builder.add(RagiumContents.Misc.PROCESSOR_SOCKET, "Processor Socket")
builder.add(RagiumContents.Misc.RAGI_ALLOY_COMPOUND, "Ragi-Alloy Compound")
builder.add(RagiumContents.Misc.RAGI_CRYSTAL_PROCESSOR, "Ragi-Crystal Processor")
builder.add(RagiumContents.Misc.REMOVER_DYNAMITE, "Remover Dynamite")
builder.add(RagiumContents.Misc.SOAP_INGOT, "Soap Ingot")
builder.add(RagiumContents.Misc.SOLAR_PANEL, "Solar Panel")
builder.add(RagiumContents.Misc.TRADER_CATALOG, "Trader Catalog")
builder.add(RagiumItems.BEE_WAX, "Bee Wax")
builder.add(RagiumItems.BUTTER, "Butter")
builder.add(RagiumItems.CARAMEL, "Caramel")
builder.add(RagiumItems.CHOCOLATE, "Chocolate")
builder.add(RagiumItems.CHOCOLATE_APPLE, "Chocolate Apple")
builder.add(RagiumItems.CHOCOLATE_BREAD, "Chocolate Bread")
builder.add(RagiumItems.FLOUR, "Flour")
builder.add(RagiumItems.DOUGH, "Dough")
builder.add(RagiumItems.MINCED_MEAT, "Minced Meat")
builder.add(RagiumItems.PULP, "Pulp")

builder.add(RagiumItems.BACKPACK, "Backpack")
builder.add(RagiumItems.BASALT_MESH, "Basalt Mesh")
builder.add(RagiumItems.CRAFTER_HAMMER, "Crafter's Hammer")
builder.add(RagiumItems.DYNAMITE, "Dynamite")
builder.add(RagiumItems.EMPTY_FLUID_CUBE, "Fluid Cube (Empty)")
builder.add(RagiumItems.FILLED_FLUID_CUBE, "Fluid Cube (%s)")
builder.add(RagiumItems.ENGINE, "V8 Engine")
builder.add(RagiumItems.FORGE_HAMMER, "Forge Hammer")
builder.add(RagiumItems.HEART_OF_THE_NETHER, "Heart of the Nether")
builder.add(RagiumItems.POLYMER_RESIN, "Polymer Resin")
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.REMOVER_DYNAMITE, "Remover Dynamite")
builder.add(RagiumItems.SOAP_INGOT, "Soap Ingot")
builder.add(RagiumItems.SOLAR_PANEL, "Solar Panel")
builder.add(RagiumItems.TRADER_CATALOG, "Trader Catalog")

builder.add(RagiumTranslationKeys.CRAFTER_HAMMER_MODULE, "Module: %s")
builder.add(RagiumTranslationKeys.DYNAMITE_DESTROY, "Destroy: %s")
Expand Down Expand Up @@ -221,24 +221,24 @@ object RagiumLangProviders {
"Smelt two ingredients into one",
)
builder.add(RagiumMachineKeys.ASSEMBLER, "Assembler")
builder.add(RagiumMachineKeys.CHEMICAL_REACTOR, "Chemical Reactor")
builder.add(RagiumMachineKeys.ELECTROLYZER, "Electrolyzer")
builder.add(RagiumMachineKeys.EXTRACTOR, "Extractor")
builder.add(RagiumMachineKeys.GRINDER, "Grinder")
builder.add(RagiumMachineKeys.METAL_FORMER, "Metal Former")
builder.add(RagiumMachineKeys.MIXER, "Mixer")
builder.add(RagiumMachineKeys.ROCK_GENERATOR, "Rock Generator")

builder.add(
RagiumMachineKeys.BLAST_FURNACE,
"Large Blast Furnace",
"Smelt multiple ingredients into one",
)
builder.add(RagiumMachineKeys.CHEMICAL_REACTOR, "Chemical Reactor")
builder.add(
RagiumMachineKeys.DISTILLATION_TOWER,
"Distillation Tower",
"Process Crude Oil",
)
builder.add(RagiumMachineKeys.ELECTROLYZER, "Electrolyzer")
builder.add(RagiumMachineKeys.EXTRACTOR, "Extractor")
builder.add(RagiumMachineKeys.GRINDER, "Grinder")
builder.add(RagiumMachineKeys.METAL_FORMER, "Metal Former")
builder.add(RagiumMachineKeys.MIXER, "Mixer")
builder.add(RagiumMachineKeys.MULTI_SMELTER, "Multi Smelter")
builder.add(RagiumMachineKeys.ROCK_GENERATOR, "Rock Generator")
builder.add(
RagiumMachineKeys.SAW_MILL,
"Saw Mill",
Expand Down Expand Up @@ -305,35 +305,35 @@ object RagiumLangProviders {
builder.add(RagiumEnchantments.SLEDGE_HAMMER, "粉砕")
builder.add(RagiumEnchantments.BUZZ_SAW, "製材")
// Items
builder.add(RagiumContents.Foods.BEE_WAX, "蜜蠟")
builder.add(RagiumContents.Foods.BUTTER, "バター")
builder.add(RagiumContents.Foods.CARAMEL, "キャラメル")
builder.add(RagiumContents.Foods.CHOCOLATE, "チョコレート")
builder.add(RagiumContents.Foods.CHOCOLATE_APPLE, "チョコリンゴ")
builder.add(RagiumContents.Foods.CHOCOLATE_BREAD, "チョコパン")
builder.add(RagiumContents.Foods.FLOUR, "小麦粉")
builder.add(RagiumContents.Foods.DOUGH, "生地")
builder.add(RagiumContents.Foods.MINCED_MEAT, "ひき肉")
builder.add(RagiumContents.Foods.PULP, "パルプ")

builder.add(RagiumContents.Misc.BACKPACK, "バックパック")
builder.add(RagiumContents.Misc.BASALT_MESH, "玄武岩メッシュ")
builder.add(RagiumContents.Misc.CRAFTER_HAMMER, "クラフターズ・ハンマー")
builder.add(RagiumContents.Misc.DYNAMITE, "ダイナマイト")
builder.add(RagiumContents.Misc.EMPTY_FLUID_CUBE, "液体キューブ(なし)")
builder.add(RagiumContents.Misc.FILLED_FLUID_CUBE, "液体キューブ(%s)")
builder.add(RagiumContents.Misc.ENGINE, "V8エンジン")
builder.add(RagiumContents.Misc.FORGE_HAMMER, "鍛造ハンマー")
builder.add(RagiumContents.Misc.HEART_OF_THE_NETHER, "地獄の心臓")
// builder.add(RagiumContents.Misc.OBLIVION_CUBE_SPAWN_EGG, "スポーン 忘却の箱")
builder.add(RagiumContents.Misc.POLYMER_RESIN, "高分子樹脂")
builder.add(RagiumContents.Misc.PROCESSOR_SOCKET, "プロセッサソケット")
builder.add(RagiumContents.Misc.RAGI_ALLOY_COMPOUND, "ラギ合金混合物")
builder.add(RagiumContents.Misc.RAGI_CRYSTAL_PROCESSOR, "ラギクリスタリルプロセッサ")
builder.add(RagiumContents.Misc.REMOVER_DYNAMITE, "削除用ダイナマイト")
builder.add(RagiumContents.Misc.SOAP_INGOT, "石鹸インゴット")
builder.add(RagiumContents.Misc.SOLAR_PANEL, "太陽光パネル")
builder.add(RagiumContents.Misc.TRADER_CATALOG, "行商人カタログ")
builder.add(RagiumItems.BEE_WAX, "蜜蠟")
builder.add(RagiumItems.BUTTER, "バター")
builder.add(RagiumItems.CARAMEL, "キャラメル")
builder.add(RagiumItems.CHOCOLATE, "チョコレート")
builder.add(RagiumItems.CHOCOLATE_APPLE, "チョコリンゴ")
builder.add(RagiumItems.CHOCOLATE_BREAD, "チョコパン")
builder.add(RagiumItems.FLOUR, "小麦粉")
builder.add(RagiumItems.DOUGH, "生地")
builder.add(RagiumItems.MINCED_MEAT, "ひき肉")
builder.add(RagiumItems.PULP, "パルプ")

builder.add(RagiumItems.BACKPACK, "バックパック")
builder.add(RagiumItems.BASALT_MESH, "玄武岩メッシュ")
builder.add(RagiumItems.CRAFTER_HAMMER, "クラフターズ・ハンマー")
builder.add(RagiumItems.DYNAMITE, "ダイナマイト")
builder.add(RagiumItems.EMPTY_FLUID_CUBE, "液体キューブ(なし)")
builder.add(RagiumItems.FILLED_FLUID_CUBE, "液体キューブ(%s)")
builder.add(RagiumItems.ENGINE, "V8エンジン")
builder.add(RagiumItems.FORGE_HAMMER, "鍛造ハンマー")
builder.add(RagiumItems.HEART_OF_THE_NETHER, "地獄の心臓")
// builder.add(RagiumItems.OBLIVION_CUBE_SPAWN_EGG, "スポーン 忘却の箱")
builder.add(RagiumItems.POLYMER_RESIN, "高分子樹脂")
builder.add(RagiumItems.PROCESSOR_SOCKET, "プロセッサソケット")
builder.add(RagiumItems.RAGI_ALLOY_COMPOUND, "ラギ合金混合物")
builder.add(RagiumItems.RAGI_CRYSTAL_PROCESSOR, "ラギクリスタリルプロセッサ")
builder.add(RagiumItems.REMOVER_DYNAMITE, "削除用ダイナマイト")
builder.add(RagiumItems.SOAP_INGOT, "石鹸インゴット")
builder.add(RagiumItems.SOLAR_PANEL, "太陽光パネル")
builder.add(RagiumItems.TRADER_CATALOG, "行商人カタログ")

builder.add(RagiumTranslationKeys.CRAFTER_HAMMER_MODULE, "モジュール: %s")
builder.add(RagiumTranslationKeys.DYNAMITE_DESTROY, "地形破壊: %s")
Expand Down Expand Up @@ -373,18 +373,17 @@ object RagiumLangProviders {

builder.add(RagiumMachineKeys.ALLOY_FURNACE, "合金かまど", "二つの素材を一つに焼き上げる")
builder.add(RagiumMachineKeys.ASSEMBLER, "組立機")
builder.add(RagiumMachineKeys.BLAST_FURNACE, "大型高炉", "複数の素材を一つに焼き上げる")
builder.add(RagiumMachineKeys.CHEMICAL_REACTOR, "化学反応槽")
builder.add(RagiumMachineKeys.DISTILLATION_TOWER, "蒸留塔", "原油を処理する")
builder.add(RagiumMachineKeys.ELECTROLYZER, "電解槽")
builder.add(RagiumMachineKeys.EXTRACTOR, "抽出器")
builder.add(RagiumMachineKeys.GRINDER, "粉砕機")
builder.add(RagiumMachineKeys.METAL_FORMER, "金属加工機")
builder.add(RagiumMachineKeys.MULTI_SMELTER, "並列精錬機")
builder.add(RagiumMachineKeys.MIXER, "ミキサー")
builder.add(RagiumMachineKeys.ROCK_GENERATOR, "岩石生成機", "岩石を生成する")

builder.add(RagiumMachineKeys.BLAST_FURNACE, "大型高炉", "複数の素材を一つに焼き上げる")
builder.add(RagiumMachineKeys.DISTILLATION_TOWER, "蒸留塔", "原油を処理する")
builder.add(RagiumMachineKeys.SAW_MILL, "製材機", "より効率的に原木を加工する")

// Mod Menu
builder.add(RagiumTranslationKeys.CONFIG_TILE, "Ragium - Config")
builder.add(RagiumTranslationKeys.CONFIG_IS_HARD_MODE, "ハードモードの切り替え(reloadコマンドで反映)")
Expand Down
Loading

0 comments on commit 5ed2b0f

Please sign in to comment.