Fix llama unable to remove carpet, not sure if null is a valid arg tho

This commit is contained in:
libraryaddict 2021-05-16 12:26:12 +12:00
parent 1eb5225389
commit 98b6aa0185

View File

@ -21,8 +21,16 @@ public class LlamaWatcher extends ChestedHorseWatcher {
return Llama.Color.values()[getData(MetaIndex.LLAMA_COLOR)]; return Llama.Color.values()[getData(MetaIndex.LLAMA_COLOR)];
} }
public DyeColor getCarpet() {
if (!hasValue(MetaIndex.LLAMA_CARPET) || getData(MetaIndex.LLAMA_CARPET) == -1) {
return null;
}
return AnimalColor.getColorByWool(getData(MetaIndex.LLAMA_CARPET)).getDyeColor();
}
public void setCarpet(DyeColor dyeColor) { public void setCarpet(DyeColor dyeColor) {
setData(MetaIndex.LLAMA_CARPET, (int) dyeColor.getWoolData()); setData(MetaIndex.LLAMA_CARPET, dyeColor == null ? -1 : (int) dyeColor.getWoolData());
sendData(MetaIndex.LLAMA_CARPET); sendData(MetaIndex.LLAMA_CARPET);
} }
@ -31,14 +39,6 @@ public class LlamaWatcher extends ChestedHorseWatcher {
setCarpet(color.getDyeColor()); setCarpet(color.getDyeColor());
} }
public DyeColor getCarpet() {
if (!hasValue(MetaIndex.LLAMA_CARPET)) {
return null;
}
return AnimalColor.getColorByWool(getData(MetaIndex.LLAMA_CARPET)).getDyeColor();
}
public void setStrength(int strength) { public void setStrength(int strength) {
setData(MetaIndex.LLAMA_STRENGTH, strength); setData(MetaIndex.LLAMA_STRENGTH, strength);
sendData(MetaIndex.LLAMA_STRENGTH); sendData(MetaIndex.LLAMA_STRENGTH);