13
0
geforkt von Mirrors/Paper

Added MaxSpeed methods to minecarts. Added MaxSpeed methods to boats. Added SlowWhenEmpty, FlyingMod, and DerailedMod methods to minecarts.

Dieser Commit ist enthalten in:
afforess 2011-02-12 15:57:16 +01:00 committet von Erik Broes
Ursprung be9a264249
Commit 5aa95ee469
4 geänderte Dateien mit 73 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -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;
}

Datei anzeigen

@ -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
}
}

Datei anzeigen

@ -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";

Datei anzeigen

@ -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";