From 6d6668aaeb785b204e53e67d68261207e66c9230 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 7 Jan 2011 14:01:37 -0800 Subject: Implemented World.spawnBoat(), added CraftMappable interface that defines a method to get an org.bukkit.craftbukkit.CraftEntity from implementing net.minecart.server.Entity entities, changed CraftWorld.toCraftEntity() to use this new interface for boats and minecarts. --- src/main/java/net/minecraft/server/EntityBoat.java | 10 ++++++++-- src/main/java/net/minecraft/server/EntityMinecart.java | 12 +++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/main/java/net') diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 528b1817..92412d95 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -4,6 +4,8 @@ import java.util.List; import org.bukkit.Location; import org.bukkit.craftbukkit.CraftBoat; +import org.bukkit.craftbukkit.CraftEntity; +import org.bukkit.craftbukkit.CraftMappable; import org.bukkit.craftbukkit.CraftMinecart; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; @@ -13,9 +15,9 @@ import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; import org.bukkit.event.vehicle.VehicleMoveEvent; -public class EntityBoat extends Entity { +public class EntityBoat extends Entity implements CraftMappable { - public CraftBoat boat; + private CraftBoat boat; public int a; public int b; @@ -27,6 +29,10 @@ public class EntityBoat extends Entity { private double ak; private double al; + public CraftEntity getCraftEntity() { + return boat; + } + public EntityBoat(World world) { super(world); a = 0; diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index a590fa2c..5b5437f0 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -4,15 +4,17 @@ import java.util.List; import org.bukkit.Location; import org.bukkit.Vector; +import org.bukkit.craftbukkit.CraftEntity; +import org.bukkit.craftbukkit.CraftMappable; import org.bukkit.craftbukkit.CraftMinecart; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.vehicle.*; public class EntityMinecart extends Entity - implements IInventory { + implements IInventory, CraftMappable { - public CraftMinecart minecart; + private CraftMinecart minecart; private ItemStack ak[]; public int a; @@ -99,7 +101,11 @@ public class EntityMinecart extends Entity private double derailedZ = 0.5; private double flyingX = 0.94999998807907104; private double flyingY = 0.94999998807907104; - private double flyingZ = 0.94999998807907104; + private double flyingZ = 0.94999998807907104; + + public CraftEntity getCraftEntity() { + return minecart; + } public EntityMinecart(World world) { super(world); -- cgit v1.2.3