Fixed in-world rendering of keyboard and some rotation getter logic (block breaking is threaded now? ohgodsomuchwillbreak).

This commit is contained in:
Florian Nücke 2014-12-28 22:45:22 +01:00
parent 5e02e60265
commit bf76fc8368
5 changed files with 34 additions and 22 deletions

View File

@ -1,16 +1,16 @@
{
"variants": {
"pitch=north,yaw=north": { "model": "opencomputers:keyboard" },
"pitch=north,yaw=east": { "model": "opencomputers:keyboard", "y": 90 },
"pitch=north,yaw=south": { "model": "opencomputers:keyboard", "y": 180 },
"pitch=north,yaw=east": { "model": "opencomputers:keyboard", "y": 270 },
"pitch=north,yaw=west": { "model": "opencomputers:keyboard", "y": 90 },
"pitch=up,yaw=north": { "model": "opencomputers:keyboard", "x": 90 },
"pitch=up,yaw=south": { "model": "opencomputers:keyboard", "x": 90, "y": 180 },
"pitch=up,yaw=east": { "model": "opencomputers:keyboard", "x": 90, "y": 270 },
"pitch=up,yaw=west": { "model": "opencomputers:keyboard", "x": 90, "y": 90 },
"pitch=down,yaw=north": { "model": "opencomputers:keyboard", "x": -90 },
"pitch=down,yaw=south": { "model": "opencomputers:keyboard", "x": -90, "y": 180 },
"pitch=down,yaw=east": { "model": "opencomputers:keyboard", "x": -90, "y": 270 },
"pitch=down,yaw=west": { "model": "opencomputers:keyboard", "x": -90, "y": 90 }
"pitch=north,yaw=west": { "model": "opencomputers:keyboard", "y": 270 },
"pitch=up,yaw=north": { "model": "opencomputers:keyboard", "x": -90, "y": 180 },
"pitch=up,yaw=east": { "model": "opencomputers:keyboard", "x": -90, "y": 270 },
"pitch=up,yaw=south": { "model": "opencomputers:keyboard", "x": -90 },
"pitch=up,yaw=west": { "model": "opencomputers:keyboard", "x": -90, "y": 90 },
"pitch=down,yaw=north": { "model": "opencomputers:keyboard", "x": 90, "y": 180 },
"pitch=down,yaw=east": { "model": "opencomputers:keyboard", "x": 90, "y": 270 },
"pitch=down,yaw=south": { "model": "opencomputers:keyboard", "x": 90 },
"pitch=down,yaw=west": { "model": "opencomputers:keyboard", "x": 90, "y": 90 }
}
}

View File

@ -3,15 +3,15 @@
"all": "opencomputers:blocks/keyboard"
},
"elements": [
{ "from": [ 1, 0, 4 ],
"to": [ 15, 1, 12 ],
{ "from": [ 1, 4, 15 ],
"to": [ 15, 12, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" }
"down": { "uv": [ 1, 15, 15, 16 ], "texture": "#all" },
"up": { "uv": [ 1, 15, 15, 16 ], "texture": "#all" },
"north": { "uv": [ 1, 4, 15, 12 ], "texture": "#all" },
"south": { "uv": [ 1, 4, 15, 12 ], "texture": "#all" },
"west": { "uv": [ 15, 4, 16, 12 ], "texture": "#all" },
"east": { "uv": [ 15, 4, 16, 12 ], "texture": "#all" }
}
}
]

View File

@ -2,7 +2,7 @@
"parent": "opencomputers:block/keyboard",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"rotation": [ 10, 135, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}

View File

@ -14,9 +14,17 @@ import scala.collection.mutable
// Provides 2-axis rotation for blocks (pitch and yaw) using metadata to store the rotation.
trait OmniRotatable extends Block with Extended {
def getPitch(state: IBlockState) = state.getValue(OmniRotatable.Pitch).asInstanceOf[EnumFacing]
def getPitch(state: IBlockState) =
if (state.getBlock == this)
state.getValue(OmniRotatable.Pitch).asInstanceOf[EnumFacing]
else
EnumFacing.NORTH
def getYaw(state: IBlockState) = state.getValue(OmniRotatable.Yaw).asInstanceOf[EnumFacing]
def getYaw(state: IBlockState) =
if (state.getBlock == this)
state.getValue(OmniRotatable.Yaw).asInstanceOf[EnumFacing]
else
EnumFacing.SOUTH
def withPitchAndYaw(state: IBlockState, pitch: EnumFacing, yaw: EnumFacing) = state.
withProperty(OmniRotatable.Pitch, pitch).

View File

@ -12,7 +12,11 @@ import scala.collection.mutable
// Provides 4-way rotation for blocks using metadata to store the rotation.
trait Rotatable extends Block with Extended {
def getFacing(state: IBlockState) = state.getValue(Rotatable.Facing).asInstanceOf[EnumFacing]
def getFacing(state: IBlockState) =
if (state.getBlock == this)
state.getValue(Rotatable.Facing).asInstanceOf[EnumFacing]
else
EnumFacing.SOUTH
def withFacing(state: IBlockState, facing: EnumFacing) = state.
withProperty(Rotatable.Facing, facing)