Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 21:10:17 +01:00
Added MaxSpeed methods to minecarts. Added MaxSpeed methods to boats. Added SlowWhenEmpty, FlyingMod, and DerailedMod methods to minecarts.
Dieser Commit ist enthalten in:
Ursprung
be9a264249
Commit
5aa95ee469
@ -27,6 +27,7 @@ public class EntityBoat extends Entity {
|
|||||||
private double ak;
|
private double ak;
|
||||||
private double al;
|
private double al;
|
||||||
private double am;
|
private double am;
|
||||||
|
public double maxSpeed = 0.4D; // CraftBukkit
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public void c(Entity entity) {
|
public void c(Entity entity) {
|
||||||
@ -219,7 +220,7 @@ public class EntityBoat extends Entity {
|
|||||||
this.motZ += this.passenger.motZ * 0.2D;
|
this.motZ += this.passenger.motZ * 0.2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
d4 = 0.4D;
|
d4 = this.maxSpeed; // CraftBukkit
|
||||||
if (this.motX < -d4) {
|
if (this.motX < -d4) {
|
||||||
this.motX = -d4;
|
this.motX = -d4;
|
||||||
}
|
}
|
||||||
|
@ -31,13 +31,14 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
private double at;
|
private double at;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
private boolean slowWhenEmpty = true;
|
public boolean slowWhenEmpty = true;
|
||||||
private double derailedX = 0.5;
|
public double derailedX = 0.5;
|
||||||
private double derailedY = 0.5;
|
public double derailedY = 0.5;
|
||||||
private double derailedZ = 0.5;
|
public double derailedZ = 0.5;
|
||||||
private double flyingX = 0.94999998807907104;
|
public double flyingX = 0.95;
|
||||||
private double flyingY = 0.94999998807907104;
|
public double flyingY = 0.95;
|
||||||
private double flyingZ = 0.94999998807907104;
|
public double flyingZ = 0.95;
|
||||||
|
public double maxSpeed = 0.4D;
|
||||||
|
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
return this.al;
|
return this.al;
|
||||||
@ -224,7 +225,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
--j;
|
--j;
|
||||||
}
|
}
|
||||||
|
|
||||||
double d4 = 0.4D;
|
double d4 = this.maxSpeed; // CraftBukkit
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
d0 = 0.0078125D;
|
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);
|
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.motX *= 0.996999979019165D;
|
||||||
this.motY *= 0.0D;
|
this.motY *= 0.0D;
|
||||||
this.motZ *= 0.996999979019165D;
|
this.motZ *= 0.996999979019165D;
|
||||||
@ -412,16 +415,20 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.onGround) {
|
if (this.onGround) {
|
||||||
this.motX *= 0.5D;
|
// CraftBukkit start
|
||||||
this.motY *= 0.5D;
|
this.motX *= this.derailedX;
|
||||||
this.motZ *= 0.5D;
|
this.motY *= this.derailedY;
|
||||||
|
this.motZ *= this.derailedZ;
|
||||||
|
// CraftBukkit start
|
||||||
}
|
}
|
||||||
|
|
||||||
this.c(this.motX, this.motY, this.motZ);
|
this.c(this.motX, this.motY, this.motZ);
|
||||||
if (!this.onGround) {
|
if (!this.onGround) {
|
||||||
this.motX *= 0.949999988079071D;
|
// CraftBukkit start
|
||||||
this.motY *= 0.949999988079071D;
|
this.motX *= flyingX;
|
||||||
this.motZ *= 0.949999988079071D;
|
this.motY *= flyingY;
|
||||||
|
this.motZ *= flyingZ;
|
||||||
|
// CraftBukkit start
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,16 @@ public class CraftBoat extends CraftVehicle implements Boat {
|
|||||||
boat = entity;
|
boat = entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getMaxSpeed() {
|
||||||
|
return boat.maxSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxSpeed(double speed) {
|
||||||
|
if (speed >= 0D) {
|
||||||
|
boat.maxSpeed = speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftBoat";
|
return "CraftBoat";
|
||||||
|
@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
|
|||||||
import net.minecraft.server.EntityMinecart;
|
import net.minecraft.server.EntityMinecart;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.Minecart;
|
import org.bukkit.entity.Minecart;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A minecart.
|
* A minecart.
|
||||||
@ -45,6 +46,44 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
|
|||||||
return minecart.a;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftMinecart";
|
return "CraftMinecart";
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren