Add tile-entities: chests and signs

This commit is contained in:
Blue (Lukas Rieger) 2020-01-26 02:06:19 +01:00
parent 316f2d3293
commit 98fbd3e808
40 changed files with 441 additions and 13 deletions

View File

@ -29,7 +29,6 @@
import com.flowpowered.math.imaginary.Quaternionf;
import com.flowpowered.math.matrix.Matrix3f;
import com.flowpowered.math.vector.Vector2f;
import com.flowpowered.math.vector.Vector2i;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3i;
import com.flowpowered.math.vector.Vector4f;
@ -71,7 +70,7 @@ public BlockStateModel build(TransformedBlockModelResource bmr) {
model.merge(fromModelElementResource(element, bmr));
}
if (!bmr.getRotation().equals(Vector2i.ZERO)) {
if (!bmr.getRotation().equals(Vector2f.ZERO)) {
model.translate(NEG_HALF_3F);
model.rotate(Quaternionf.fromAxesAnglesDeg(
-bmr.getRotation().getX(),
@ -173,7 +172,7 @@ private void createElementFace(BlockStateModel model, TransformedBlockModelResou
//UV-Lock counter-rotation
int uvLockAngle = 0;
Vector2i rotation = modelResource.getRotation();
Vector2f rotation = modelResource.getRotation();
if (modelResource.isUVLock()){
Quaternionf rot = Quaternionf.fromAxesAnglesDeg(rotation.getX(), rotation.getY(), 0);
uvLockAngle = (int) rot.getAxesAnglesDeg().dot(faceDir.toVector().toFloat());
@ -257,16 +256,16 @@ private void createElementFace(BlockStateModel model, TransformedBlockModelResou
}
private Block getRotationRelativeBlock(Vector2i modelRotation, Direction direction){
private Block getRotationRelativeBlock(Vector2f modelRotation, Direction direction){
return getRotationRelativeBlock(modelRotation, direction.toVector());
}
private Block getRotationRelativeBlock(Vector2i modelRotation, Vector3i direction){
private Block getRotationRelativeBlock(Vector2f modelRotation, Vector3i direction){
Vector3i dir = getRotationRelativeDirectionVector(modelRotation, direction.toFloat()).round().toInt();
return block.getRelativeBlock(dir);
}
private Vector3f getRotationRelativeDirectionVector(Vector2i modelRotation, Vector3f direction){
private Vector3f getRotationRelativeDirectionVector(Vector2f modelRotation, Vector3f direction){
Quaternionf rot = Quaternionf.fromAxesAnglesDeg(
-modelRotation.getX(),
-modelRotation.getY(),
@ -276,7 +275,7 @@ private Vector3f getRotationRelativeDirectionVector(Vector2i modelRotation, Vect
return dir;
}
private double testAo(Vector2i modelRotation, Vector3f vertex, Direction dir){
private double testAo(Vector2f modelRotation, Vector3f vertex, Direction dir){
int occluding = 0;
int x = 0;

View File

@ -37,7 +37,7 @@
import org.apache.commons.lang3.StringUtils;
import com.flowpowered.math.vector.Vector2i;
import com.flowpowered.math.vector.Vector2f;
import com.flowpowered.math.vector.Vector3i;
import de.bluecolored.bluemap.core.logger.Logger;
@ -255,7 +255,7 @@ private Weighted<TransformedBlockModelResource> loadModel(ConfigurationNode node
resourcePack.blockModelResources.put(modelPath, model);
}
Vector2i rotation = new Vector2i(node.getNode("x").getInt(0), node.getNode("y").getInt(0));
Vector2f rotation = new Vector2f(node.getNode("x").getFloat(0), node.getNode("y").getFloat(0));
boolean uvLock = node.getNode("uvlock").getBoolean(false);
TransformedBlockModelResource transformedModel = new TransformedBlockModelResource(rotation, uvLock, model);

View File

@ -24,22 +24,22 @@
*/
package de.bluecolored.bluemap.core.resourcepack;
import com.flowpowered.math.vector.Vector2i;
import com.flowpowered.math.vector.Vector2f;
public class TransformedBlockModelResource {
private Vector2i rotation = Vector2i.ZERO;
private Vector2f rotation = Vector2f.ZERO;
private boolean uvLock = false;
private BlockModelResource model;
public TransformedBlockModelResource(Vector2i rotation, boolean uvLock, BlockModelResource model) {
public TransformedBlockModelResource(Vector2f rotation, boolean uvLock, BlockModelResource model) {
this.model = model;
this.rotation = rotation;
this.uvLock = uvLock;
}
public Vector2i getRotation() {
public Vector2f getRotation() {
return rotation;
}

View File

@ -0,0 +1,20 @@
{
"variants": {
"rotation=0": { "model": "block/sign/acacia" },
"rotation=1": { "model": "block/sign/acacia", "y": 22.5 },
"rotation=2": { "model": "block/sign/acacia", "y": 45 },
"rotation=3": { "model": "block/sign/acacia", "y": 67.5 },
"rotation=4": { "model": "block/sign/acacia", "y": 90 },
"rotation=5": { "model": "block/sign/acacia", "y": 112.5 },
"rotation=6": { "model": "block/sign/acacia", "y": 135 },
"rotation=7": { "model": "block/sign/acacia", "y": 157.5 },
"rotation=8": { "model": "block/sign/acacia", "y": 180 },
"rotation=9": { "model": "block/sign/acacia", "y": 202.5 },
"rotation=10": { "model": "block/sign/acacia", "y": 225 },
"rotation=11": { "model": "block/sign/acacia", "y": 247.5 },
"rotation=12": { "model": "block/sign/acacia", "y": 270 },
"rotation=13": { "model": "block/sign/acacia", "y": 292.5 },
"rotation=14": { "model": "block/sign/acacia", "y": 315 },
"rotation=15": { "model": "block/sign/acacia", "y": 337.5 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=south": { "model": "block/sign/wall_acacia" },
"facing=west": { "model": "block/sign/wall_acacia", "y": 90 },
"facing=north": { "model": "block/sign/wall_acacia", "y": 180 },
"facing=east": { "model": "block/sign/wall_acacia", "y": 270 }
}
}

View File

@ -0,0 +1,20 @@
{
"variants": {
"rotation=0": { "model": "block/sign/birch" },
"rotation=1": { "model": "block/sign/birch", "y": 22.5 },
"rotation=2": { "model": "block/sign/birch", "y": 45 },
"rotation=3": { "model": "block/sign/birch", "y": 67.5 },
"rotation=4": { "model": "block/sign/birch", "y": 90 },
"rotation=5": { "model": "block/sign/birch", "y": 112.5 },
"rotation=6": { "model": "block/sign/birch", "y": 135 },
"rotation=7": { "model": "block/sign/birch", "y": 157.5 },
"rotation=8": { "model": "block/sign/birch", "y": 180 },
"rotation=9": { "model": "block/sign/birch", "y": 202.5 },
"rotation=10": { "model": "block/sign/birch", "y": 225 },
"rotation=11": { "model": "block/sign/birch", "y": 247.5 },
"rotation=12": { "model": "block/sign/birch", "y": 270 },
"rotation=13": { "model": "block/sign/birch", "y": 292.5 },
"rotation=14": { "model": "block/sign/birch", "y": 315 },
"rotation=15": { "model": "block/sign/birch", "y": 337.5 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=south": { "model": "block/sign/wall_birch" },
"facing=west": { "model": "block/sign/wall_birch", "y": 90 },
"facing=north": { "model": "block/sign/wall_birch", "y": 180 },
"facing=east": { "model": "block/sign/wall_birch", "y": 270 }
}
}

View File

@ -0,0 +1,13 @@
{
"variants": {
"type=single,facing=north": { "model": "block/chest/normal", "y": 180 },
"type=single,facing=east": { "model": "block/chest/normal", "y": 270 },
"type=single,facing=south": { "model": "block/chest/normal" },
"type=single,facing=west": { "model": "block/chest/normal", "y":90 },
"type=right,facing=north": { "model": "block/chest/normal_double", "y": 180 },
"type=right,facing=east": { "model": "block/chest/normal_double", "y": 270 },
"type=right,facing=south": { "model": "block/chest/normal_double" },
"type=right,facing=west": { "model": "block/chest/normal_double", "y":90 },
"type=left": { "model": "block/chest/left" }
}
}

View File

@ -0,0 +1,20 @@
{
"variants": {
"rotation=0": { "model": "block/sign/dark_oak" },
"rotation=1": { "model": "block/sign/dark_oak", "y": 22.5 },
"rotation=2": { "model": "block/sign/dark_oak", "y": 45 },
"rotation=3": { "model": "block/sign/dark_oak", "y": 67.5 },
"rotation=4": { "model": "block/sign/dark_oak", "y": 90 },
"rotation=5": { "model": "block/sign/dark_oak", "y": 112.5 },
"rotation=6": { "model": "block/sign/dark_oak", "y": 135 },
"rotation=7": { "model": "block/sign/dark_oak", "y": 157.5 },
"rotation=8": { "model": "block/sign/dark_oak", "y": 180 },
"rotation=9": { "model": "block/sign/dark_oak", "y": 202.5 },
"rotation=10": { "model": "block/sign/dark_oak", "y": 225 },
"rotation=11": { "model": "block/sign/dark_oak", "y": 247.5 },
"rotation=12": { "model": "block/sign/dark_oak", "y": 270 },
"rotation=13": { "model": "block/sign/dark_oak", "y": 292.5 },
"rotation=14": { "model": "block/sign/dark_oak", "y": 315 },
"rotation=15": { "model": "block/sign/dark_oak", "y": 337.5 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=south": { "model": "block/sign/wall_dark_oak" },
"facing=west": { "model": "block/sign/wall_dark_oak", "y": 90 },
"facing=north": { "model": "block/sign/wall_dark_oak", "y": 180 },
"facing=east": { "model": "block/sign/wall_dark_oak", "y": 270 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "block/chest/ender", "y": 180 },
"facing=east": { "model": "block/chest/ender", "y": 270 },
"facing=south": { "model": "block/chest/ender" },
"facing=west": { "model": "block/chest/ender", "y":90 }
}
}

View File

@ -0,0 +1,20 @@
{
"variants": {
"rotation=0": { "model": "block/sign/jungle" },
"rotation=1": { "model": "block/sign/jungle", "y": 22.5 },
"rotation=2": { "model": "block/sign/jungle", "y": 45 },
"rotation=3": { "model": "block/sign/jungle", "y": 67.5 },
"rotation=4": { "model": "block/sign/jungle", "y": 90 },
"rotation=5": { "model": "block/sign/jungle", "y": 112.5 },
"rotation=6": { "model": "block/sign/jungle", "y": 135 },
"rotation=7": { "model": "block/sign/jungle", "y": 157.5 },
"rotation=8": { "model": "block/sign/jungle", "y": 180 },
"rotation=9": { "model": "block/sign/jungle", "y": 202.5 },
"rotation=10": { "model": "block/sign/jungle", "y": 225 },
"rotation=11": { "model": "block/sign/jungle", "y": 247.5 },
"rotation=12": { "model": "block/sign/jungle", "y": 270 },
"rotation=13": { "model": "block/sign/jungle", "y": 292.5 },
"rotation=14": { "model": "block/sign/jungle", "y": 315 },
"rotation=15": { "model": "block/sign/jungle", "y": 337.5 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=south": { "model": "block/sign/wall_jungle" },
"facing=west": { "model": "block/sign/wall_jungle", "y": 90 },
"facing=north": { "model": "block/sign/wall_jungle", "y": 180 },
"facing=east": { "model": "block/sign/wall_jungle", "y": 270 }
}
}

View File

@ -0,0 +1,20 @@
{
"variants": {
"rotation=0": { "model": "block/sign/oak" },
"rotation=1": { "model": "block/sign/oak", "y": 22.5 },
"rotation=2": { "model": "block/sign/oak", "y": 45 },
"rotation=3": { "model": "block/sign/oak", "y": 67.5 },
"rotation=4": { "model": "block/sign/oak", "y": 90 },
"rotation=5": { "model": "block/sign/oak", "y": 112.5 },
"rotation=6": { "model": "block/sign/oak", "y": 135 },
"rotation=7": { "model": "block/sign/oak", "y": 157.5 },
"rotation=8": { "model": "block/sign/oak", "y": 180 },
"rotation=9": { "model": "block/sign/oak", "y": 202.5 },
"rotation=10": { "model": "block/sign/oak", "y": 225 },
"rotation=11": { "model": "block/sign/oak", "y": 247.5 },
"rotation=12": { "model": "block/sign/oak", "y": 270 },
"rotation=13": { "model": "block/sign/oak", "y": 292.5 },
"rotation=14": { "model": "block/sign/oak", "y": 315 },
"rotation=15": { "model": "block/sign/oak", "y": 337.5 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=south": { "model": "block/sign/wall_oak" },
"facing=west": { "model": "block/sign/wall_oak", "y": 90 },
"facing=north": { "model": "block/sign/wall_oak", "y": 180 },
"facing=east": { "model": "block/sign/wall_oak", "y": 270 }
}
}

View File

@ -0,0 +1,20 @@
{
"variants": {
"rotation=0": { "model": "block/sign/spruce" },
"rotation=1": { "model": "block/sign/spruce", "y": 22.5 },
"rotation=2": { "model": "block/sign/spruce", "y": 45 },
"rotation=3": { "model": "block/sign/spruce", "y": 67.5 },
"rotation=4": { "model": "block/sign/spruce", "y": 90 },
"rotation=5": { "model": "block/sign/spruce", "y": 112.5 },
"rotation=6": { "model": "block/sign/spruce", "y": 135 },
"rotation=7": { "model": "block/sign/spruce", "y": 157.5 },
"rotation=8": { "model": "block/sign/spruce", "y": 180 },
"rotation=9": { "model": "block/sign/spruce", "y": 202.5 },
"rotation=10": { "model": "block/sign/spruce", "y": 225 },
"rotation=11": { "model": "block/sign/spruce", "y": 247.5 },
"rotation=12": { "model": "block/sign/spruce", "y": 270 },
"rotation=13": { "model": "block/sign/spruce", "y": 292.5 },
"rotation=14": { "model": "block/sign/spruce", "y": 315 },
"rotation=15": { "model": "block/sign/spruce", "y": 337.5 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=south": { "model": "block/sign/wall_spruce" },
"facing=west": { "model": "block/sign/wall_spruce", "y": 90 },
"facing=north": { "model": "block/sign/wall_spruce", "y": 180 },
"facing=east": { "model": "block/sign/wall_spruce", "y": 270 }
}
}

View File

@ -0,0 +1,13 @@
{
"variants": {
"type=single,facing=north": { "model": "block/chest/trapped", "y": 180 },
"type=single,facing=east": { "model": "block/chest/trapped", "y": 270 },
"type=single,facing=south": { "model": "block/chest/trapped" },
"type=single,facing=west": { "model": "block/chest/trapped", "y":90 },
"type=right,facing=north": { "model": "block/chest/trapped_double", "y": 180 },
"type=right,facing=east": { "model": "block/chest/trapped_double", "y": 270 },
"type=right,facing=south": { "model": "block/chest/trapped_double" },
"type=right,facing=west": { "model": "block/chest/trapped_double", "y":90 },
"type=left": { "model": "block/chest/left" }
}
}

View File

@ -0,0 +1,40 @@
{
"elements": [
{
"from": [1, 0, 1],
"to": [15, 10, 15],
"faces": {
"north": {"uv": [10.5, 8.25, 14, 10.75], "texture": "#chest"},
"east": {"uv": [7, 8.25, 10.5, 10.75], "texture": "#chest"},
"south": {"uv": [3.5, 8.25, 7, 10.75], "texture": "#chest"},
"west": {"uv": [0, 8.25, 3.5, 10.75], "texture": "#chest"},
"up": {"uv": [3.5, 4.75, 7, 8.25], "texture": "#chest"},
"down": {"uv": [7, 4.75, 10.5, 8.25], "texture": "#chest"}
}
},
{
"from": [1, 9, 1],
"to": [15, 14, 15],
"faces": {
"north": {"uv": [10.5, 3.5, 14, 4.75], "texture": "#chest"},
"east": {"uv": [7, 3.5, 10.5, 4.75], "texture": "#chest"},
"south": {"uv": [3.5, 3.5, 7, 4.75], "texture": "#chest"},
"west": {"uv": [0, 3.5, 3.5, 4.75], "texture": "#chest"},
"up": {"uv": [3.5, 0, 7, 3.5], "texture": "#chest"},
"down": {"uv": [7, 0, 10.5, 3.5], "texture": "#chest"}
}
},
{
"from": [7, 7, 15],
"to": [9, 11, 16],
"faces": {
"north": {"uv": [0.25, 0.25, 0.75, 1.25], "texture": "#chest"},
"east": {"uv": [0, 0.25, 0.25, 1.25], "texture": "#chest"},
"south": {"uv": [1, 0.25, 1.5, 1.25], "texture": "#chest"},
"west": {"uv": [0.75, 0.25, 1, 1.25], "texture": "#chest"},
"up": {"uv": [0.25, 0, 0.75, 0.25], "texture": "#chest"},
"down": {"uv": [0.75, 0, 1.25, 0.25], "texture": "#chest"}
}
}
]
}

View File

@ -0,0 +1,40 @@
{
"elements": [
{
"from": [1, 0, 1],
"to": [31, 10, 15],
"faces": {
"north": {"uv": [7.25, 8.25, 11, 10.75], "texture": "#chest"},
"east": {"uv": [5.5, 8.25, 7.25, 10.75], "texture": "#chest"},
"south": {"uv": [1.75, 8.25, 5.5, 10.75], "texture": "#chest"},
"west": {"uv": [0, 8.25, 1.75, 10.75], "texture": "#chest"},
"up": {"uv": [1.75, 4.75, 5.5, 8.25], "texture": "#chest"},
"down": {"uv": [5.5, 4.75, 9.25, 8.25], "texture": "#chest"}
}
},
{
"from": [1, 9, 1],
"to": [31, 14, 15],
"faces": {
"north": {"uv": [7.25, 3.5, 11, 4.75], "texture": "#chest"},
"east": {"uv": [5.5, 3.5, 7.25, 4.75], "texture": "#chest"},
"south": {"uv": [1.75, 3.5, 5.5, 4.75], "texture": "#chest"},
"west": {"uv": [0, 3.5, 1.75, 4.75], "texture": "#chest"},
"up": {"uv": [1.75, 0, 5.5, 3.5], "texture": "#chest"},
"down": {"uv": [5.5, 0, 9.25, 3.5], "texture": "#chest"}
}
},
{
"from": [15, 7, 15],
"to": [17, 11, 16],
"faces": {
"north": {"uv": [0.5, 0.25, 0.75, 1.25], "texture": "#chest"},
"east": {"uv": [0.375, 0.25, 0.5, 1.25], "texture": "#chest"},
"south": {"uv": [0.125, 0.25, 0.375, 1.25], "texture": "#chest"},
"west": {"uv": [0, 0.25, 0.125, 1.25], "texture": "#chest"},
"up": {"uv": [0.125, 0, 0.375, 0.25], "texture": "#chest"},
"down": {"uv": [0.375, 0, 0.625, 0.25], "texture": "#chest"}
}
}
]
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/chest/chest",
"textures": {
"chest": "entity/chest/ender"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/chest/chest",
"textures": {
"chest": "entity/chest/normal"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/chest/chest_double",
"textures": {
"chest": "entity/chest/normal_double"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/chest/chest",
"textures": {
"chest": "entity/chest/trapped"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/chest/chest_double",
"textures": {
"chest": "entity/chest/trapped_double"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/sign",
"textures": {
"sign": "entity/signs/acacia"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/sign",
"textures": {
"sign": "entity/signs/birch"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/sign",
"textures": {
"sign": "entity/signs/dark_oak"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/sign",
"textures": {
"sign": "entity/signs/jungle"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/sign",
"textures": {
"sign": "entity/signs/oak"
}
}

View File

@ -0,0 +1,28 @@
{
"elements": [
{
"from": [7.25, 0, 7.25],
"to": [8.75, 9.333, 8.75],
"faces": {
"north": {"uv": [1.5, 8, 2, 15], "texture": "#sign"},
"east": {"uv": [1, 8, 1.5, 15], "texture": "#sign"},
"south": {"uv": [0.5, 8, 1, 15], "texture": "#sign"},
"west": {"uv": [0, 8, 0.5, 15], "texture": "#sign"},
"up": {"uv": [0.5, 7, 1, 8], "texture": "#sign"},
"down": {"uv": [1, 7, 1.5, 8], "texture": "#sign"}
}
},
{
"from": [0, 9.333, 7.25],
"to": [16, 17.333, 8.75],
"faces": {
"north": {"uv": [7, 1, 13, 7], "texture": "#sign"},
"east": {"uv": [6.5, 1, 7, 7], "texture": "#sign"},
"south": {"uv": [0.5, 1, 6.5, 7], "texture": "#sign"},
"west": {"uv": [0, 1, 0.5, 7], "texture": "#sign"},
"up": {"uv": [0.5, 0, 6.5, 1], "texture": "#sign"},
"down": {"uv": [6.5, 1, 12.5, 0], "texture": "#sign"}
}
}
]
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/sign",
"textures": {
"sign": "entity/signs/spruce"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/wall_sign",
"textures": {
"sign": "entity/signs/acacia"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/wall_sign",
"textures": {
"sign": "entity/signs/birch"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/wall_sign",
"textures": {
"sign": "entity/signs/dark_oak"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/wall_sign",
"textures": {
"sign": "entity/signs/jungle"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/wall_sign",
"textures": {
"sign": "entity/signs/oak"
}
}

View File

@ -0,0 +1,16 @@
{
"elements": [
{
"from": [0, 4.333, 0.25],
"to": [16, 12.333, 1.75],
"faces": {
"north": {"uv": [7, 1, 13, 7], "texture": "#sign"},
"east": {"uv": [6.5, 1, 7, 7], "texture": "#sign"},
"south": {"uv": [0.5, 1, 6.5, 7], "texture": "#sign"},
"west": {"uv": [0, 1, 0.5, 7], "texture": "#sign"},
"up": {"uv": [0.5, 0, 6.5, 1], "texture": "#sign"},
"down": {"uv": [6.5, 1, 12.5, 0], "texture": "#sign"}
}
}
]
}

View File

@ -0,0 +1,6 @@
{
"parent":"block/sign/wall_sign",
"textures": {
"sign": "entity/signs/spruce"
}
}