mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Moved CraftVehicle.*Velocity() to CraftEntity as velocity is a component of all entities.
By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
parent
76d5da14fd
commit
4db1faa590
@ -4,6 +4,7 @@ package org.bukkit.craftbukkit;
|
|||||||
import net.minecraft.server.Entity;
|
import net.minecraft.server.Entity;
|
||||||
import net.minecraft.server.WorldServer;
|
import net.minecraft.server.WorldServer;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Vector;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
public abstract class CraftEntity implements org.bukkit.Entity {
|
public abstract class CraftEntity implements org.bukkit.Entity {
|
||||||
@ -19,6 +20,16 @@ public abstract class CraftEntity implements org.bukkit.Entity {
|
|||||||
return new Location(getWorld(), entity.p, entity.q, entity.r, entity.v, entity.w);
|
return new Location(getWorld(), entity.p, entity.q, entity.r, entity.v, entity.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector getVelocity() {
|
||||||
|
return new Vector(entity.s, entity.t, entity.u);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVelocity(Vector vel) {
|
||||||
|
entity.s = vel.getX();
|
||||||
|
entity.t = vel.getY();
|
||||||
|
entity.u = vel.getZ();
|
||||||
|
}
|
||||||
|
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return ((WorldServer)entity.l).getWorld();
|
return ((WorldServer)entity.l).getWorld();
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,8 @@ import org.bukkit.Vehicle;
|
|||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
||||||
private net.minecraft.server.Entity vehicle;
|
|
||||||
|
|
||||||
public CraftVehicle(CraftServer server, net.minecraft.server.Entity entity) {
|
public CraftVehicle(CraftServer server, net.minecraft.server.Entity entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
vehicle = entity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity getPassenger() {
|
public Entity getPassenger() {
|
||||||
@ -24,14 +21,4 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
|||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return getHandle().j == null;
|
return getHandle().j == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector getVelocity() {
|
|
||||||
return new Vector(vehicle.s, vehicle.t, vehicle.u);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVelocity(Vector vel) {
|
|
||||||
vehicle.s = vel.getX();
|
|
||||||
vehicle.t = vel.getY();
|
|
||||||
vehicle.u = vel.getZ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user