From f965ee5c7f66c5eefec8d26941810171057b5ffd Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 29 Apr 2017 17:11:43 -0400 Subject: [PATCH] Implement getColor / setColor for Shulker entity By: Matthew --- paper-server/nms-patches/EntityShulker.patch | 9 +++++++++ .../bukkit/craftbukkit/entity/CraftShulker.java | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/paper-server/nms-patches/EntityShulker.patch b/paper-server/nms-patches/EntityShulker.patch index 750f38f0df..c1482b16ca 100644 --- a/paper-server/nms-patches/EntityShulker.patch +++ b/paper-server/nms-patches/EntityShulker.patch @@ -11,6 +11,15 @@ public class EntityShulker extends EntityGolem implements IMonster { +@@ -14,7 +18,7 @@ + protected static final DataWatcherObject a = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.l); + protected static final DataWatcherObject> b = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.k); + protected static final DataWatcherObject c = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a); +- protected static final DataWatcherObject bw = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a); ++ public static final DataWatcherObject bw = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a); // PAIL: protected -> public, rename COLOR + public static final EnumColor bx = EnumColor.PURPLE; + private float bA; + private float bB; @@ -65,7 +69,7 @@ } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java index eef9d3c56c..e8cb697aa3 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java @@ -1,7 +1,8 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityGolem; +import com.google.common.base.Preconditions; import net.minecraft.server.EntityShulker; +import org.bukkit.DyeColor; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Shulker; @@ -21,4 +22,16 @@ public class CraftShulker extends CraftGolem implements Shulker { public EntityShulker getHandle() { return (EntityShulker) entity; } + + @Override + public DyeColor getColor() { + return DyeColor.getByWoolData(getHandle().getDataWatcher().get(EntityShulker.bw)); + } + + @Override + public void setColor(DyeColor color) { + Preconditions.checkArgument(color != null, "color"); + + getHandle().getDataWatcher().set(EntityShulker.bw, color.getWoolData()); + } }