13
0
geforkt von Mirrors/Paper

Improve minecart movement

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2024-08-24 07:42:35 +10:00
Ursprung 7eb7761ca0
Commit 0b4a111361

Datei anzeigen

@ -136,7 +136,7 @@
} }
public void activateMinecart(int i, int j, int k, boolean flag) {} public void activateMinecart(int i, int j, int k, boolean flag) {}
@@ -382,12 +447,16 @@ @@ -382,16 +447,30 @@
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0)); this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
if (this.onGround()) { if (this.onGround()) {
@ -155,7 +155,21 @@
} }
} }
@@ -583,7 +652,7 @@
+ // CraftBukkit start
+ @Override
+ public Vec3D getKnownMovement() {
+ double d0 = this.getMaxSpeed();
+ Vec3D vec3d = super.getKnownMovement();
+
+ return new Vec3D(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
+ }
+ // CraftBukkit end
+
protected void moveAlongTrack(BlockPosition blockposition, IBlockData iblockdata) {
this.resetFallDistance();
double d0 = this.getX();
@@ -583,7 +662,7 @@
} }
protected void applyNaturalSlowdown() { protected void applyNaturalSlowdown() {
@ -164,7 +178,7 @@
Vec3D vec3d = this.getDeltaMovement(); Vec3D vec3d = this.getDeltaMovement();
vec3d = vec3d.multiply(d0, 0.0D, d0); vec3d = vec3d.multiply(d0, 0.0D, d0);
@@ -722,6 +791,14 @@ @@ -722,6 +801,14 @@
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
if (!entity.noPhysics && !this.noPhysics) { if (!entity.noPhysics && !this.noPhysics) {
if (!this.hasPassenger(entity)) { if (!this.hasPassenger(entity)) {
@ -179,7 +193,7 @@
double d0 = entity.getX() - this.getX(); double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ(); double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1; double d2 = d0 * d0 + d1 * d1;
@@ -896,4 +973,26 @@ @@ -896,4 +983,26 @@
private EnumMinecartType() {} private EnumMinecartType() {}
} }