bind block textures to the model under blockstate rotations (vanilla UVs)

- face UV orientation now follows vanilla BlockElement.uvsByFace: north/
  east/down faces were sampled mirrored. Default UVs adjusted to match.
  Block and entity faces share one mapping (ElementIntersector.faceUv),
  so the separate blockUv mode of the entity intersector is gone.
- x/y blockstate rotations without uvlock: elements keep their model-space
  copy and are intersected with the inverse-rotated ray, so textures turn
  with the model exactly like vanilla (pistons facing down showed their
  side textures in different directions per face). Replaces the earlier
  up/down-only UV rotation. Display entities use the same model-space path.

Edge-case test plugin: piston/observer/dispenser scenes.
This commit is contained in:
MineTec committed 2026-11-04 13:36:15 +01:00
1 parent 73e521131b
commit 37fa1d8f56
8 files changed
+139 -95

No files matched your search

+20
View File
@@ -51,6 +51,10 @@ public class PPTest extends JavaPlugin {
scenes.put("rotated", new Scene("rotated", this::rotated, 3, 4.5, -4, 3, 0.5, 2));
scenes.put("rotated2", new Scene("rotated2", this::rotated, -0.5, 3.5, 9.5, -0.5, 0.5, 5));
scenes.put("redstone", new Scene("redstone", this::redstone, 3, 3, -3, 3, 0, 2));
scenes.put("piston", new Scene("piston", this::piston, 4.5, 3.2, -3.5, 5, 1, 1));
scenes.put("pistonback", new Scene("pistonback", this::piston, 5.5, 3.2, 5.5, 5, 1, 1));
scenes.put("pistondown", new Scene("pistondown", this::piston, -1.6, 2.6, -1.6, 0.5, 1.4, 0.5));
scenes.put("pistonup", new Scene("pistonup", this::piston, 0.4, 2.6, -1.6, 2.5, 1.4, 0.5));
scenes.put("vehicles", new Scene("vehicles", this::vehicles, 5, 3, -7, 5, 0.6, 1.5));
}
@@ -442,6 +446,22 @@ public class PPTest extends JavaPlugin {
put.accept(new int[] {4, 0, 3}, "blue_stained_glass_pane[west=true,north=true]");
}
/** x/y blockstate rotations without uvlock: pistons in all six directions, observers, dispensers, logs. */
private void piston(Location o) {
String[] f = {"down", "up", "north", "south", "east", "west"};
for (int i = 0; i < f.length; i++) {
o.clone().add(i * 2, 1, 0).getBlock().setBlockData(
Bukkit.createBlockData("minecraft:piston[facing=" + f[i] + ",extended=false]"), false);
o.clone().add(i * 2, 1, 2).getBlock().setBlockData(
Bukkit.createBlockData("minecraft:observer[facing=" + f[i] + "]"), false);
o.clone().add(i * 2, 0, 2).getBlock().setBlockData(
Bukkit.createBlockData("minecraft:dispenser[facing=" + f[i] + "]"), false);
}
o.clone().add(0, 0, -2).getBlock().setBlockData(Bukkit.createBlockData("minecraft:oak_log[axis=x]"), false);
o.clone().add(2, 0, -2).getBlock().setBlockData(Bukkit.createBlockData("minecraft:oak_log[axis=z]"), false);
o.clone().add(4, 0, -2).getBlock().setBlockData(Bukkit.createBlockData("minecraft:furnace[facing=north]"), 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);