summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenmori <thesenmori@gmail.com>2018-02-03 17:48:41 +1100
committermd_5 <git@md-5.net>2018-02-03 17:48:41 +1100
commit1c40a81828adf0214b19ba7cb0de935dd4e09d54 (patch)
tree00cb7a0df6ffa02d2db6224c313d1c916ebd7704
parent015bda4b7d4849e4036193411dfef3007afef24e (diff)
downloadcraftbukkit-1c40a81828adf0214b19ba7cb0de935dd4e09d54.tar
craftbukkit-1c40a81828adf0214b19ba7cb0de935dd4e09d54.tar.gz
craftbukkit-1c40a81828adf0214b19ba7cb0de935dd4e09d54.tar.lz
craftbukkit-1c40a81828adf0214b19ba7cb0de935dd4e09d54.tar.xz
craftbukkit-1c40a81828adf0214b19ba7cb0de935dd4e09d54.zip
Expand EnderSignal API
-rw-r--r--nms-patches/EntityEnderSignal.patch19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java37
2 files changed, 55 insertions, 1 deletions
diff --git a/nms-patches/EntityEnderSignal.patch b/nms-patches/EntityEnderSignal.patch
new file mode 100644
index 00000000..b611b974
--- /dev/null
+++ b/nms-patches/EntityEnderSignal.patch
@@ -0,0 +1,19 @@
+--- a/net/minecraft/server/EntityEnderSignal.java
++++ b/net/minecraft/server/EntityEnderSignal.java
+@@ -2,11 +2,11 @@
+
+ public class EntityEnderSignal extends Entity {
+
+- private double a;
+- private double b;
+- private double c;
+- private int d;
+- private boolean e;
++ public double a; // CraftBukkit private -> public // PAIL rename targetX
++ public double b; // CraftBukkit private -> public // PAIL rename targetY
++ public double c; // CraftBukkit private -> public // PAIL rename targetZ
++ public int d; // CraftBukkit private -> public // PAIL rename despawnTimer
++ public boolean e; // CraftBukkit private -> public // PAIL rename shouldDropItem
+
+ public EntityEnderSignal(World world) {
+ super(world);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
index e3a5081e..aaa624ae 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
@@ -1,6 +1,9 @@
package org.bukkit.craftbukkit.entity;
+import com.google.common.base.Preconditions;
+import net.minecraft.server.BlockPosition;
import net.minecraft.server.EntityEnderSignal;
+import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.EntityType;
@@ -20,7 +23,39 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
return "CraftEnderSignal";
}
+ @Override
public EntityType getType() {
return EntityType.ENDER_SIGNAL;
}
-} \ No newline at end of file
+
+ @Override
+ public Location getTargetLocation() {
+ return new Location(getWorld(), getHandle().a, getHandle().b, getHandle().c, getHandle().yaw, getHandle().pitch); // PAIL rename targetX, targetY, targetZ
+ }
+
+ @Override
+ public void setTargetLocation(Location location) {
+ Preconditions.checkArgument(getWorld().equals(location.getWorld()), "Cannot target EnderSignal across worlds");
+ getHandle().a(new BlockPosition(location.getX(), location.getY(), location.getZ()));
+ }
+
+ @Override
+ public boolean getDropItem() {
+ return getHandle().e; // PAIL rename getDropItem
+ }
+
+ @Override
+ public void setDropItem(boolean shouldDropItem) {
+ getHandle().e = shouldDropItem; // PAIL rename getDropItem
+ }
+
+ @Override
+ public int getDespawnTimer() {
+ return getHandle().d; // PAIL rename despawnTimer
+ }
+
+ @Override
+ public void setDespawnTimer(int time) {
+ getHandle().d = time; // PAIL rename despawnTimer
+ }
+}