Merge pull request #151 from rdbtCVS/t3code/fix-creative-fall-damage-sound
Fix fall damage sounds in creative mode
This commit is contained in:
@@ -458,7 +458,7 @@ fn main() -> Result<()> {
|
||||
"weaving" => world.player.status.weaving = op["value"].as_bool().unwrap(),
|
||||
"flying" => {
|
||||
let flying = op["value"].as_bool().unwrap();
|
||||
world.player.may_fly = flying;
|
||||
world.player.may_fly = op["may_fly"].as_bool().unwrap_or(flying);
|
||||
world.player.flying = flying;
|
||||
}
|
||||
"trigger" => world.player.jump_trigger_time = op["value"].as_i64().unwrap() as i32,
|
||||
|
||||
@@ -360,8 +360,12 @@ impl BlockLandingWorld for MotionWorld<'_, '_, '_> {
|
||||
multiplier: f32,
|
||||
source: LandingDamage,
|
||||
) -> Result<bool> {
|
||||
// Nonflying player: Player.causeFallDamage records centimeters before
|
||||
// delegating to LivingEntity. No mayfly ability in the walking scene.
|
||||
// Player.causeFallDamage exempts players with the mayfly ability,
|
||||
// including creative players who are currently walking.
|
||||
if self.player.may_fly {
|
||||
return Ok(false);
|
||||
}
|
||||
// Record centimeters before delegating to LivingEntity.
|
||||
if distance >= 2.0 || distance.is_nan() {
|
||||
let scaled = distance * 100.0;
|
||||
let floor = scaled.floor();
|
||||
|
||||
@@ -392,7 +392,7 @@ public final class VanillaSceneMotionOracle {
|
||||
case "frozen"->p.frozen=op.get("value").getAsInt();
|
||||
case "portal_tick"->p.portalTick(op.get("creative").getAsBoolean());
|
||||
case "weaving"->p.weaving=op.get("value").getAsBoolean();
|
||||
case "flying"->{var a=p.getAbilities();a.mayfly=a.flying=op.get("value").getAsBoolean();}
|
||||
case "flying"->{var a=p.getAbilities();a.flying=op.get("value").getAsBoolean();a.mayfly=op.has("may_fly")?op.get("may_fly").getAsBoolean():a.flying;}
|
||||
case "trigger"->trigger.setInt(p,op.get("value").getAsInt());
|
||||
case "delay"->delay.setInt(p,op.get("value").getAsInt());
|
||||
case "ack_attributes"->{p.attrs.getAttributesToUpdate().clear();p.attrs.getAttributesToSync().clear();}
|
||||
|
||||
@@ -340,6 +340,18 @@ def corpus():
|
||||
yield dict(position=vec((25.5,4,25.5)),ops=[op('seed',seed),op('block',name='minecraft:'+name,position=[25,3,25],properties=properties),
|
||||
*[v for _ in range(8) for v in [op('fall',bits(8)),op('landing',bits(-.1),ground=True,position=[25,3,25])]],
|
||||
op('block',name='minecraft:stone',position=[25,3,25])])
|
||||
# Creative players are exempt even while walking. Compare small/big falls,
|
||||
# block damage multipliers and switching back to survival on the same actor.
|
||||
for name in ['stone','hay_block','pointed_dripstone']:
|
||||
for distance in [4,8,20]:
|
||||
for flying in [False,True]:
|
||||
ops=[op('block',name='minecraft:'+name,position=[25,3,25]),
|
||||
op('flying',flying,may_fly=True),op('fall',bits(distance)),
|
||||
op('landing',bits(-.125),ground=True,position=[25,3,25]),
|
||||
op('flying',False,may_fly=False),op('fall',bits(distance)),
|
||||
op('landing',bits(-.125),ground=True,position=[25,3,25]),
|
||||
op('block',name='minecraft:stone',position=[25,3,25])]
|
||||
yield dict(position=vec((25.5,4,25.5)),ops=ops)
|
||||
for safe in [0,1,3,6,20]:
|
||||
for multiplier in [0,.5,1,2]:
|
||||
for impact in [None,3,4,4.1,7,18]:
|
||||
|
||||
Reference in New Issue
Block a user