Fix happy ghast rider collisions and turning
This commit is contained in:
@@ -902,6 +902,10 @@ fn main() -> horizon_client::Result<()> {
|
||||
for flag in &spec.flags {
|
||||
match flag.as_str() {
|
||||
"persistent" => m.persistent = true,
|
||||
"ridden" => {
|
||||
m.extra.head = Some("minecraft:red_harness".into());
|
||||
m.rider = Some(horizon_client::mobs::equine::Rider::default());
|
||||
}
|
||||
"noai" => m.no_ai = true,
|
||||
// Warden.finalizeSpawn's own part.
|
||||
"digcooldown" | "emerge" => horizon_client::mobs::warden::finalize(
|
||||
|
||||
@@ -769,6 +769,8 @@ fn push_entities(m: &mut Mob, w: &MobWorld, events: &mut Vec<MobEvent>) {
|
||||
&& !(m.species() == Species::Creaking && !super::creaking::can_move(m));
|
||||
let mut targets: Vec<(Who, Vec3)> = Vec::new();
|
||||
if let Some(p) = &w.player
|
||||
// Entity.push: passengers of the same vehicle never push each other.
|
||||
&& m.rider.is_none()
|
||||
&& p.alive
|
||||
&& !p.spectator
|
||||
&& p.bounds.intersects(bounds)
|
||||
|
||||
@@ -311,14 +311,14 @@ pub fn ridden_step(m: &mut Mob) {
|
||||
if super::nautilus::is_nautilus(m.species()) {
|
||||
return super::nautilus::ridden(m);
|
||||
}
|
||||
if m.species() == Species::HappyGhast {
|
||||
return super::happy_ghast::ridden(m);
|
||||
}
|
||||
m.yaw = r.yaw;
|
||||
m.head_pitch = r.pitch * 0.5;
|
||||
m.body_yaw = r.yaw;
|
||||
m.head_yaw = r.yaw;
|
||||
m.ai.nav.stop();
|
||||
if m.species() == Species::HappyGhast {
|
||||
return super::happy_ghast::ridden(m);
|
||||
}
|
||||
|
||||
if matches!(m.species(), Species::Pig | Species::Strider) {
|
||||
// Pig/Strider: always forward along the rider's look, at a fraction
|
||||
|
||||
@@ -553,6 +553,9 @@ public final class VanillaMobAiOracle {
|
||||
String v = kv.length > 1 ? kv[1] : "";
|
||||
switch (kv[0]) {
|
||||
case "persistent" -> mob.setPersistenceRequired();
|
||||
case "ridden" -> mob.setItemSlot(net.minecraft.world.entity.EquipmentSlot.BODY,
|
||||
new net.minecraft.world.item.ItemStack(BuiltInRegistries.ITEM.getValue(
|
||||
net.minecraft.resources.Identifier.parse("minecraft:red_harness"))));
|
||||
case "noai" -> mob.setNoAi(true);
|
||||
case "profession" -> {
|
||||
Villager villager = (Villager) mob;
|
||||
@@ -641,6 +644,9 @@ public final class VanillaMobAiOracle {
|
||||
// Leads: to the player ("leashed") or to the n-th mob ("leashto=n").
|
||||
for (int i = 0; i < s.mobs.size(); i++) {
|
||||
for (String flag : s.mobs.get(i).flags) {
|
||||
if (flag.equals("ridden")) {
|
||||
if (!player.startRiding(ENTS.get(i))) throw new IllegalStateException("Could not mount fixture");
|
||||
}
|
||||
if (flag.equals("leashed")) ((net.minecraft.world.entity.Leashable) ENTS.get(i)).setLeashedTo(player, true);
|
||||
else if (flag.startsWith("leashto=")) ((net.minecraft.world.entity.Leashable) ENTS.get(i))
|
||||
.setLeashedTo(ENTS.get(Integer.parseInt(flag.substring(8))), true);
|
||||
|
||||
@@ -157,6 +157,11 @@ def scenarios():
|
||||
# Happy ghasts float above the grass; ghastlings follow players and adults.
|
||||
add('happy_ghast_player', 200, ['player 6.5 -60 0.5', 'mob minecraft:happy_ghast 0.5 -55 0.5 0 81 persistent'])
|
||||
add('happy_ghast_alone', 200, ['mob minecraft:happy_ghast 0.5 -55 0.5 90 82 persistent'])
|
||||
# The driver's seat overlaps the front of the ghast: it must not push its own rider.
|
||||
# One tick isolates riding input and turning from later passenger repositioning.
|
||||
for name, yaw in [('hover', 0), ('turn', 90)]:
|
||||
add(f'happy_ghast_ridden_{name}', 1, ['player 0.5 -51.6 2.2',
|
||||
f'mob minecraft:happy_ghast 0.5 -55 0.5 {yaw} 82 persistent ridden'])
|
||||
add('ghastling_player', 200, ['player 8.5 -60 0.5', 'mob minecraft:happy_ghast 0.5 -57 0.5 0 83 persistent baby'])
|
||||
add('ghastling_alone', 200, ['mob minecraft:happy_ghast 0.5 -57 0.5 0 84 persistent baby'])
|
||||
add('ghastling_adult', 200, ['mob minecraft:happy_ghast 10.5 -55 0.5 0 85 persistent',
|
||||
|
||||
Reference in New Issue
Block a user