mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-20 03:44:23 +01:00
Add a bit of randomisation to muffins' rtajectories when they bounce
This commit is contained in:
parent
e0f6ab8937
commit
b35c592569
1 changed files with 14 additions and 3 deletions
|
@ -114,17 +114,28 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
||||||
if (isBouncy()) {
|
if (isBouncy()) {
|
||||||
Direction.Axis side = hit.getSide().getAxis();
|
Direction.Axis side = hit.getSide().getAxis();
|
||||||
|
|
||||||
|
double randomisation = ((world.random.nextFloat() - 0.5F) / 5);
|
||||||
|
|
||||||
|
double inflectionAmount = randomisation + -0.4;
|
||||||
|
double deflectionAmount = randomisation + 0.3;
|
||||||
|
|
||||||
if (side == Direction.Axis.X) {
|
if (side == Direction.Axis.X) {
|
||||||
setVelocity(getVelocity().multiply(-0.4, 0.3, 0.3));
|
setVelocity(getVelocity().multiply(inflectionAmount, deflectionAmount, deflectionAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (side == Direction.Axis.Y) {
|
if (side == Direction.Axis.Y) {
|
||||||
setVelocity(getVelocity().multiply(0.3, -0.4, 0.3));
|
setVelocity(getVelocity().multiply(deflectionAmount, inflectionAmount, deflectionAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (side == Direction.Axis.Z) {
|
if (side == Direction.Axis.Z) {
|
||||||
setVelocity(getVelocity().multiply(0.3, 0.3, -0.4));
|
setVelocity(getVelocity().multiply(deflectionAmount, deflectionAmount, inflectionAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addVelocity(
|
||||||
|
((world.random.nextFloat() - 0.5F) / 5),
|
||||||
|
((world.random.nextFloat() - 0.5F) / 5),
|
||||||
|
((world.random.nextFloat() - 0.5F) / 5)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
super.onBlockHit(hit);
|
super.onBlockHit(hit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue