SPIGOT-6373: Add getAttachedFace and setAttachedFace to the Shulker API

By: Julian van den Berkmortel <julianvdberkmortel@outlook.com>
This commit is contained in:
CraftBukkit/Spigot
2021-04-28 11:52:30 +10:00
parent c5af0704d0
commit 0989d371a0
2 changed files with 21 additions and 1 deletions

View File

@@ -3,7 +3,9 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.world.entity.monster.EntityShulker;
import org.bukkit.DyeColor;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Shulker;
@@ -48,4 +50,16 @@ public class CraftShulker extends CraftGolem implements Shulker {
Preconditions.checkArgument(value >= 0 && value <= 1, "value needs to be in between or equal to 0 and 1");
getHandle().a((int) (value * 100)); // PAIL rename setPeek
}
@Override
public BlockFace getAttachedFace() {
return CraftBlock.notchToBlockFace(getHandle().eL()); // PAIL rename getAttachedFace
}
@Override
public void setAttachedFace(BlockFace face) {
Preconditions.checkNotNull(face, "face cannot be null");
Preconditions.checkArgument(face.isCartesian(), "%s is not a valid block face to attach a shulker to, a cartesian block face is expected", face);
getHandle().getDataWatcher().set(EntityShulker.b, CraftBlock.blockFaceToNotch(face));
}
}