Added get/set owner name, set color/style id to horse watcher

This commit is contained in:
Andrew 2013-11-06 21:05:00 +13:00
parent 86169422a7
commit 31074f93a7

View File

@ -2,13 +2,11 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import java.util.Random;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
public class HorseWatcher extends AgeableWatcher {
public HorseWatcher(Disguise disguise) {
@ -64,11 +62,25 @@ public class HorseWatcher extends AgeableWatcher {
setFlag(8, true);
}
public String getOwnerName() {
return (String) getValue(21, "");
}
public void setOwnerName(String name) {
setValue(21, name);
sendData(21);
}
public void setColor(Color color) {
setValue(20, color.ordinal() & 0xFF | getStyle().ordinal() << 8);
sendData(20);
}
public void setColorId(int color) {
setValue(20, color & 0xFF | getStyle().ordinal() << 8);
sendData(20);
}
private void setFlag(int i, boolean flag) {
int j = (Integer) getValue(16, (byte) 0);
if (flag) {
@ -100,6 +112,11 @@ public class HorseWatcher extends AgeableWatcher {
sendData(20);
}
public void setStyleId(int style) {
setValue(20, getColor().ordinal() & 0xFF | style << 8);
sendData(20);
}
public void setTamed(boolean tamed) {
setFlag(2, tamed);
}