render all block entities from the dumped vanilla models with decompiled renderer poses, drop the cem block-entity path
This commit is contained in:
1 parent
c66ebaa942
commit
022b080fce
14 files changed
+659
-567
No files matched your search
@@ -91,6 +91,31 @@ public class PPTest extends JavaPlugin {
|
||||
scenes.put("layers_top", new Scene("layers_top", this::layers, 5.5, 6, 2.0, 5.5, 0, 2.5));
|
||||
scenes.put("layers_wither", new Scene("layers_wither", this::withers, 3.5, 4, -9, 3.5, 2.2, 1));
|
||||
scenes.put("layers_wither_close", new Scene("layers_wither_close", this::withers, 6, 3.4, -3.5, 6, 2.6, 1));
|
||||
// Block entities (vanilla BlockEntityRenderer poses): signs, banners, heads in all 16 rotations + wall
|
||||
// mounts, and bells/pots/shulker boxes/lecterns/conduits, each layout seen from two sides.
|
||||
scenes.put("be_signs_s", new Scene("be_signs_s", this::beSigns, 7, 3, 8, 7, 0.5, 1));
|
||||
scenes.put("be_signs_n", new Scene("be_signs_n", this::beSigns, 7, 1.3, -8, 7, 0.6, 1));
|
||||
scenes.put("be_signs_close", new Scene("be_signs_close", this::beSigns, 3, 1.8, 4.2, 3, 0.8, 2));
|
||||
scenes.put("be_signs_wall", new Scene("be_signs_wall", this::beSigns, 4.6, 2.2, 10.2, 3.5, 0.9, 7));
|
||||
scenes.put("be_signs_wall_n", new Scene("be_signs_wall_n", this::beSigns, 1.4, 2.2, 3.8, 3.5, 0.9, 7));
|
||||
scenes.put("be_signs_wall2", new Scene("be_signs_wall2", this::beSigns, 12.5, 2.4, 10.2, 10, 1.2, 7));
|
||||
scenes.put("be_signs_hang", new Scene("be_signs_hang", this::beSigns, 4, 1.3, 0.2, 4, 1.4, -3));
|
||||
scenes.put("be_banners_s", new Scene("be_banners_s", this::beBanners, 7, 3, 10, 7, 1, 1.5));
|
||||
scenes.put("be_banners_n", new Scene("be_banners_n", this::beBanners, 7, 3, -6, 7, 1, 1.5));
|
||||
scenes.put("be_banners_wall", new Scene("be_banners_wall", this::beBanners, 13, 3.5, 9, 16, 1.5, 5));
|
||||
scenes.put("be_banners_wall_n", new Scene("be_banners_wall_n", this::beBanners, 13, 3.5, 1, 16, 1.5, 5));
|
||||
scenes.put("be_heads_s", new Scene("be_heads_s", this::beHeads, 5, 5, 11, 5, 0, 3));
|
||||
scenes.put("be_heads_n", new Scene("be_heads_n", this::beHeads, 5, 5, -6, 5, 0, 3));
|
||||
scenes.put("be_heads_close", new Scene("be_heads_close", this::beHeads, 4, 2.2, 9.5, 4, 0.3, 5));
|
||||
scenes.put("be_heads_wall_w", new Scene("be_heads_wall_w", this::beHeads, 7, 3, 2.5, 12, 1, 2.5));
|
||||
scenes.put("be_heads_wall_e", new Scene("be_heads_wall_e", this::beHeads, 17, 3, 2.5, 12, 1, 2.5));
|
||||
scenes.put("be_misc_s", new Scene("be_misc_s", this::beMisc, 6, 5, 11, 6, 0.5, 3));
|
||||
scenes.put("be_misc_n", new Scene("be_misc_n", this::beMisc, 6, 5, -6, 6, 0.5, 3));
|
||||
scenes.put("be_misc_close", new Scene("be_misc_close", this::beMisc, 3, 2.5, 3, 3, 0.5, 0));
|
||||
scenes.put("be_misc_lectern", new Scene("be_misc_lectern", this::beMisc, 3, 2.2, 9.5, 3, 0.6, 6));
|
||||
scenes.put("be_misc_shulker", new Scene("be_misc_shulker", this::beMisc, 11, 2.8, 9.5, 11, 0.3, 4));
|
||||
scenes.put("be_items", new Scene("be_items", this::beItems, 4.5, 2.6, 11, 4.5, 0.8, 3));
|
||||
scenes.put("be_items_back", new Scene("be_items_back", this::beItems, 4.5, 2.6, -5, 4.5, 0.8, 3));
|
||||
scenes.put("proj_stuck_sw", new Scene("proj_stuck_sw", this::projStuck, -3, 6, 10, 8, 1.5, 2));
|
||||
}
|
||||
|
||||
@@ -741,4 +766,122 @@ public class PPTest extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- block-entity scenes ------------------------------------------------------------------------
|
||||
|
||||
private void put(Location o, int x, int y, int z, String data) {
|
||||
o.clone().add(x, y, z).getBlock().setBlockData(Bukkit.createBlockData("minecraft:" + data), false);
|
||||
}
|
||||
|
||||
private void signText(Location o, int x, int y, int z, String front, String back) {
|
||||
if (!(o.clone().add(x, y, z).getBlock().getState() instanceof org.bukkit.block.Sign sg)) return;
|
||||
sg.getSide(org.bukkit.block.sign.Side.FRONT).setLine(1, front);
|
||||
sg.getSide(org.bukkit.block.sign.Side.BACK).setLine(1, back);
|
||||
sg.getSide(org.bukkit.block.sign.Side.BACK).setColor(DyeColor.BLUE);
|
||||
sg.update(true, false);
|
||||
}
|
||||
|
||||
private static final String[] DIRS = {"north", "east", "south", "west"};
|
||||
private static final int[][] STEP = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
|
||||
|
||||
/** A stone pillar with one wall-mounted block on each of its four sides ({@code %s} = facing). */
|
||||
private void pillar(Location o, int x, int z, int y, String fmt) {
|
||||
put(o, x, y, z, "stone");
|
||||
for (int i = 0; i < 4; i++) put(o, x + STEP[i][0], y, z + STEP[i][1], String.format(fmt, DIRS[i]));
|
||||
}
|
||||
|
||||
/** Standing signs rot 0..15 (two rows), ceiling hanging signs rot 0..15, wall + wall-hanging signs. */
|
||||
private void beSigns(Location o) {
|
||||
for (int r = 0; r < 16; r++) {
|
||||
int x = (r % 8) * 2, z = r < 8 ? 0 : 2;
|
||||
put(o, x, 0, z, "oak_sign[rotation=" + r + "]");
|
||||
signText(o, x, 0, z, "F" + r, "B" + r);
|
||||
put(o, r, 2, -3, "stone");
|
||||
put(o, r, 1, -3, "spruce_hanging_sign[rotation=" + r + ",attached=true]");
|
||||
signText(o, r, 1, -3, "F" + r, "B" + r);
|
||||
}
|
||||
pillar(o, 3, 7, 0, "birch_wall_sign[facing=%s]");
|
||||
pillar(o, 3, 7, 1, "cherry_wall_hanging_sign[facing=%s]");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
signText(o, 3 + STEP[i][0], 0, 7 + STEP[i][1], DIRS[i], "back");
|
||||
signText(o, 3 + STEP[i][0], 1, 7 + STEP[i][1], DIRS[i], "back");
|
||||
}
|
||||
pillar(o, 10, 7, 1, "dark_oak_wall_sign[facing=%s]");
|
||||
for (int i = 0; i < 4; i++) signText(o, 10 + STEP[i][0], 1, 7 + STEP[i][1], DIRS[i].toUpperCase(), "");
|
||||
}
|
||||
|
||||
/** Standing banners rot 0..15 with patterns, wall banners on a pillar. */
|
||||
private void beBanners(Location o) {
|
||||
DyeColor[] cols = DyeColor.values();
|
||||
for (int r = 0; r < 16; r++) {
|
||||
int x = (r % 8) * 2, z = r < 8 ? 0 : 3;
|
||||
put(o, x, 0, z, cols[r].name().toLowerCase() + "_banner[rotation=" + r + "]");
|
||||
if (o.clone().add(x, 0, z).getBlock().getState() instanceof org.bukkit.block.Banner b) {
|
||||
b.addPattern(new org.bukkit.block.banner.Pattern(DyeColor.BLACK, org.bukkit.block.banner.PatternType.STRIPE_TOP));
|
||||
b.addPattern(new org.bukkit.block.banner.Pattern(DyeColor.WHITE, org.bukkit.block.banner.PatternType.CREEPER));
|
||||
b.update(true, false);
|
||||
}
|
||||
}
|
||||
pillar(o, 16, 5, 2, "red_wall_banner[facing=%s]");
|
||||
put(o, 16, 1, 5, "stone");
|
||||
put(o, 16, 0, 5, "stone");
|
||||
}
|
||||
|
||||
/** Every head type in five rotations (0, 2, 4, 8, 12) per row, wall heads on pillars. */
|
||||
private void beHeads(Location o) {
|
||||
String[] t = {"skeleton_skull", "wither_skeleton_skull", "zombie_head", "creeper_head", "player_head", "piglin_head", "dragon_head"};
|
||||
int[] rots = {0, 2, 4, 8, 12};
|
||||
for (int i = 0; i < t.length; i++)
|
||||
for (int j = 0; j < rots.length; j++) put(o, j * 2, 0, i, t[i] + "[rotation=" + rots[j] + "]");
|
||||
String[] wall = {"skeleton_wall_skull", "dragon_wall_head", "piglin_wall_head", "player_wall_head"};
|
||||
for (int i = 0; i < wall.length; i++) pillar(o, 12, i * 3 - 2, 1, wall[i] + "[facing=%s]");
|
||||
for (int i = 0; i < wall.length; i++) put(o, 12, 0, i * 3 - 2, "stone");
|
||||
}
|
||||
|
||||
/** Bells (all attachments/facings), decorated pots with sherds, shulker boxes (6 facings), lecterns, conduit. */
|
||||
private void beMisc(Location o) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
put(o, i * 2, 0, 0, "bell[attachment=floor,facing=" + DIRS[i] + "]");
|
||||
put(o, i * 2, 2, 2, "stone");
|
||||
put(o, i * 2, 1, 2, "bell[attachment=ceiling,facing=" + DIRS[i] + "]");
|
||||
put(o, i * 2, 0, 4, "decorated_pot[facing=" + DIRS[i] + "]");
|
||||
if (o.clone().add(i * 2, 0, 4).getBlock().getState() instanceof org.bukkit.block.DecoratedPot pot) {
|
||||
pot.setSherd(org.bukkit.block.DecoratedPot.Side.FRONT, Material.HEART_POTTERY_SHERD);
|
||||
pot.setSherd(org.bukkit.block.DecoratedPot.Side.LEFT, Material.SKULL_POTTERY_SHERD);
|
||||
pot.setSherd(org.bukkit.block.DecoratedPot.Side.RIGHT, Material.ANGLER_POTTERY_SHERD);
|
||||
pot.update(true, false);
|
||||
}
|
||||
put(o, i * 2, 0, 6, "lectern[facing=" + DIRS[i] + ",has_book=true]");
|
||||
}
|
||||
put(o, 9, 1, 0, "stone");
|
||||
put(o, 10, 1, 0, "bell[attachment=single_wall,facing=east]");
|
||||
put(o, 12, 1, 0, "stone");
|
||||
put(o, 11, 1, 0, "bell[attachment=double_wall,facing=east]");
|
||||
String[] f6 = {"up", "down", "north", "south", "east", "west"};
|
||||
String[] c6 = {"", "red_", "blue_", "lime_", "black_", "white_"};
|
||||
for (int i = 0; i < 6; i++) put(o, 9 + (i % 3) * 2, 0, 3 + (i / 3) * 2, c6[i] + "shulker_box[facing=" + f6[i] + "]");
|
||||
put(o, 9, 0, 7, "conduit");
|
||||
put(o, 8, 0, 6, "lectern[facing=south,has_book=false]");
|
||||
}
|
||||
|
||||
/** Block-entity items: held by armor stands, worn on heads, as item displays and as block displays. */
|
||||
private void beItems(Location o) {
|
||||
Material[] m = {Material.CHEST, Material.RED_BANNER, Material.SHULKER_BOX, Material.DECORATED_POT,
|
||||
Material.CONDUIT, Material.DRAGON_HEAD, Material.PIGLIN_HEAD, Material.CREEPER_HEAD, Material.PLAYER_HEAD};
|
||||
for (int i = 0; i < m.length; i++) {
|
||||
ArmorStand as = spawn(o, i + 0.5, 0, 6.5, 0, ArmorStand.class);
|
||||
as.setArms(true);
|
||||
as.getEquipment().setItemInMainHand(it(m[i]));
|
||||
if (m[i].name().endsWith("_HEAD")) as.getEquipment().setHelmet(it(m[i]));
|
||||
ItemDisplay d = spawn(o, i + 0.5, 0.6, 3, 0, ItemDisplay.class);
|
||||
d.setItemStack(it(m[i]));
|
||||
d.setTransformation(new Transformation(new Vector3f(), new Quaternionf(), new Vector3f(0.6f), new Quaternionf()));
|
||||
}
|
||||
String[] blocks = {"chest[facing=south]", "red_banner[rotation=0]", "shulker_box[facing=up]", "decorated_pot[facing=south]",
|
||||
"skeleton_skull[rotation=8]", "lectern[facing=south,has_book=true]"};
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
BlockDisplay b = spawn(o, i * 1.5, 0, 0, 0, BlockDisplay.class);
|
||||
b.setBlock(Bukkit.createBlockData("minecraft:" + blocks[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user