mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Implemented boat, fixed some event issues with minecarts, and implemented the events for boats that were implemented for minecarts.
By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
parent
e44031b5c4
commit
76d5da14fd
@ -0,0 +1,18 @@
|
|||||||
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
|
import net.minecraft.server.EntityBoat;
|
||||||
|
import org.bukkit.Boat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecart.
|
||||||
|
*
|
||||||
|
* @author sk89q
|
||||||
|
*/
|
||||||
|
public class CraftBoat extends CraftVehicle implements Boat {
|
||||||
|
protected EntityBoat boat;
|
||||||
|
|
||||||
|
public CraftBoat(CraftServer server, EntityBoat entity) {
|
||||||
|
super(server, entity);
|
||||||
|
boat = entity;
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
package org.bukkit.craftbukkit;
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
import net.minecraft.server.EntityMinecart;
|
import net.minecraft.server.EntityMinecart;
|
||||||
import org.bukkit.LivingEntity;
|
|
||||||
import org.bukkit.Minecart;
|
import org.bukkit.Minecart;
|
||||||
import org.bukkit.Vector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A minecart.
|
* A minecart.
|
||||||
@ -38,16 +36,6 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
|
|||||||
minecart = entity;
|
minecart = entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector getVelocity() {
|
|
||||||
return new Vector(minecart.s, minecart.t, minecart.u);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVelocity(Vector vel) {
|
|
||||||
minecart.s = vel.getX();
|
|
||||||
minecart.t = vel.getY();
|
|
||||||
minecart.u = vel.getZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDamage(int damage) {
|
public void setDamage(int damage) {
|
||||||
minecart.a = damage;
|
minecart.a = damage;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.bukkit.craftbukkit;
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
import org.bukkit.Entity;
|
import org.bukkit.Entity;
|
||||||
|
import org.bukkit.Vector;
|
||||||
import org.bukkit.Vehicle;
|
import org.bukkit.Vehicle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,8 +10,11 @@ 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() {
|
||||||
@ -20,4 +24,14 @@ 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