From 8222af3e4d423ee1161bb30074cf6ae35c0f2963 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 2 Jan 2011 16:40:27 +0800 Subject: [PATCH] Implemented arrows. --- .../org/bukkit/craftbukkit/CraftArrowEntity.java | 15 +++++++++++++++ .../java/org/bukkit/craftbukkit/CraftWorld.java | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/main/java/org/bukkit/craftbukkit/CraftArrowEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftArrowEntity.java b/src/main/java/org/bukkit/craftbukkit/CraftArrowEntity.java new file mode 100644 index 0000000000..337426d3f9 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/CraftArrowEntity.java @@ -0,0 +1,15 @@ +package org.bukkit.craftbukkit; + +import org.bukkit.ArrowEntity; +import net.minecraft.server.EntityArrow; + +/** + * Represents an arrow. + * + * @author sk89q + */ +public class CraftArrowEntity extends CraftEntity implements ArrowEntity { + CraftArrowEntity(CraftServer server, EntityArrow entity) { + super(server, entity); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 322065f265..5e00cbf89a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -4,8 +4,13 @@ package org.bukkit.craftbukkit; import java.util.HashMap; import java.util.Map; import net.minecraft.server.WorldServer; +import net.minecraft.server.EntityArrow; + +import org.bukkit.ArrowEntity; import org.bukkit.Block; import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.Vector; import org.bukkit.World; public class CraftWorld implements World { @@ -70,6 +75,16 @@ public class CraftWorld implements World { return world; } + @Override + public ArrowEntity spawnArrow(Location loc, Vector velocity, float speed, + float spread) { + EntityArrow arrow = new EntityArrow(world); + arrow.c(loc.getX(), loc.getY(), loc.getZ()); + world.a(arrow); + arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread); + return new CraftArrowEntity(world.getServer(), arrow); + } + @Override public String toString() { return "CraftWorld";