Limit the setId to the values length on horse and ocelot

This commit is contained in:
Andrew 2013-11-18 04:43:42 +13:00
parent c2ebe0d347
commit e0240c1044
2 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ public class HorseWatcher extends AgeableWatcher {
}
public void setColorId(int color) {
setValue(20, color & 0xFF | getStyle().ordinal() << 8);
setValue(20, (color % Color.values().length) & 0xFF | getStyle().ordinal() << 8);
sendData(20);
}
@ -123,7 +123,7 @@ public class HorseWatcher extends AgeableWatcher {
}
public void setStyleId(int style) {
setValue(20, getColor().ordinal() & 0xFF | style << 8);
setValue(20, getColor().ordinal() & 0xFF | (style % Style.values().length) << 8);
sendData(20);
}

View File

@ -40,7 +40,7 @@ public class OcelotWatcher extends AgeableWatcher {
}
public void setTypeId(int type) {
setValue(18, (byte) type);
setValue(18, (byte) (type % Type.values().length));
sendData(18);
}
}