diff --git a/src/main/kotlin/net/shadowfacts/phycon/client/PhyExtendedModelProvider.kt b/src/main/kotlin/net/shadowfacts/phycon/client/PhyExtendedModelProvider.kt index 4fb662a..6bdae08 100644 --- a/src/main/kotlin/net/shadowfacts/phycon/client/PhyExtendedModelProvider.kt +++ b/src/main/kotlin/net/shadowfacts/phycon/client/PhyExtendedModelProvider.kt @@ -6,7 +6,7 @@ import net.minecraft.client.render.model.UnbakedModel import net.minecraft.resource.ResourceManager import net.minecraft.util.Identifier import net.shadowfacts.phycon.PhysicalConnectivity -import net.shadowfacts.phycon.client.model.TerminalModel +import net.shadowfacts.phycon.client.model.ScreenDeviceModel /** * @author shadowfacts @@ -15,11 +15,13 @@ class PhyExtendedModelProvider(resourceManager: ResourceManager): ModelResourceP companion object { val TERMINAL = Identifier(PhysicalConnectivity.MODID, "block/terminal") + val CRAFTING_TERMINAL = Identifier(PhysicalConnectivity.MODID, "block/crafting_terminal") } override fun loadModelResource(resourceId: Identifier, context: ModelProviderContext): UnbakedModel? { return when (resourceId) { - TERMINAL -> TerminalModel + TERMINAL -> ScreenDeviceModel(TERMINAL) + CRAFTING_TERMINAL -> ScreenDeviceModel(CRAFTING_TERMINAL) else -> null } } diff --git a/src/main/kotlin/net/shadowfacts/phycon/client/model/TerminalModel.kt b/src/main/kotlin/net/shadowfacts/phycon/client/model/ScreenDeviceModel.kt similarity index 81% rename from src/main/kotlin/net/shadowfacts/phycon/client/model/TerminalModel.kt rename to src/main/kotlin/net/shadowfacts/phycon/client/model/ScreenDeviceModel.kt index 0954036..da84d2d 100644 --- a/src/main/kotlin/net/shadowfacts/phycon/client/model/TerminalModel.kt +++ b/src/main/kotlin/net/shadowfacts/phycon/client/model/ScreenDeviceModel.kt @@ -27,13 +27,18 @@ import java.util.function.Supplier /** * @author shadowfacts */ -object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel { +class ScreenDeviceModel( + screenTexture: Identifier, +): UnbakedModel, BakedModel, FabricBakedModel { - private val TERMINAL = SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier(PhysicalConnectivity.MODID, "block/terminal")) - private val CASING = SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier(PhysicalConnectivity.MODID, "block/casing")) + companion object { + private val CASING = SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier(PhysicalConnectivity.MODID, "block/casing")) + } + + private val screenTexture = SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, screenTexture) private lateinit var meshes: Array - private lateinit var terminalSprite: Sprite + private lateinit var screenSprite: Sprite override fun getModelDependencies(): Collection { return listOf() @@ -43,7 +48,7 @@ object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel { unbakedModelGetter: Function, unresolvedTextureDependencies: MutableSet> ): Collection { - return listOf(TERMINAL, CASING) + return listOf(screenTexture, CASING) } override fun bake( @@ -53,7 +58,7 @@ object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel { modelId: Identifier ): BakedModel { - terminalSprite = textureGetter.apply(TERMINAL) + screenSprite = textureGetter.apply(screenTexture) val casingSprite = textureGetter.apply(CASING) val renderer = RendererAccess.INSTANCE.renderer!! @@ -67,25 +72,25 @@ object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel { for (dir in Direction.values()) { if (dir == facing) { emitter.square(facing, 0f, 0f, 1f, 1f, QuadEmitter.CULL_FACE_EPSILON * 10) - emitter.spriteBake(0, terminalSprite, MutableQuadView.BAKE_LOCK_UV) + emitter.spriteBake(0, screenSprite, MutableQuadView.BAKE_LOCK_UV) emitter.spriteColor(0, -1, -1, -1, -1) emitter.emit() emitter.material(PhysicalConnectivityClient.screenMaterial) emitter.square(facing, 3/16f, 2/16f, 13/16f, 3/16f, 0f) - emitter.spriteBake(0, terminalSprite, MutableQuadView.BAKE_LOCK_UV) + emitter.spriteBake(0, screenSprite, MutableQuadView.BAKE_LOCK_UV) emitter.spriteColor(0, -1, -1, -1, -1) emitter.emit() emitter.material(PhysicalConnectivityClient.screenMaterial) emitter.square(facing, 2/16f, 3/16f, 14/16f, 13/16f, 0f) - emitter.spriteBake(0, terminalSprite, MutableQuadView.BAKE_LOCK_UV) + emitter.spriteBake(0, screenSprite, MutableQuadView.BAKE_LOCK_UV) emitter.spriteColor(0, -1, -1, -1, -1) emitter.emit() emitter.material(PhysicalConnectivityClient.screenMaterial) emitter.square(facing, 3/16f, 13/16f, 13/16f, 14/16f, 0f) - emitter.spriteBake(0, terminalSprite, MutableQuadView.BAKE_LOCK_UV) + emitter.spriteBake(0, screenSprite, MutableQuadView.BAKE_LOCK_UV) emitter.spriteColor(0, -1, -1, -1, -1) emitter.emit() } else { @@ -129,7 +134,7 @@ object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel { override fun isBuiltin() = false - override fun getSprite() = terminalSprite + override fun getSprite() = screenSprite override fun getTransformation() = null diff --git a/src/main/resources/assets/phycon/blockstates/crafting_terminal.json b/src/main/resources/assets/phycon/blockstates/crafting_terminal.json new file mode 100644 index 0000000..f43338a --- /dev/null +++ b/src/main/resources/assets/phycon/blockstates/crafting_terminal.json @@ -0,0 +1,27 @@ +{ + "variants": { + "facing=down": { + "model": "phycon:block/crafting_terminal", + "x": 90 + }, + "facing=up": { + "model": "phycon:block/crafting_terminal", + "x": 270 + }, + "facing=north": { + "model": "phycon:block/crafting_terminal" + }, + "facing=south": { + "model": "phycon:block/crafting_terminal", + "y": 180 + }, + "facing=west": { + "model": "phycon:block/crafting_terminal", + "y": 270 + }, + "facing=east": { + "model": "phycon:block/crafting_terminal", + "y": 90 + } + } +} diff --git a/src/main/resources/assets/phycon/models/block/crafting_terminal.json b/src/main/resources/assets/phycon/models/block/crafting_terminal.json new file mode 100644 index 0000000..30b25a7 --- /dev/null +++ b/src/main/resources/assets/phycon/models/block/crafting_terminal.json @@ -0,0 +1,14 @@ +{ + "parent": "block/cube", + "textures": { + "side": "phycon:block/casing", + "front": "phycon:block/crafting_terminal", + "particle": "#side", + "down": "#side", + "up": "#side", + "north": "#front", + "south": "#side", + "west": "#side", + "east": "#side" + } +} diff --git a/src/main/resources/assets/phycon/models/item/crafting_terminal.json b/src/main/resources/assets/phycon/models/item/crafting_terminal.json new file mode 100644 index 0000000..0377f47 --- /dev/null +++ b/src/main/resources/assets/phycon/models/item/crafting_terminal.json @@ -0,0 +1,13 @@ +{ + "parent": "block/cube", + "textures": { + "side": "phycon:block/casing", + "front": "phycon:block/crafting_terminal", + "down": "#side", + "up": "#side", + "north": "#side", + "south": "#side", + "west": "#side", + "east": "#front" + } +} diff --git a/src/main/resources/assets/phycon/textures/block/crafting_terminal.png b/src/main/resources/assets/phycon/textures/block/crafting_terminal.png new file mode 100644 index 0000000..b98f16a Binary files /dev/null and b/src/main/resources/assets/phycon/textures/block/crafting_terminal.png differ