Implement getColor / setColor for Shulker entity

This commit is contained in:
Matthew 2017-04-29 17:11:43 -04:00 committed by md_5
parent a2af8f0a73
commit d9d7552262
2 changed files with 23 additions and 1 deletions

View File

@ -11,6 +11,15 @@
public class EntityShulker extends EntityGolem implements IMonster { public class EntityShulker extends EntityGolem implements IMonster {
@@ -14,7 +18,7 @@
protected static final DataWatcherObject<EnumDirection> a = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.l);
protected static final DataWatcherObject<Optional<BlockPosition>> b = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.k);
protected static final DataWatcherObject<Byte> c = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a);
- protected static final DataWatcherObject<Byte> bw = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a);
+ public static final DataWatcherObject<Byte> 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 @@ @@ -65,7 +69,7 @@
} }

View File

@ -1,7 +1,8 @@
package org.bukkit.craftbukkit.entity; package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityGolem; import com.google.common.base.Preconditions;
import net.minecraft.server.EntityShulker; import net.minecraft.server.EntityShulker;
import org.bukkit.DyeColor;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Shulker; import org.bukkit.entity.Shulker;
@ -21,4 +22,16 @@ public class CraftShulker extends CraftGolem implements Shulker {
public EntityShulker getHandle() { public EntityShulker getHandle() {
return (EntityShulker) entity; 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());
}
} }