mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 11:24:56 -04:00
bed models
This commit is contained in:
parent
199559bca7
commit
a4735d48f8
42
src/main/java/de/bixilon/minosoft/data/colors/DyeColors.kt
Normal file
42
src/main/java/de/bixilon/minosoft/data/colors/DyeColors.kt
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.colors
|
||||
|
||||
import de.bixilon.kutil.enums.EnumUtil
|
||||
import de.bixilon.kutil.enums.ValuesEnum
|
||||
|
||||
enum class DyeColors {
|
||||
WHITE,
|
||||
ORANGE,
|
||||
MAGENTA,
|
||||
LIGHT_BLUE,
|
||||
YELLOW,
|
||||
LIME,
|
||||
PINK,
|
||||
GRAY,
|
||||
LIGHT_GRAY,
|
||||
CYAN,
|
||||
PURPLE,
|
||||
BLUE,
|
||||
BROWN,
|
||||
GREEN,
|
||||
RED,
|
||||
BLACK,
|
||||
;
|
||||
|
||||
companion object : ValuesEnum<DyeColors> {
|
||||
override val VALUES: Array<DyeColors> = values()
|
||||
override val NAME_MAP: Map<String, DyeColors> = EnumUtil.getEnumValues(VALUES)
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,17 +13,17 @@
|
||||
|
||||
package de.bixilon.minosoft.data.entities.block
|
||||
|
||||
import de.bixilon.minosoft.data.colors.DyeColors
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.data.text.ChatColors
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
|
||||
class BedBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
|
||||
var color = ChatColors.RED
|
||||
var color = DyeColors.RED
|
||||
private set
|
||||
|
||||
|
||||
override fun updateNBT(nbt: Map<String, Any>) {
|
||||
color = ChatColors.RED // ToDo
|
||||
color = DyeColors.RED // ToDo
|
||||
}
|
||||
|
||||
companion object : BlockEntityFactory<BedBlockEntity> {
|
||||
|
@ -81,10 +81,6 @@ object ChatColors {
|
||||
nameMap[field.name.lowercase()] = color
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.VALUES = values.toTypedArray()
|
||||
this.NAME_MAP = nameMap.toMap()
|
||||
}
|
||||
|
@ -39,15 +39,25 @@ import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.get
|
||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.rotateAssign
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
|
||||
data class UnbakedBlockStateModel(
|
||||
class UnbakedBlockStateModel(
|
||||
val model: UnbakedBlockModel,
|
||||
val rotation: Vec2i?,
|
||||
val uvLock: Boolean,
|
||||
val weight: Int,
|
||||
textures: Map<String, String>?,
|
||||
) : AbstractUnbakedBlockModel {
|
||||
var baked: BakedBlockModel? = null
|
||||
override val textures: Map<String, String>
|
||||
get() = model.textures
|
||||
override var textures: Map<String, String> = model.textures
|
||||
private set
|
||||
|
||||
|
||||
init {
|
||||
if (textures != null && textures.isNotEmpty()) {
|
||||
val textureCopy = model.textures.toMutableMap()
|
||||
textureCopy.putAll(textures)
|
||||
this.textures = textureCopy
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun bake(renderWindow: RenderWindow): BakedBlockModel {
|
||||
@ -167,6 +177,7 @@ data class UnbakedBlockStateModel(
|
||||
rotation = data.toVec2iN(),
|
||||
uvLock = data["uvlock"]?.toBoolean() ?: false,
|
||||
weight = data["weight"]?.toInt() ?: 1,
|
||||
textures = data["textures"]?.unsafeCast(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
{
|
||||
"variants": {
|
||||
"part=head,facing=north": {
|
||||
"model": "minecraft:block/orange_bed_head"
|
||||
},
|
||||
"part=head,facing=east": {
|
||||
"model": "minecraft:block/orange_bed_head",
|
||||
"y": 90
|
||||
},
|
||||
"part=head,facing=south": {
|
||||
"model": "minecraft:block/orange_bed_head",
|
||||
"y": 180
|
||||
},
|
||||
"part=head,facing=west": {
|
||||
"model": "minecraft:block/orange_bed_head",
|
||||
"y": 270
|
||||
},
|
||||
"part=foot,facing=north": {
|
||||
"model": "minecraft:block/orange_bed_foot"
|
||||
},
|
||||
"part=foot,facing=east": {
|
||||
"model": "minecraft:block/orange_bed_foot",
|
||||
"y": 90
|
||||
},
|
||||
"part=foot,facing=south": {
|
||||
"model": "minecraft:block/orange_bed_foot",
|
||||
"y": 180
|
||||
},
|
||||
"part=foot,facing=west": {
|
||||
"model": "minecraft:block/orange_bed_foot",
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "minecraft:block/template_bed_foot",
|
||||
"textures": {
|
||||
"particle": "minecraft:block/oak_planks",
|
||||
"bed": "minecraft:entity/bed/orange"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "minecraft:block/template_bed_head",
|
||||
"textures": {
|
||||
"particle": "minecraft:block/oak_planks",
|
||||
"bed": "minecraft:entity/bed/orange"
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"__comment": "Base",
|
||||
"from": [0, 3, 0],
|
||||
"to": [16, 9, 16],
|
||||
"faces": {
|
||||
"up": {
|
||||
"uv": [1.5, 7, 5.5, 11],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"down": {
|
||||
"uv": [7, 7, 11, 11],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"east": {
|
||||
"uv": [5.5, 7, 7, 11],
|
||||
"texture": "#bed",
|
||||
"rotation": 90,
|
||||
"cullface": "east"
|
||||
},
|
||||
"south": {
|
||||
"uv": [5.5, 5.5, 9.5, 7],
|
||||
"texture": "#bed",
|
||||
"rotation": 180,
|
||||
"cullface": "south"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0.0, 7, 1.5, 11],
|
||||
"texture": "#bed",
|
||||
"rotation": 270,
|
||||
"cullface": "west"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "left",
|
||||
"from": [0, 0, 13],
|
||||
"to": [3, 3, 16],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [14, 3.0, 14.75, 3.75],
|
||||
"texture": "#bed",
|
||||
"cullface": "down"
|
||||
},
|
||||
"north": {
|
||||
"uv": [14.75, 3.75, 15.5, 4.5],
|
||||
"texture": "#bed",
|
||||
"cullface": "north"
|
||||
},
|
||||
"west": {
|
||||
"uv": [12.5, 3.75, 13.25, 4.5],
|
||||
"texture": "#bed",
|
||||
"cullface": "west"
|
||||
},
|
||||
"south": {
|
||||
"uv": [13.25, 3.75, 14, 4.5],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"east": {
|
||||
"uv": [14, 3.75, 14.75, 4.5],
|
||||
"texture": "#bed"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "right",
|
||||
"from": [13, 0, 13],
|
||||
"to": [16, 3, 16],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [14, 4.5, 14.75, 5.25],
|
||||
"texture": "#bed",
|
||||
"rotation": 90,
|
||||
"cullface": "down"
|
||||
},
|
||||
"north": {
|
||||
"uv": [14, 5.25, 14.75, 6],
|
||||
"texture": "#bed",
|
||||
"cullface": "north"
|
||||
},
|
||||
"west": {
|
||||
"uv": [14.75, 5.25, 15.5, 6],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"south": {
|
||||
"uv": [12.5, 5.25, 13.25, 6],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"east": {
|
||||
"uv": [13.25, 5.25, 14, 6],
|
||||
"texture": "#bed",
|
||||
"cullface": "east"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"__comment": "Base",
|
||||
"from": [0, 3, 0],
|
||||
"to": [16, 9, 16],
|
||||
"faces": {
|
||||
"up": {
|
||||
"uv": [1.5, 1.5, 5.5, 5.5],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"down": {
|
||||
"uv": [7, 1.5, 11, 5.5],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"east": {
|
||||
"uv": [5.5, 1.5, 7, 5.5],
|
||||
"texture": "#bed",
|
||||
"rotation": 90,
|
||||
"cullface": "east"
|
||||
},
|
||||
"north": {
|
||||
"uv": [1.5, 0.0, 5.5, 1.5],
|
||||
"texture": "#bed",
|
||||
"rotation": 180,
|
||||
"cullface": "north"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0.0, 1.5, 1.5, 5.5],
|
||||
"texture": "#bed",
|
||||
"rotation": 270,
|
||||
"cullface": "west"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "left",
|
||||
"from": [0, 0, 0],
|
||||
"to": [3, 3, 3],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [14, 0, 14.75, 0.75],
|
||||
"texture": "#bed",
|
||||
"rotation": 270,
|
||||
"cullface": "down"
|
||||
},
|
||||
"north": {
|
||||
"uv": [12.5, 0.75, 13.25, 1.5],
|
||||
"texture": "#bed",
|
||||
"cullface": "north"
|
||||
},
|
||||
"west": {
|
||||
"uv": [13.25, 0.75, 14, 1.5],
|
||||
"texture": "#bed",
|
||||
"cullface": "west"
|
||||
},
|
||||
"south": {
|
||||
"uv": [14, 0.75, 14.75, 1.5],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"east": {
|
||||
"uv": [14.75, 0.75, 15.5, 1.5],
|
||||
"texture": "#bed"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "right",
|
||||
"from": [13, 0, 0],
|
||||
"to": [16, 3, 3],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [14, 1.5, 14.75, 2.25],
|
||||
"texture": "#bed",
|
||||
"rotation": 180,
|
||||
"cullface": "down"
|
||||
},
|
||||
"north": {
|
||||
"uv": [13.25, 2.25, 14, 3.0],
|
||||
"texture": "#bed",
|
||||
"cullface": "north"
|
||||
},
|
||||
"west": {
|
||||
"uv": [14, 2.25, 14.75, 3.0],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"south": {
|
||||
"uv": [14.75, 2.25, 15.5, 3.0],
|
||||
"texture": "#bed"
|
||||
},
|
||||
"east": {
|
||||
"uv": [12.5, 2.25, 13.25, 3.0],
|
||||
"texture": "#bed",
|
||||
"cullface": "east"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user