diff --git a/paper-server/nms-patches/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.patch b/paper-server/nms-patches/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.patch index 55678f5256..0401e0ece4 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.patch @@ -27,7 +27,7 @@ + private double flyingX = 0.95; + private double flyingY = 0.95; + private double flyingZ = 0.95; -+ public double maxSpeed = 0.4D; ++ public Double maxSpeed; + // CraftBukkit end + protected EntityMinecartAbstract(EntityTypes entitytypes, World world) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/vehicle/NewMinecartBehavior.patch b/paper-server/nms-patches/net/minecraft/world/entity/vehicle/NewMinecartBehavior.patch index ef0b9564d3..c384676e80 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/vehicle/NewMinecartBehavior.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/vehicle/NewMinecartBehavior.patch @@ -12,7 +12,20 @@ public class NewMinecartBehavior extends MinecartBehavior { public static final int POS_ROT_LERP_TICKS = 3; -@@ -544,7 +549,7 @@ +@@ -516,6 +521,12 @@ + + @Override + public double getMaxSpeed(WorldServer worldserver) { ++ // CraftBukkit start ++ Double maxSpeed = this.minecart.maxSpeed; ++ if (maxSpeed != null) { ++ return (this.minecart.isInWater() ? maxSpeed / 2.0D : maxSpeed); ++ } ++ // CraftBukkit end + return (double) worldserver.getGameRules().getInt(GameRules.RULE_MINECART_MAX_SPEED) * (this.minecart.isInWater() ? 0.5D : 1.0D) / 20.0D; + } + +@@ -544,7 +555,7 @@ @Override public double getSlowdownFactor() { @@ -21,7 +34,7 @@ } @Override -@@ -571,6 +576,14 @@ +@@ -571,6 +582,14 @@ Entity entity = (Entity) iterator.next(); if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.minecart.isVehicle() && !entity.isPassenger()) { @@ -36,7 +49,7 @@ boolean flag = entity.startRiding(this.minecart); if (flag) { -@@ -597,6 +610,16 @@ +@@ -597,6 +616,16 @@ Entity entity = (Entity) iterator.next(); if (entity instanceof EntityHuman || entity instanceof EntityIronGolem || entity instanceof EntityMinecartAbstract || this.minecart.isVehicle() || entity.isPassenger()) { @@ -53,7 +66,7 @@ entity.push((Entity) this.minecart); flag = true; } -@@ -609,6 +632,14 @@ +@@ -609,6 +638,14 @@ Entity entity1 = (Entity) iterator1.next(); if (!this.minecart.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/vehicle/OldMinecartBehavior.patch b/paper-server/nms-patches/net/minecraft/world/entity/vehicle/OldMinecartBehavior.patch index 3b43b93d54..e250c27928 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/vehicle/OldMinecartBehavior.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/vehicle/OldMinecartBehavior.patch @@ -54,12 +54,17 @@ entity1.push((Entity) this.minecart); } } -@@ -487,11 +518,11 @@ +@@ -487,11 +518,17 @@ @Override public double getMaxSpeed(WorldServer worldserver) { -- return this.minecart.isInWater() ? 0.2D : 0.4D; -+ return (this.minecart.isInWater() ? this.minecart.maxSpeed / 2.0D: this.minecart.maxSpeed); // CraftBukkit ++ // CraftBukkit start ++ Double maxSpeed = this.minecart.maxSpeed; ++ if (maxSpeed != null) { ++ return (this.minecart.isInWater() ? maxSpeed / 2.0D : maxSpeed); ++ } ++ // CraftBukkit end + return this.minecart.isInWater() ? 0.2D : 0.4D; } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index 4755140e1f..8b45c0ee5b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.entity; +import net.minecraft.server.level.WorldServer; import net.minecraft.world.entity.vehicle.EntityMinecartAbstract; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.IBlockData; @@ -28,7 +29,7 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { @Override public double getMaxSpeed() { - return getHandle().maxSpeed; + return getHandle().getBehavior().getMaxSpeed((WorldServer) getHandle().level()); } @Override