Implement EndGateway#getExitLocation and EndGateway#setExitLocation(Location)

This commit is contained in:
Matthew 2016-03-16 19:56:48 -04:00 committed by md_5
parent f09f7d8754
commit a12b1a4770

View File

@ -1,6 +1,8 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.EntityEnderCrystal;
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.EntityType;
@ -20,6 +22,23 @@ public class CraftEnderCrystal extends CraftEntity implements EnderCrystal {
getHandle().a(showing); // PAIL: Rename setShowingBottom
}
@Override
public Location getBeamTarget() {
BlockPosition pos = getHandle().j(); // PAIL: Rename getBeamTarget
return pos == null ? null : new Location(getWorld(), pos.getX(), pos.getY(), pos.getZ());
}
@Override
public void setBeamTarget(Location location) {
if (location == null) {
getHandle().a((BlockPosition) null); // PAIL: Rename setBeamTarget
} else if (location.getWorld() != getWorld()) {
throw new IllegalArgumentException("Cannot set beam target location to different world");
} else {
getHandle().a(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
}
}
@Override
public EntityEnderCrystal getHandle() {
return (EntityEnderCrystal) entity;