Expand EnderSignal API

This commit is contained in:
Senmori 2018-02-03 17:48:41 +11:00 committed by md_5
parent 015bda4b7d
commit 1c40a81828
2 changed files with 55 additions and 1 deletions

View file

@ -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);

View file

@ -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;
}
@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
}
}