mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
[ci skip] micro opt when applying block friction on flying ridable mobs
This commit is contained in:
@@ -177,7 +177,7 @@ index f0c452ddc4b299a930de261722cc41a89aa78eeb..8e8ddab59de508c84c4182e105a11554
|
||||
protected ParticleOptions getInkParticle() {
|
||||
return ParticleTypes.GLOW_SQUID_INK;
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..388d2e87696d9d3ec265355ec3602a03aa3151bb 100644
|
||||
index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..4f67ae2491d053d3d7261440c029da512dc1002b 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -238,9 +238,9 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -210,26 +210,21 @@ index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..388d2e87696d9d3ec265355ec3602a03
|
||||
|
||||
@Override
|
||||
protected void checkFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) {
|
||||
@@ -3026,6 +3027,26 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3026,6 +3027,21 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.5));
|
||||
} else {
|
||||
+ // Purpur start - Ridables
|
||||
+ if (this.getRider() != null && this.isControllable()) {
|
||||
+ float f = 0.91F;
|
||||
+ float friction = 0.91F;
|
||||
+ if (this.onGround()) {
|
||||
+ f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.91F;
|
||||
+ friction = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.91F;
|
||||
+ }
|
||||
+
|
||||
+ float f1 = 0.16277137F / (f * f * f);
|
||||
+ f = 0.91F;
|
||||
+ if (this.onGround()) {
|
||||
+ f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.91F;
|
||||
+ }
|
||||
+
|
||||
+ this.moveRelative(this.onGround() ? 0.1F * f1 : 0.02F, relative);
|
||||
+ float frictionCompensation = 0.16277137F / (friction * friction * friction);
|
||||
+ this.moveRelative(this.onGround() ? 0.1F * frictionCompensation : 0.02F, relative);
|
||||
+ this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
+ this.setDeltaMovement(this.getDeltaMovement().scale(f));
|
||||
+ this.setDeltaMovement(this.getDeltaMovement().scale(friction));
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end - Ridables
|
||||
@@ -237,7 +232,7 @@ index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..388d2e87696d9d3ec265355ec3602a03
|
||||
this.moveRelative(amount, relative);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.91F));
|
||||
@@ -3629,8 +3650,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3629,8 +3645,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
this.pushEntities();
|
||||
profilerFiller.pop();
|
||||
// Paper start - Add EntityMoveEvent
|
||||
@@ -250,7 +245,7 @@ index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..388d2e87696d9d3ec265355ec3602a03
|
||||
Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
|
||||
Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
|
||||
@@ -3640,6 +3663,21 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3640,6 +3658,21 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
this.absSnapTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user