fix blockstate y-rotation direction and rotate top/bottom UVs without uvlock

Blockstate "y" rotations turned the geometry counter-clockwise while the
faces were re-assigned clockwise (vanilla). Every east/west variant of an
asymmetric block ended up mirrored on the wrong side of its cell: shelf
mushrooms and ladders floated away from their support, stairs faced
backwards. Rotate clockwise like vanilla, adjust element-rotation axes,
and turn up/down face textures with the model unless uvlock is set.

Edge-case test plugin: shelf mushroom (side + top view) and rotated-block
scenes.
This commit is contained in:
MineTec committed 2026-11-04 13:20:40 +01:00
1 parent 32afe08f03
commit a99acad80c
2 files changed
+55 -5

No files matched your search

+36
View File
@@ -46,6 +46,9 @@ public class PPTest extends JavaPlugin {
scenes.put("pixelblock", new Scene("pixelblock", this::pixelblock, 1.5, 1.9, -1.3, 0.5, 0.5, 0.5));
scenes.put("misc", new Scene("misc", this::misc, 5, 3, -7, 5, 0.8, 1.5));
scenes.put("dbg", new Scene("dbg", this::dbg, 1, 1.6, -3, 1, 0.8, 0.5));
scenes.put("shelf", new Scene("shelf", this::shelf, 3.5, 3.2, -2.5, 0.5, 1.5, 0.5));
scenes.put("shelftop", new Scene("shelftop", this::shelf, 0.52, 6, 0.5, 0.5, 0, 0.5));
scenes.put("rotated", new Scene("rotated", this::rotated, 3, 4.5, -4, 3, 0.5, 2));
scenes.put("vehicles", new Scene("vehicles", this::vehicles, 5, 3, -7, 5, 0.6, 1.5));
}
@@ -380,6 +383,39 @@ public class PPTest extends JavaPlugin {
getLogger().info("dbg text=" + t1.isValid() + " opacity=" + t1.getTextOpacity() + " shield=" + i4.getItemStack());
}
/** World blocks: a log column with shelf mushrooms (26.x) on all four sides, both growth stages. */
private void shelf(Location o) {
for (int y = 0; y < 3; y++) o.clone().add(0, y, 0).getBlock().setType(Material.OAK_LOG, false);
o.clone().add(0, 0, -3).getBlock().setType(Material.DIAMOND_BLOCK, false); // north marker
o.clone().add(3, 0, 0).getBlock().setType(Material.GOLD_BLOCK, false); // east marker
String[] f = {"north", "south", "east", "west"};
int[][] off = {{0, -1}, {0, 1}, {1, 0}, {-1, 0}};
for (int i = 0; i < 4; i++) {
for (int age = 0; age < 2; age++) {
o.clone().add(off[i][0], 1 + age, off[i][1]).getBlock().setBlockData(
Bukkit.createBlockData("minecraft:shelf_mushroom[age=" + age + ",facing=" + f[i] + "]"), false);
}
}
}
/** Blockstate y-rotations: ladders, stairs, wall torches, furnaces, logs on all sides of stone pillars. */
private void rotated(Location o) {
String[] f = {"north", "south", "east", "west"};
int[][] off = {{0, -1}, {0, 1}, {1, 0}, {-1, 0}};
String[] kinds = {"ladder[facing=%s]", "wall_torch[facing=%s]", "oak_stairs[facing=%s]", "furnace[facing=%s]"};
for (int k = 0; k < kinds.length; k++) {
Location c = o.clone().add(k * 3 - 1, 0, 2);
c.getBlock().setType(Material.STONE, false);
c.clone().add(0, 1, 0).getBlock().setType(Material.STONE, false);
for (int i = 0; i < 4; i++) {
c.clone().add(off[i][0], k == 2 || k == 3 ? 0 : 1, off[i][1]).getBlock().setBlockData(
Bukkit.createBlockData("minecraft:" + String.format(kinds[k], f[i])), false);
}
}
o.clone().add(9, 0, 2).getBlock().setBlockData(Bukkit.createBlockData("minecraft:oak_log[axis=x]"), false);
o.clone().add(9, 0, 4).getBlock().setBlockData(Bukkit.createBlockData("minecraft:oak_log[axis=z]"), false);
}
private void vehicles(Location o) {
spawn(o, 0, 0, 0, 0, EntityType.CHEST_MINECART);
spawn(o, 1.8, 0, 0, 90, EntityType.FURNACE_MINECART);