fix east/west facings directions

This commit is contained in:
David Allemang
2026-07-04 09:38:00 -04:00
parent 76f3c62ebf
commit b4029d1bdf
2 changed files with 15 additions and 15 deletions

View File

@@ -51,8 +51,8 @@ export function buildGeometry(model, atlas, variant = {}) {
// 1. Pre-calculate the blockstate rotation matrix (around block center) // 1. Pre-calculate the blockstate rotation matrix (around block center)
const blockMatrix = mat4Identity(new Float32Array(16)); const blockMatrix = mat4Identity(new Float32Array(16));
mat4Translate(blockMatrix, blockMatrix, [0.5, 0.5, 0.5]); mat4Translate(blockMatrix, blockMatrix, [0.5, 0.5, 0.5]);
if (variant.x) mat4RotateX(blockMatrix, blockMatrix, variant.x * Math.PI / 180); if (variant.x) mat4RotateX(blockMatrix, blockMatrix, -variant.x * Math.PI / 180);
if (variant.y) mat4RotateY(blockMatrix, blockMatrix, variant.y * Math.PI / 180); if (variant.y) mat4RotateY(blockMatrix, blockMatrix, -variant.y * Math.PI / 180);
mat4Translate(blockMatrix, blockMatrix, [-0.5, -0.5, -0.5]); mat4Translate(blockMatrix, blockMatrix, [-0.5, -0.5, -0.5]);
for (const el of model.elements || []) { for (const el of model.elements || []) {

View File

@@ -58,30 +58,30 @@
half: 'bottom' half: 'bottom'
}); });
world.setBlock('minecraft:coal_block', 0, -1, -3); // north world.setBlock('minecraft:coal_block', 0, -1, -3); // north -z
world.setBlock('minecraft:gold_block', 0, -1, 3); // south world.setBlock('minecraft:diamond_block', 3, -1, 0); // east +x
world.setBlock('minecraft:diamond_block', 3, -1, 0); // east world.setBlock('minecraft:gold_block', 0, -1, 3); // south +z
world.setBlock('minecraft:iron_block', -3, -1, 0); // west world.setBlock('minecraft:iron_block', -3, -1, 0); // west -x
// NOTE the trapdoor should open AWAY from the diamond block // NOTE the trapdoor should open AWAY from the diamond block
// the repeaters should face "inward" // the repeaters should point "inward"
// the pistons should face "outward" // the pistons should extend "outward"
// world.setBlock('minecraft:glass', 1, 0, 0); // world.setBlock('minecraft:glass', 1, 0, 0);
// world.setBlock('minecraft:glass', 0, 0, 1); // world.setBlock('minecraft:glass', 0, 0, 1);
world.setBlock('minecraft:coal_block', 0, -1, 0); world.setBlock('minecraft:coal_block', 0, -1, 0);
world.setBlock('minecraft:repeater', 1, -1, 0, {facing: 'east', delay: 1, locked: false, powered: false}); world.setBlock('minecraft:repeater', 1, -1, 0, {facing: 'west', delay: 1, locked: false, powered: false});
world.setBlock('minecraft:comparator', 0, -1, 1, {facing: 'north', mode: 'compare', powered: false}); world.setBlock('minecraft:comparator', 0, -1, 1, {facing: 'north', mode: 'compare', powered: false});
world.setBlock('minecraft:piston', 3, 0, 0, {facing: "west", extended: false})
world.setBlock('minecraft:piston', -3, 0, 0, {facing: "east", extended: false})
world.setBlock('minecraft:piston', 0, 0, 3, {facing: "south", extended: false})
world.setBlock('minecraft:piston', 0, 0, -3, {facing: "north", extended: false}) world.setBlock('minecraft:piston', 0, 0, -3, {facing: "north", extended: false})
world.setBlock('minecraft:piston', 3, 0, 0, {facing: "east", extended: false})
world.setBlock('minecraft:piston', 0, 0, 3, {facing: "south", extended: false})
world.setBlock('minecraft:piston', -3, 0, 0, {facing: "west", extended: false})
world.setBlock('minecraft:repeater', 3, 1, 0, {facing: "west", delay: 2, locked: true, powered: false}) world.setBlock('minecraft:repeater', 0, 1, -3, {facing: "north", delay: 1, locked: true, powered: false})
world.setBlock('minecraft:repeater', -3, 1, 0, {facing: "east", delay: 1, locked: true, powered: false}) world.setBlock('minecraft:repeater', 3, 1, 0, {facing: "east", delay: 2, locked: true, powered: false})
world.setBlock('minecraft:repeater', 0, 1, 3, {facing: "south", delay: 3, locked: true, powered: false}) world.setBlock('minecraft:repeater', 0, 1, 3, {facing: "south", delay: 3, locked: true, powered: false})
world.setBlock('minecraft:repeater', 0, 1, -3, {facing: "north", delay: 4, locked: true, powered: false}) world.setBlock('minecraft:repeater', -3, 1, 0, {facing: "west", delay: 4, locked: true, powered: false})
await renderer.updateWorld(world); await renderer.updateWorld(world);