entity state poses from the vanilla dump: sleeping/sitting/crouching/swimming/gliding, fox/cat/panda/parrot/bat/camel/sniffer poses with pose transforms, per-sub-model poses (baby pivots), armor-stand part poses and body pitch via rotation bindings, fish in water, beds, shoulder parrots, pose test scenes

This commit is contained in:
MineTec committed 2026-11-04 17:51:01 +01:00
1 parent 6660ebe557
commit 45d033bd89
10 files changed
+1108 -110

No files matched your search

+208 -1
View File
@@ -154,6 +154,20 @@ public class PPTest extends JavaPlugin {
// leather armor, wolf collars and patterned banners, all from a seeded RNG (deterministic).
scenes.put("perf_village", new Scene("perf_village", this::perfVillage, -6, 9, -13, 4, 0, 0));
scenes.put("perf_village_close", new Scene("perf_village_close", this::perfVillage, 0.5, 3, -11.5, 5, 0.5, -4));
// Entity poses (vanilla setupAnim/renderer state from the dump): sitting/sleeping/crouching pets with mouth
// items, cats lying, parrots, pandas; camel/sniffer/bat/dolphin pitch/fish in water/sleeping villager/
// mannequin poses/baby rider; armor stands with custom part poses. All rfSpawn (deterministic).
scenes.put("pose_pets", new Scene("pose_pets", this::posePets, 4.3, 3.6, -6, 4.3, 0.2, 2));
scenes.put("pose_pets_side", new Scene("pose_pets_side", this::posePets, -3, 3, -3, 4, 0, 2));
scenes.put("pose_fox_close", new Scene("pose_fox_close", this::posePets, 2.2, 1.4, -2.2, 2.2, 0.2, 0));
scenes.put("pose_misc", new Scene("pose_misc", this::poseMisc, 6.5, 5, -10, 6.5, 0.5, 0));
scenes.put("pose_misc_side", new Scene("pose_misc_side", this::poseMisc, -4, 3, -7, 6, 0.5, -1));
scenes.put("pose_humans", new Scene("pose_humans", this::poseHumans, 6, 3.5, -7, 6, 0.6, 1));
scenes.put("pose_humans_side", new Scene("pose_humans_side", this::poseHumans, -3, 3, -4, 5, 0.5, 1));
scenes.put("pose_humans_close", new Scene("pose_humans_close", this::poseHumans, 4.8, 1.6, -5.2, 4.8, 0.5, -2.5));
scenes.put("pose_beds", new Scene("pose_beds", this::poseHumans, 1.3, 2.6, -3.2, 1.3, 0.4, 0.2));
scenes.put("pose_stands", new Scene("pose_stands", this::poseStands, 4, 2.4, -5, 4, 0.9, 0));
scenes.put("pose_stands_side", new Scene("pose_stands_side", this::poseStands, -3, 2.4, -3, 4, 0.9, 0));
}
private void perfFarm(Location o) {
@@ -234,6 +248,199 @@ public class PPTest extends JavaPlugin {
}
}
// --- poses ------------------------------------------------------------------------------------
private void posePets(Location o) {
// Row 1 (z=0): foxes — standing, sitting, sleeping, crouching, crouching+leaping, faceplanted.
Fox f0 = rfSpawn(o, 0, 0, 0, 180, Fox.class);
hands(f0, Material.SWEET_BERRIES, null);
Fox f1 = rfSpawn(o, 1.2, 0, 0, 180, Fox.class);
f1.setSitting(true);
hands(f1, Material.SWEET_BERRIES, null);
Fox f2 = rfSpawn(o, 2.4, 0, 0, 180, Fox.class);
f2.setSleeping(true);
hands(f2, Material.SWEET_BERRIES, null);
Fox f3 = rfSpawn(o, 3.6, 0, 0, 180, Fox.class);
f3.setCrouching(true);
hands(f3, Material.FEATHER, null);
Fox f4 = rfSpawn(o, 4.8, 0, 0, 180, Fox.class);
f4.setCrouching(true);
f4.setLeaping(true);
Fox f5 = rfSpawn(o, 6.0, 0, 0, 180, Fox.class);
f5.setFaceplanted(true);
f5.setFoxType(Fox.Type.SNOW);
Fox fb = rfSpawn(o, 7.2, 0, 0, 180, Fox.class);
fb.setBaby();
fb.setSleeping(true);
hands(fb, Material.SWEET_BERRIES, null);
Fox fb2 = rfSpawn(o, 8.2, 0, 0, 180, Fox.class);
fb2.setBaby();
fb2.setSitting(true);
// Row 2 (z=1.8): cats & wolves — sitting, lying, lying + head up, baby sitting; wolf/pup sitting.
Cat c0 = rfSpawn(o, 0, 0, 1.8, 180, Cat.class);
c0.setSitting(true);
Cat c1 = rfSpawn(o, 1.2, 0, 1.8, 180, Cat.class);
c1.setLyingDown(true);
c1.setCatType(Cat.Type.BLACK);
Cat c2 = rfSpawn(o, 2.6, 0, 1.8, 180, Cat.class);
c2.setLyingDown(true);
c2.setHeadUp(true);
c2.setCatType(Cat.Type.SIAMESE);
Cat c3 = rfSpawn(o, 4.0, 0, 1.8, 180, Cat.class);
c3.setBaby();
c3.setSitting(true);
tame(c3, DyeColor.RED);
Wolf w0 = rfSpawn(o, 5.2, 0, 1.8, 180, Wolf.class);
w0.setSitting(true);
Wolf w1 = rfSpawn(o, 6.6, 0, 1.8, 180, Wolf.class);
tame(w1, DyeColor.BLUE);
w1.setSitting(true);
Wolf w2 = rfSpawn(o, 8.0, 0, 1.8, 180, Wolf.class);
w2.setBaby();
w2.setSitting(true);
// Row 3 (z=3.6): parrots (flying default, sitting, standing on the ground), pandas.
Parrot p0 = rfSpawn(o, 0, 0, 3.6, 180, Parrot.class);
p0.setVariant(Parrot.Variant.BLUE);
Parrot p1 = rfSpawn(o, 0.8, 0, 3.6, 180, Parrot.class);
p1.setSitting(true);
p1.setVariant(Parrot.Variant.GREEN);
Parrot p2 = rfSpawn(o, 1.6, 0, 3.6, 180, Parrot.class);
p2.setVariant(Parrot.Variant.CYAN);
if (p2 instanceof Mob m) {
m.setAI(true);
m.setAware(false); // no goals, but physics: lands -> on ground -> standing pose
}
Panda pa0 = rfSpawn(o, 3.2, 0, 3.6, 180, Panda.class);
pa0.setSitting(true);
Panda pa1 = rfSpawn(o, 5.2, 0, 3.6, 180, Panda.class);
pa1.setOnBack(true);
Panda pa2 = rfSpawn(o, 7.2, 0, 3.6, 180, Panda.class);
pa2.setBaby();
pa2.setSitting(true);
Panda pa3 = rfSpawn(o, 8.6, 0, 3.6, 180, Panda.class);
pa3.setBaby();
pa3.setOnBack(true);
faceNorth(o);
}
private void poseMisc(Location o) {
Camel ca = rfSpawn(o, 0, 0, 0, 180, Camel.class);
ca.setSitting(true);
rfSpawn(o, 2.6, 0, 0, 180, Camel.class);
Sniffer sn = rfSpawn(o, 5.4, 0, 0, 180, Sniffer.class);
sn.setState(Sniffer.State.DIGGING);
rfSpawn(o, 8.6, 0, 0, 180, Sniffer.class);
// Bats: hanging under a block (resting) and flying.
put(o, 11, 2, 0, "stone");
Bat b0 = rfSpawn(o, 11.5, 1.1, 0.5, 180, Bat.class);
b0.setAwake(false);
Bat b1 = rfSpawn(o, 12.8, 1.0, 0.5, 180, Bat.class);
b1.setAwake(true);
// Dolphins pitched down/up/level, a strider looking up, fish in water vs. flopping on land.
Dolphin d0 = rfSpawn(o, 0, 0.6, -3.5, 180, Dolphin.class);
d0.setRotation(180, 35);
Dolphin d1 = rfSpawn(o, 2, 0.6, -3.5, 180, Dolphin.class);
d1.setRotation(180, -35);
hands(d1, Material.COD, null);
Dolphin d2 = rfSpawn(o, 4, 0.6, -3.5, 180, Dolphin.class);
hands(d2, Material.COD, null);
Strider st = rfSpawn(o, 6, 0, -3.5, 180, Strider.class);
st.setRotation(180, -30);
for (int i = 0; i < 3; i++) put(o, 8 + i, 0, -4, "water");
rfSpawn(o, 8.5, 0.3, -3.5, 180, Cod.class);
rfSpawn(o, 9.5, 0.3, -3.5, 180, Salmon.class);
TropicalFish tf = rfSpawn(o, 10.5, 0.3, -3.5, 180, TropicalFish.class);
tf.setPattern(TropicalFish.Pattern.BETTY);
rfSpawn(o, 8.5, 0, -2, 180, Cod.class);
rfSpawn(o, 9.5, 0, -2, 180, Salmon.class);
TropicalFish tf2 = rfSpawn(o, 10.5, 0, -2, 180, TropicalFish.class);
tf2.setPattern(TropicalFish.Pattern.BETTY);
faceNorth(o);
d0.setRotation(180, 35);
d1.setRotation(180, -35);
st.setRotation(180, -30);
}
private void poseHumans(Location o) {
// Villager asleep in a bed (head at z=0 facing south -> lies along z), a baby villager in a bed facing east.
put(o, 0, 0, 0, "red_bed[facing=south,part=head]");
put(o, 0, 0, -1, "red_bed[facing=south,part=foot]");
Villager v = rfSpawn(o, 0.5, 0, 1.5, 180, Villager.class);
v.setProfession(Villager.Profession.LIBRARIAN);
v.sleep(o.clone().add(0, 0, 0));
put(o, 2, 0, 0, "blue_bed[facing=east,part=head]");
put(o, 1, 0, 0, "blue_bed[facing=east,part=foot]");
Villager vb = rfSpawn(o, 2.5, 0, 1.5, 180, Villager.class);
vb.setBaby();
vb.sleep(o.clone().add(2, 0, 0));
// Mannequins: standing, crouching with a sword, crawling, swimming in water, gliding with elytra, sleeping.
Mannequin m0 = rfSpawn(o, 4, 0, 0, 180, Mannequin.class);
hands(m0, Material.IRON_SWORD, null);
Mannequin m1 = rfSpawn(o, 5.2, 0, 0, 180, Mannequin.class);
m1.setPose(Pose.SNEAKING, true);
hands(m1, Material.IRON_SWORD, null);
Mannequin m2 = rfSpawn(o, 6.6, 0, 0, 180, Mannequin.class);
m2.setPose(Pose.SWIMMING, true);
put(o, 8, 0, 0, "water");
put(o, 8, 0, 1, "water");
Mannequin m3 = rfSpawn(o, 8.5, 0.1, 0.5, 180, Mannequin.class);
m3.setPose(Pose.SWIMMING, true);
Mannequin m4 = rfSpawn(o, 10, 1.0, 0, 180, Mannequin.class);
m4.getEquipment().setChestplate(it(Material.ELYTRA));
m4.setPose(Pose.FALL_FLYING, true);
Mannequin m5 = rfSpawn(o, 12, 0, 0, 180, Mannequin.class);
m5.setPose(Pose.SLEEPING, true);
// Baby zombie riding a chicken (jockey: baby model pivots in the passenger pose), crouching zombie.
Chicken ch = rfSpawn(o, 4, 0, -2.5, 180, Chicken.class);
Zombie bz = rfSpawn(o, 4, 0, -2.5, 180, Zombie.class);
bz.setBaby();
ch.addPassenger(bz);
Zombie zc = rfSpawn(o, 5.5, 0, -2.5, 180, Zombie.class);
zc.setPose(Pose.SNEAKING, true);
faceNorth(o);
}
private void poseStands(Location o) {
// Custom armor-stand poses (head/body/arms/legs, radians), with arms, armor and held items.
ArmorStand a = rfSpawn(o, 0, 0, 0, 180, ArmorStand.class);
a.setArms(true);
a.setHeadPose(new org.bukkit.util.EulerAngle(Math.toRadians(-20), Math.toRadians(30), 0));
a.setRightArmPose(new org.bukkit.util.EulerAngle(Math.toRadians(-90), 0, 0));
a.setLeftArmPose(new org.bukkit.util.EulerAngle(Math.toRadians(-30), 0, Math.toRadians(-40)));
Ah(a);
ArmorStand b = rfSpawn(o, 1.6, 0, 0, 180, ArmorStand.class);
b.setArms(true);
b.setBodyPose(new org.bukkit.util.EulerAngle(Math.toRadians(15), Math.toRadians(20), 0));
b.setRightLegPose(new org.bukkit.util.EulerAngle(Math.toRadians(-40), 0, 0));
b.setLeftLegPose(new org.bukkit.util.EulerAngle(Math.toRadians(30), 0, Math.toRadians(-10)));
diamondArmor(b);
hands(b, Material.IRON_SWORD, Material.SHIELD);
ArmorStand c = rfSpawn(o, 3.2, 0, 0, 180, ArmorStand.class);
c.setArms(true);
c.setSmall(true);
c.setRightArmPose(new org.bukkit.util.EulerAngle(Math.toRadians(-120), Math.toRadians(20), 0));
c.setHeadPose(new org.bukkit.util.EulerAngle(0, 0, Math.toRadians(25)));
diamondArmor(c);
hands(c, Material.TORCH, null);
ArmorStand d = rfSpawn(o, 4.8, 0, 0, 180, ArmorStand.class);
d.setHeadPose(new org.bukkit.util.EulerAngle(Math.toRadians(30), 0, 0));
d.getEquipment().setHelmet(it(Material.CARVED_PUMPKIN));
ArmorStand e = rfSpawn(o, 6.4, 0, 0, 180, ArmorStand.class);
e.setArms(true);
e.setInvisible(true);
e.setRightArmPose(new org.bukkit.util.EulerAngle(Math.toRadians(-60), Math.toRadians(-30), 0));
e.setBodyPose(new org.bukkit.util.EulerAngle(0, Math.toRadians(30), 0));
diamondArmor(e);
hands(e, Material.DIAMOND_SWORD, null);
ArmorStand f = rfSpawn(o, 8, 0, 0, 180, ArmorStand.class); // default pose (must match rf_stands)
f.setArms(true);
}
private static void Ah(ArmorStand a) {
a.getEquipment().setHelmet(it(Material.GOLDEN_HELMET));
hands(a, Material.BOW, Material.APPLE);
}
private void perfItems(Location o) {
Random r = new Random(7);
Material[] mats = {Material.WHEAT, Material.CARROT, Material.EGG, Material.BONE, Material.ROTTEN_FLESH,
@@ -283,7 +490,7 @@ public class PPTest extends JavaPlugin {
Location eye = o.clone().add(sc.camX, sc.camY, sc.camZ);
Vector look = o.clone().add(sc.lookX, sc.lookY, sc.lookZ).toVector().subtract(eye.toVector());
eye.setDirection(look);
RenderJob job = r.prepare(eye, sc.name.endsWith("_sq") ? new Resolution(384, 384) : sc.name.startsWith("proj_") || sc.name.startsWith("rf_") || sc.name.startsWith("frames") ? new Resolution(960, 640) : new Resolution(480, 320), null);
RenderJob job = r.prepare(eye, sc.name.endsWith("_sq") ? new Resolution(384, 384) : sc.name.startsWith("proj_") || sc.name.startsWith("rf_") || sc.name.startsWith("pose_") || sc.name.startsWith("frames") ? new Resolution(960, 640) : new Resolution(480, 320), null);
if (sc.name.equals("dbg")) {
try {
java.lang.reflect.Field f = DefaultScreenRenderer.class.getDeclaredField("objectBaker");