mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
player model, skin layer fixes
This commit is contained in:
parent
7a49d20e75
commit
5d9405828b
@ -94,8 +94,9 @@ abstract class PlayerEntity(
|
||||
for (part in SkinParts.VALUES) {
|
||||
if (!flags.isBitMask(part.bitmask)) {
|
||||
skinParts -= part
|
||||
} else {
|
||||
skinParts += part
|
||||
}
|
||||
skinParts += part
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,12 @@ package de.bixilon.minosoft.data.registries.blocks.types.entity.storage
|
||||
import de.bixilon.minosoft.data.colors.DyeColors
|
||||
import de.bixilon.minosoft.data.entities.block.container.storage.ShulkerBoxBlockEntity
|
||||
import de.bixilon.minosoft.data.registries.blocks.factory.BlockFactory
|
||||
import de.bixilon.minosoft.data.registries.blocks.light.CustomLightProperties
|
||||
import de.bixilon.minosoft.data.registries.blocks.settings.BlockSettings
|
||||
import de.bixilon.minosoft.data.registries.blocks.state.BlockState
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.Block
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.properties.DyedBlock
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.properties.LightedBlock
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.properties.item.BlockWithItem
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.special.FullOpaqueBlock
|
||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
|
||||
@ -28,7 +31,7 @@ import de.bixilon.minosoft.data.registries.registries.Registries
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.state.render.property.FullBlockPropertyRenderer
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
|
||||
open class ShulkerBoxBlock(identifier: ResourceLocation, settings: BlockSettings) : Block(identifier, settings), StorageBlock<ShulkerBoxBlockEntity>, FullOpaqueBlock, BlockWithItem<Item> {
|
||||
open class ShulkerBoxBlock(identifier: ResourceLocation, settings: BlockSettings) : Block(identifier, settings), StorageBlock<ShulkerBoxBlockEntity>, FullOpaqueBlock, BlockWithItem<Item>, LightedBlock {
|
||||
override val item: Item = this::item.inject(identifier)
|
||||
override val hardness: Float get() = 2.0f
|
||||
|
||||
@ -37,8 +40,11 @@ open class ShulkerBoxBlock(identifier: ResourceLocation, settings: BlockSettings
|
||||
}
|
||||
|
||||
override fun createBlockEntity(connection: PlayConnection) = ShulkerBoxBlockEntity(connection)
|
||||
override fun getLightProperties(blockState: BlockState) = LIGHT_PROPERTIES
|
||||
|
||||
|
||||
companion object : BlockFactory<ShulkerBoxBlock> {
|
||||
val LIGHT_PROPERTIES = CustomLightProperties(true, true, true)
|
||||
override val identifier = minecraft("shulker_box")
|
||||
|
||||
override fun build(registries: Registries, settings: BlockSettings) = ShulkerBoxBlock(identifier, settings = settings)
|
||||
|
@ -16,7 +16,6 @@ package de.bixilon.minosoft.gui.rendering.entities.model.biped
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.observer.set.SetObserver.Companion.observeSet
|
||||
import de.bixilon.minosoft.data.entities.entities.player.SkinParts.Companion.pack
|
||||
import de.bixilon.minosoft.data.entities.entities.player.local.LocalPlayerEntity
|
||||
import de.bixilon.minosoft.gui.rendering.entities.renderer.player.PlayerRenderer
|
||||
import de.bixilon.minosoft.gui.rendering.skeletal.baked.BakedSkeletalModel
|
||||
|
||||
@ -34,7 +33,7 @@ open class PlayerModel(
|
||||
|
||||
override fun draw() {
|
||||
val renderer = this.renderer.unsafeCast<PlayerRenderer<*>>()
|
||||
manager.context.system.reset(faceCulling = renderer.entity is LocalPlayerEntity) // TODO: and !renderSelf
|
||||
manager.context.system.reset(faceCulling = false) // TODO: !renderSelf
|
||||
|
||||
shader.use()
|
||||
shader.texture = renderer.skin?.shaderId ?: renderer.renderer.context.textures.debugTexture.shaderId
|
||||
|
@ -49,7 +49,10 @@ class PlayerModelMesh(context: RenderContext, initialCacheSize: Int = 1000) : Ab
|
||||
private fun String.getSkinPart(): SkinParts? = when (this) {
|
||||
"head.hat" -> SkinParts.HAT
|
||||
"body.jacket" -> SkinParts.JACKET
|
||||
// TODO
|
||||
"left_leg.pants" -> SkinParts.LEFT_PANTS
|
||||
"right_leg.pants" -> SkinParts.RIGHT_PANTS
|
||||
"left_arm.sleeve" -> SkinParts.LEFT_SLEEVE
|
||||
"right_arm.sleeve" -> SkinParts.RIGHT_SLEEVE
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ open class PlayerRenderer<E : PlayerEntity>(renderer: EntitiesRenderer, entity:
|
||||
SkinModel.WIDE -> WIDE
|
||||
SkinModel.SLIM -> SLIM
|
||||
}
|
||||
return renderer.context.models.skeletal[WIDE] // TODO: implement both models and use accordingly
|
||||
return renderer.context.models.skeletal[name]
|
||||
}
|
||||
|
||||
override fun onDynamicTextureChange(texture: DynamicTexture): Boolean {
|
||||
|
@ -37,7 +37,7 @@ class TransformInstance(
|
||||
}
|
||||
|
||||
fun pack(buffer: FloatBuffer, parent: Mat4, temp: Mat4) {
|
||||
parent.times(value, temp)
|
||||
val temp = parent * value // TODO: memory optimize that again
|
||||
val offset = this.id * Mat4.length
|
||||
for (index in 0 until Mat4.length) {
|
||||
buffer.put(offset + index, temp.array[index])
|
||||
|
@ -51,7 +51,7 @@ class ClientSettingsManager(
|
||||
}
|
||||
|
||||
fun initSkins() {
|
||||
connection.profiles.connection.skin::parts.observeSet(this, true) { connection.player.skinParts += it.adds; connection.player.skinParts -= it.removes }
|
||||
connection.profiles.connection.skin::parts.observeSet(this, true) { connection.player.skinParts += it.adds; connection.player.skinParts -= it.removes; sendClientSettings() }
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
@ -0,0 +1,135 @@
|
||||
{
|
||||
"elements": {
|
||||
"body": {
|
||||
"offset": [0, 12, 0],
|
||||
"from": [-4, 0, -2],
|
||||
"to": [4, 12, 2],
|
||||
"texture": "minecraft:skin",
|
||||
"uv": [16, 16],
|
||||
"rotation": [180, 0, 0],
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"jacket": {
|
||||
"from": [-4, 0, -2],
|
||||
"to": [4, 12, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [16, 32],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"head": {
|
||||
"offset": [0, 24, 0],
|
||||
"from": [-4, 0, -4],
|
||||
"to": [4, 8, 4],
|
||||
"uv": [0, 0],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "head",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"hat": {
|
||||
"from": [-4, 0, -4],
|
||||
"to": [4, 8, 4],
|
||||
"inflate": 0.5,
|
||||
"uv": [32, 0],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"left_leg": {
|
||||
"from": [-4, 0, -2],
|
||||
"to": [0, 12, 2],
|
||||
"uv": [16, 48],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "left_leg",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"pants": {
|
||||
"from": [-4, 0, -2],
|
||||
"to": [0, 12, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [0, 48],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"right_leg": {
|
||||
"from": [0, 0, -2],
|
||||
"to": [4, 12, 2],
|
||||
"uv": [0, 16],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "right_leg",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"pants": {
|
||||
"from": [0, 0, -2],
|
||||
"to": [4, 12, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [0, 32],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"left_arm": {
|
||||
"from": [-7, 12, -2],
|
||||
"to": [-4, 24, 2],
|
||||
"uv": [32, 48],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "left_arm",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"sleeve": {
|
||||
"from": [-7, 12, -2],
|
||||
"to": [-4, 24, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [48, 48],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"right_arm": {
|
||||
"from": [4, 12, -2],
|
||||
"to": [7, 24, 2],
|
||||
"uv": [40, 16],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "right_arm",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"sleeve": {
|
||||
"from": [4, 12, -2],
|
||||
"to": [7, 24, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [40, 32],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"transforms": {
|
||||
"head": {
|
||||
"pivot": [0, 24, 0]
|
||||
},
|
||||
"left_leg": {
|
||||
"pivot": [3, 12, 0]
|
||||
},
|
||||
"right_leg": {
|
||||
"pivot": [3, 12, 0]
|
||||
},
|
||||
"left_arm": {
|
||||
"pivot": [-4, 24, 0]
|
||||
},
|
||||
"right_arm": {
|
||||
"pivot": [4, 24, 0]
|
||||
}
|
||||
},
|
||||
"textures": {
|
||||
"minecraft:skin": {
|
||||
"resolution": [64, 64]
|
||||
}
|
||||
}
|
||||
}
|
@ -36,11 +36,95 @@
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"left_leg": {
|
||||
"from": [-4, 0, -2],
|
||||
"to": [0, 12, 2],
|
||||
"uv": [16, 48],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "left_leg",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"pants": {
|
||||
"from": [-4, 0, -2],
|
||||
"to": [0, 12, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [0, 48],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"right_leg": {
|
||||
"from": [0, 0, -2],
|
||||
"to": [4, 12, 2],
|
||||
"uv": [0, 16],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "right_leg",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"pants": {
|
||||
"from": [0, 0, -2],
|
||||
"to": [4, 12, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [0, 32],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"left_arm": {
|
||||
"from": [-8, 12, -2],
|
||||
"to": [-4, 24, 2],
|
||||
"uv": [32, 48],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "left_arm",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"sleeve": {
|
||||
"from": [-8, 12, -2],
|
||||
"to": [-4, 24, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [48, 48],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
},
|
||||
"right_arm": {
|
||||
"from": [4, 12, -2],
|
||||
"to": [8, 24, 2],
|
||||
"uv": [40, 16],
|
||||
"rotation": [180, 0, 0],
|
||||
"texture": "minecraft:skin",
|
||||
"transform": "right_arm",
|
||||
"faces": "all",
|
||||
"children": {
|
||||
"sleeve": {
|
||||
"from": [4, 12, -2],
|
||||
"to": [8, 24, 2],
|
||||
"inflate": 0.25,
|
||||
"uv": [40, 32],
|
||||
"faces": "all"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"transforms": {
|
||||
"head": {
|
||||
"pivot": [0, 24, 0]
|
||||
},
|
||||
"left_leg": {
|
||||
"pivot": [3, 12, 0]
|
||||
},
|
||||
"right_leg": {
|
||||
"pivot": [3, 12, 0]
|
||||
},
|
||||
"left_arm": {
|
||||
"pivot": [-4, 24, 0]
|
||||
},
|
||||
"right_arm": {
|
||||
"pivot": [4, 24, 0]
|
||||
}
|
||||
},
|
||||
"textures": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user