From b4029d1bdf72d7a6168713eae437532809af36d5 Mon Sep 17 00:00:00 2001 From: David Allemang Date: Sat, 4 Jul 2026 09:38:00 -0400 Subject: [PATCH] fix east/west facings directions --- geometry.js | 4 ++-- index.html | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/geometry.js b/geometry.js index bea5b105..a6f9af77 100644 --- a/geometry.js +++ b/geometry.js @@ -51,8 +51,8 @@ export function buildGeometry(model, atlas, variant = {}) { // 1. Pre-calculate the blockstate rotation matrix (around block center) const blockMatrix = mat4Identity(new Float32Array(16)); mat4Translate(blockMatrix, blockMatrix, [0.5, 0.5, 0.5]); - if (variant.x) mat4RotateX(blockMatrix, blockMatrix, variant.x * Math.PI / 180); - if (variant.y) mat4RotateY(blockMatrix, blockMatrix, variant.y * 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); mat4Translate(blockMatrix, blockMatrix, [-0.5, -0.5, -0.5]); for (const el of model.elements || []) { diff --git a/index.html b/index.html index 1b821606..8d6e44fb 100644 --- a/index.html +++ b/index.html @@ -58,30 +58,30 @@ half: 'bottom' }); - world.setBlock('minecraft:coal_block', 0, -1, -3); // north - world.setBlock('minecraft:gold_block', 0, -1, 3); // south - world.setBlock('minecraft:diamond_block', 3, -1, 0); // east - world.setBlock('minecraft:iron_block', -3, -1, 0); // west + world.setBlock('minecraft:coal_block', 0, -1, -3); // north -z + world.setBlock('minecraft:diamond_block', 3, -1, 0); // east +x + world.setBlock('minecraft:gold_block', 0, -1, 3); // south +z + world.setBlock('minecraft:iron_block', -3, -1, 0); // west -x // NOTE the trapdoor should open AWAY from the diamond block - // the repeaters should face "inward" - // the pistons should face "outward" + // the repeaters should point "inward" + // the pistons should extend "outward" // world.setBlock('minecraft:glass', 1, 0, 0); // world.setBlock('minecraft:glass', 0, 0, 1); 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: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', 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', -3, 1, 0, {facing: "east", delay: 1, 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: 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: "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);