SPIGOT-6388: Add API to get and set the state of the "Shulker" entity

By: Julian van den Berkmortel <julianvdberkmortel@outlook.com>
This commit is contained in:
CraftBukkit/Spigot 2021-04-19 18:47:47 +10:00
parent 8cbaba0a8a
commit 1eb2ceea36

View file

@ -1,5 +1,6 @@
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.craftbukkit.CraftServer;
@ -36,4 +37,15 @@ public class CraftShulker extends CraftGolem implements Shulker {
public void setColor(DyeColor color) {
getHandle().getDataWatcher().set(EntityShulker.COLOR, (color == null) ? 16 : color.getWoolData());
}
@Override
public float getPeek() {
return (float) getHandle().eN() / 100; // PAIL rename getPeek
}
@Override
public void setPeek(float value) {
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
}
}