From 459b3249a43ccf2b153ee6519bad8d2e12abc963 Mon Sep 17 00:00:00 2001 From: tkrmagid Date: Fri, 15 May 2026 20:21:19 +0900 Subject: [PATCH] fix(render): anchor video to clicked block's bottom-left, EAST/WEST flush MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three fixes for v0.4.1: 1. Video stick item rendered as missing-texture because 26.1.2 requires the new client_item descriptor at assets//items/.json. Add it; the existing models/item/video_stick.json is kept as the underlying model. 2. Quad placement now anchors the local (0,0) corner at the bottom-left of the wall face the player clicked, so the clicked block is the BL and the video grows up & right. Previously it was centered on the anchor. 3. EAST/WEST face rotations were swapped, which placed the quad on the far side of the air block (~1 block away from the wall) instead of flush. Derived the correct rotations from first principles: EAST = Axis.YP +90° (local +Z → world +X, +X → -Z = north) WEST = Axis.YP -90° (local +Z → world -X, +X → +Z = south) NORTH/SOUTH/UP/DOWN math re-verified — those were already correct. --- gradle.properties | 2 +- .../client/render/VideoAnchorRenderer.java | 28 ++++++++++++------- .../video_player/items/video_stick.json | 6 ++++ 3 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 src/main/resources/assets/video_player/items/video_stick.json diff --git a/gradle.properties b/gradle.properties index 74749fc..2761ae0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.configuration-cache=false # Mod mod_id=video_player -mod_version=0.4.0 +mod_version=0.4.1 maven_group=com.ejclaw.videoplayer archives_base_name=video_player diff --git a/src/main/java/com/ejclaw/videoplayer/client/render/VideoAnchorRenderer.java b/src/main/java/com/ejclaw/videoplayer/client/render/VideoAnchorRenderer.java index ab075ea..dbb582b 100644 --- a/src/main/java/com/ejclaw/videoplayer/client/render/VideoAnchorRenderer.java +++ b/src/main/java/com/ejclaw/videoplayer/client/render/VideoAnchorRenderer.java @@ -67,9 +67,11 @@ public class VideoAnchorRenderer implements BlockEntityRenderer { /* identity: local +Z already faces world +Z (south) */ } - case NORTH -> pose.mulPose(Axis.YP.rotationDegrees(180F)); - case EAST -> pose.mulPose(Axis.YP.rotationDegrees(-90F)); - case WEST -> pose.mulPose(Axis.YP.rotationDegrees(90F)); - case UP -> pose.mulPose(Axis.XP.rotationDegrees(-90F)); - case DOWN -> pose.mulPose(Axis.XP.rotationDegrees(90F)); + case SOUTH -> { /* identity: local +Z = world +Z (south). +X = east, +Y = up. */ } + case NORTH -> pose.mulPose(Axis.YP.rotationDegrees(180F)); // +Z → -Z, +X → -X (west) + case EAST -> pose.mulPose(Axis.YP.rotationDegrees(90F)); // +Z → +X, +X → -Z (north) + case WEST -> pose.mulPose(Axis.YP.rotationDegrees(-90F)); // +Z → -X, +X → +Z (south) + case UP -> pose.mulPose(Axis.XP.rotationDegrees(-90F)); // +Z → +Y, +Y → -Z (north) + case DOWN -> pose.mulPose(Axis.XP.rotationDegrees(90F)); // +Z → -Y, +Y → +Z (south) } } diff --git a/src/main/resources/assets/video_player/items/video_stick.json b/src/main/resources/assets/video_player/items/video_stick.json new file mode 100644 index 0000000..c5c4ad9 --- /dev/null +++ b/src/main/resources/assets/video_player/items/video_stick.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "video_player:item/video_stick" + } +}