Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-30 18:10:06 +01:00
Add getFacing method to get the current cardinal direction an entity is facing.
Dieser Commit ist enthalten in:
Ursprung
3037eb3e7c
Commit
ee5efeb0dc
@ -13,9 +13,11 @@ import org.bukkit.EntityEffect;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.PistonMoveReaction;
|
import org.bukkit.block.PistonMoveReaction;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
@ -720,6 +722,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return PistonMoveReaction.getById(getHandle().getPushReaction().ordinal());
|
return PistonMoveReaction.getById(getHandle().getPushReaction().ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockFace getFacing() {
|
||||||
|
// Use this method over getDirection because it handles boats and minecarts.
|
||||||
|
return CraftBlock.notchToBlockFace(getHandle().getAdjustedDirection());
|
||||||
|
}
|
||||||
|
|
||||||
protected NBTTagCompound save() {
|
protected NBTTagCompound save() {
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren