Fix shulker color and playing sounds

This commit is contained in:
fullwall 2018-03-26 14:39:28 +08:00
parent 33568b24c2
commit 4da3153cdd
3 changed files with 7 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import net.citizensnpcs.util.NMS;
public class ShulkerTrait extends Trait {
@Persist("color")
private DyeColor color = DyeColor.PURPLE;
private int lastPeekSet = 0;
@Persist("peek")
private int peek = 0;
@ -30,7 +31,10 @@ public class ShulkerTrait extends Trait {
color = DyeColor.PURPLE;
}
if (npc.getEntity() instanceof Shulker) {
NMS.setShulkerPeek((Shulker) npc.getEntity(), peek);
if (peek != lastPeekSet) {
NMS.setShulkerPeek((Shulker) npc.getEntity(), peek);
lastPeekSet = peek;
}
NMS.setShulkerColor((Shulker) npc.getEntity(), color);
}
}

View File

@ -196,7 +196,7 @@ public class ShulkerController extends MobEntityController {
}
public void setColor(DyeColor color) {
this.datawatcher.set(bw, color.getDyeData());
this.datawatcher.set(bw, color.getWoolData());
}
@Override

View File

@ -963,7 +963,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void setShulkerColor(Shulker shulker, DyeColor color) {
((EntityShulker) getHandle(shulker)).getDataWatcher().set(EntityShulker.COLOR, color.getDyeData());
((EntityShulker) getHandle(shulker)).getDataWatcher().set(EntityShulker.COLOR, color.getWoolData());
}
@Override