mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 06:40:19 +08:00
Implement EndGateway#getExitLocation and EndGateway#setExitLocation(Location)
This commit is contained in:
parent
f09f7d8754
commit
a12b1a4770
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user