diff options
Diffstat (limited to 'src/main')
4 files changed, 73 insertions, 16 deletions
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index c5bd46be..6aa0d3b9 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -27,6 +27,7 @@ public class EntityBoat extends Entity { private double ak; private double al; private double am; + public double maxSpeed = 0.4D; // CraftBukkit // CraftBukkit start public void c(Entity entity) { @@ -219,7 +220,7 @@ public class EntityBoat extends Entity { this.motZ += this.passenger.motZ * 0.2D; } - d4 = 0.4D; + d4 = this.maxSpeed; // CraftBukkit if (this.motX < -d4) { this.motX = -d4; } diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index 9de452e1..a2c25489 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -31,13 +31,14 @@ public class EntityMinecart extends Entity implements IInventory { private double at; // CraftBukkit start - private boolean slowWhenEmpty = true; - private double derailedX = 0.5; - private double derailedY = 0.5; - private double derailedZ = 0.5; - private double flyingX = 0.94999998807907104; - private double flyingY = 0.94999998807907104; - private double flyingZ = 0.94999998807907104; + public boolean slowWhenEmpty = true; + public double derailedX = 0.5; + public double derailedY = 0.5; + public double derailedZ = 0.5; + public double flyingX = 0.95; + public double flyingY = 0.95; + public double flyingZ = 0.95; + public double maxSpeed = 0.4D; public ItemStack[] getContents() { return this.al; @@ -224,7 +225,7 @@ public class EntityMinecart extends Entity implements IInventory { --j; } - double d4 = 0.4D; + double d4 = this.maxSpeed; // CraftBukkit boolean flag = false; d0 = 0.0078125D; @@ -326,7 +327,9 @@ public class EntityMinecart extends Entity implements IInventory { this.a(this.locX, this.locY + (double) aint[1][1], this.locZ); } - if (this.passenger != null) { + // CraftBukkit start + if (this.passenger != null || !slowWhenEmpty) { + // CraftBukkit end this.motX *= 0.996999979019165D; this.motY *= 0.0D; this.motZ *= 0.996999979019165D; @@ -412,16 +415,20 @@ public class EntityMinecart extends Entity implements IInventory { } if (this.onGround) { - this.motX *= 0.5D; - this.motY *= 0.5D; - this.motZ *= 0.5D; + // CraftBukkit start + this.motX *= this.derailedX; + this.motY *= this.derailedY; + this.motZ *= this.derailedZ; + // CraftBukkit start } this.c(this.motX, this.motY, this.motZ); if (!this.onGround) { - this.motX *= 0.949999988079071D; - this.motY *= 0.949999988079071D; - this.motZ *= 0.949999988079071D; + // CraftBukkit start + this.motX *= flyingX; + this.motY *= flyingY; + this.motZ *= flyingZ; + // CraftBukkit start } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java index 0712edce..ccb83e32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java @@ -17,6 +17,16 @@ public class CraftBoat extends CraftVehicle implements Boat { boat = entity; } + public double getMaxSpeed() { + return boat.maxSpeed; + } + + public void setMaxSpeed(double speed) { + if (speed >= 0D) { + boat.maxSpeed = speed; + } + } + @Override public String toString() { return "CraftBoat"; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index a0cff41a..cbaa5c90 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityMinecart; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Minecart; +import org.bukkit.util.Vector; /** * A minecart. @@ -45,6 +46,44 @@ public class CraftMinecart extends CraftVehicle implements Minecart { return minecart.a; } + public double getMaxSpeed() { + return minecart.maxSpeed; + } + + public void setMaxSpeed(double speed) { + if (speed >= 0D) { + minecart.maxSpeed = speed; + } + } + + public boolean isSlowWhenEmpty() { + return minecart.slowWhenEmpty; + } + + public void setSlowWhenEmpty(boolean slow) { + minecart.slowWhenEmpty = slow; + } + + public Vector getFlyingVelocityMod() { + return new Vector(minecart.flyingX, minecart.flyingY, minecart.flyingZ); + } + + public void setFlyingVelocityMod(Vector flying) { + minecart.flyingX = flying.getX(); + minecart.flyingY = flying.getY(); + minecart.flyingZ = flying.getZ(); + } + + public Vector getDerailedVelocityMod() { + return new Vector(minecart.derailedX, minecart.derailedY, minecart.derailedZ); + } + + public void setDerailedVelocityMod(Vector derailed) { + minecart.derailedX = derailed.getX(); + minecart.derailedY = derailed.getY(); + minecart.derailedZ = derailed.getZ(); + } + @Override public String toString() { return "CraftMinecart"; |