Add Crafting Terminal texture/model
This commit is contained in:
parent
9d98481ba5
commit
12e055d645
|
@ -6,7 +6,7 @@ import net.minecraft.client.render.model.UnbakedModel
|
||||||
import net.minecraft.resource.ResourceManager
|
import net.minecraft.resource.ResourceManager
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import net.shadowfacts.phycon.PhysicalConnectivity
|
import net.shadowfacts.phycon.PhysicalConnectivity
|
||||||
import net.shadowfacts.phycon.client.model.TerminalModel
|
import net.shadowfacts.phycon.client.model.ScreenDeviceModel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author shadowfacts
|
* @author shadowfacts
|
||||||
|
@ -15,11 +15,13 @@ class PhyExtendedModelProvider(resourceManager: ResourceManager): ModelResourceP
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val TERMINAL = Identifier(PhysicalConnectivity.MODID, "block/terminal")
|
val TERMINAL = Identifier(PhysicalConnectivity.MODID, "block/terminal")
|
||||||
|
val CRAFTING_TERMINAL = Identifier(PhysicalConnectivity.MODID, "block/crafting_terminal")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loadModelResource(resourceId: Identifier, context: ModelProviderContext): UnbakedModel? {
|
override fun loadModelResource(resourceId: Identifier, context: ModelProviderContext): UnbakedModel? {
|
||||||
return when (resourceId) {
|
return when (resourceId) {
|
||||||
TERMINAL -> TerminalModel
|
TERMINAL -> ScreenDeviceModel(TERMINAL)
|
||||||
|
CRAFTING_TERMINAL -> ScreenDeviceModel(CRAFTING_TERMINAL)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,13 +27,18 @@ import java.util.function.Supplier
|
||||||
/**
|
/**
|
||||||
* @author shadowfacts
|
* @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"))
|
companion object {
|
||||||
private val CASING = SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier(PhysicalConnectivity.MODID, "block/casing"))
|
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<Mesh>
|
private lateinit var meshes: Array<Mesh>
|
||||||
private lateinit var terminalSprite: Sprite
|
private lateinit var screenSprite: Sprite
|
||||||
|
|
||||||
override fun getModelDependencies(): Collection<Identifier> {
|
override fun getModelDependencies(): Collection<Identifier> {
|
||||||
return listOf()
|
return listOf()
|
||||||
|
@ -43,7 +48,7 @@ object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel {
|
||||||
unbakedModelGetter: Function<Identifier, UnbakedModel>,
|
unbakedModelGetter: Function<Identifier, UnbakedModel>,
|
||||||
unresolvedTextureDependencies: MutableSet<Pair<String, String>>
|
unresolvedTextureDependencies: MutableSet<Pair<String, String>>
|
||||||
): Collection<SpriteIdentifier> {
|
): Collection<SpriteIdentifier> {
|
||||||
return listOf(TERMINAL, CASING)
|
return listOf(screenTexture, CASING)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bake(
|
override fun bake(
|
||||||
|
@ -53,7 +58,7 @@ object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel {
|
||||||
modelId: Identifier
|
modelId: Identifier
|
||||||
): BakedModel {
|
): BakedModel {
|
||||||
|
|
||||||
terminalSprite = textureGetter.apply(TERMINAL)
|
screenSprite = textureGetter.apply(screenTexture)
|
||||||
val casingSprite = textureGetter.apply(CASING)
|
val casingSprite = textureGetter.apply(CASING)
|
||||||
|
|
||||||
val renderer = RendererAccess.INSTANCE.renderer!!
|
val renderer = RendererAccess.INSTANCE.renderer!!
|
||||||
|
@ -67,25 +72,25 @@ object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel {
|
||||||
for (dir in Direction.values()) {
|
for (dir in Direction.values()) {
|
||||||
if (dir == facing) {
|
if (dir == facing) {
|
||||||
emitter.square(facing, 0f, 0f, 1f, 1f, QuadEmitter.CULL_FACE_EPSILON * 10)
|
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.spriteColor(0, -1, -1, -1, -1)
|
||||||
emitter.emit()
|
emitter.emit()
|
||||||
|
|
||||||
emitter.material(PhysicalConnectivityClient.screenMaterial)
|
emitter.material(PhysicalConnectivityClient.screenMaterial)
|
||||||
emitter.square(facing, 3/16f, 2/16f, 13/16f, 3/16f, 0f)
|
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.spriteColor(0, -1, -1, -1, -1)
|
||||||
emitter.emit()
|
emitter.emit()
|
||||||
|
|
||||||
emitter.material(PhysicalConnectivityClient.screenMaterial)
|
emitter.material(PhysicalConnectivityClient.screenMaterial)
|
||||||
emitter.square(facing, 2/16f, 3/16f, 14/16f, 13/16f, 0f)
|
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.spriteColor(0, -1, -1, -1, -1)
|
||||||
emitter.emit()
|
emitter.emit()
|
||||||
|
|
||||||
emitter.material(PhysicalConnectivityClient.screenMaterial)
|
emitter.material(PhysicalConnectivityClient.screenMaterial)
|
||||||
emitter.square(facing, 3/16f, 13/16f, 13/16f, 14/16f, 0f)
|
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.spriteColor(0, -1, -1, -1, -1)
|
||||||
emitter.emit()
|
emitter.emit()
|
||||||
} else {
|
} else {
|
||||||
|
@ -129,7 +134,7 @@ object TerminalModel: UnbakedModel, BakedModel, FabricBakedModel {
|
||||||
|
|
||||||
override fun isBuiltin() = false
|
override fun isBuiltin() = false
|
||||||
|
|
||||||
override fun getSprite() = terminalSprite
|
override fun getSprite() = screenSprite
|
||||||
|
|
||||||
override fun getTransformation() = null
|
override fun getTransformation() = null
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
Loading…
Reference in New Issue