Changed the way minecart speed boost works so its accurate with the original version

master
Wynd 2025-04-14 14:31:09 +03:00
parent f6c0a6bb7e
commit 8c3eb9063e
1 changed files with 25 additions and 8 deletions

View File

@ -1,5 +1,5 @@
--- src/EntityMinecart.java.bak 2025-04-11 18:43:27.270084097 +0300
+++ src/EntityMinecart.java 2025-04-12 13:42:29.031819118 +0300
+++ src/EntityMinecart.java 2025-04-14 14:13:34.671702824 +0300
@@ -7,6 +7,8 @@
import java.io.PrintStream;
import java.util.List;
@ -86,15 +86,10 @@
boolean flag = false;
double d5 = 0.0078125D;
int l = worldObj.getBlockId(i, j, k);
@@ -457,7 +491,37 @@
motionZ = -0.02D;
@@ -458,6 +492,33 @@
}
}
- }
+
+ this.motionX = Math.min(this.motionX * ModConfig.MINECART_POWERED_BOOST.get(), ModConfig.MINECART_MAX_SPEED.get());
+ this.motionZ = Math.min(this.motionZ * ModConfig.MINECART_POWERED_BOOST.get(), ModConfig.MINECART_MAX_SPEED.get());
+ }
}
+
+ float speed = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
+ float volume = 0;
@ -125,3 +120,25 @@
} else
{
if(motionX < -d2)
@@ -482,7 +543,7 @@
motionY *= 0.5D;
motionZ *= 0.5D;
}
- moveEntity(motionX, motionY, motionZ);
+ moveEntityBoosted(motionX, motionY, motionZ);
if(!onGround)
{
motionX *= 0.94999998807907104D;
@@ -537,6 +598,12 @@
worldObj.spawnParticle("largesmoke", posX, posY + 0.80000000000000004D, posZ, 0.0D, 0.0D, 0.0D);
}
}
+
+ public void moveEntityBoosted(double d, double d1, double d2) {
+ d = Math.min(d * ModConfig.MINECART_POWERED_BOOST.get(), ModConfig.MINECART_MAX_SPEED.get());
+ d2 = Math.min(d2 * ModConfig.MINECART_POWERED_BOOST.get(), ModConfig.MINECART_MAX_SPEED.get());
+ super.moveEntity(d, d1, d2);
+ }
public Vec3D func_515_a(double d, double d1, double d2, double d3)
{