mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 13:36:44 +01:00
Update calls to DyeColor getData and getByData. Addresses BUKKIT-2786
These two methods are now deprecated and replaced by the strictly equivalent calls using wool data.
This commit is contained in:
parent
baaf8e1d86
commit
182681e384
4 changed files with 7 additions and 7 deletions
|
@ -188,7 +188,7 @@ public class ItemDye extends Item {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = (byte) event.getColor().getData();
|
i = (byte) event.getColor().getWoolData();
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
entitysheep.setColor(i);
|
entitysheep.setColor(i);
|
||||||
|
|
|
@ -13,11 +13,11 @@ public class CraftSheep extends CraftAnimals implements Sheep {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DyeColor getColor() {
|
public DyeColor getColor() {
|
||||||
return DyeColor.getByData((byte) getHandle().getColor());
|
return DyeColor.getByWoolData((byte) getHandle().getColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(DyeColor color) {
|
public void setColor(DyeColor color) {
|
||||||
getHandle().setColor(color.getData());
|
getHandle().setColor(color.getWoolData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSheared() {
|
public boolean isSheared() {
|
||||||
|
|
|
@ -30,10 +30,10 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DyeColor getCollarColor() {
|
public DyeColor getCollarColor() {
|
||||||
return DyeColor.getByData((byte) getHandle().getCollarColor());
|
return DyeColor.getByWoolData((byte) getHandle().getCollarColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCollarColor(DyeColor color) {
|
public void setCollarColor(DyeColor color) {
|
||||||
getHandle().setCollarColor(color.getData());
|
getHandle().setCollarColor(color.getWoolData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class DyeColorsTest extends AbstractTestingBase {
|
||||||
@Test
|
@Test
|
||||||
public void checkColor() {
|
public void checkColor() {
|
||||||
Color color = dye.getColor();
|
Color color = dye.getColor();
|
||||||
float[] nmsColorArray = EntitySheep.d[dye.getData()];
|
float[] nmsColorArray = EntitySheep.d[dye.getWoolData()];
|
||||||
Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255));
|
Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255));
|
||||||
assertThat(color, is(nmsColor));
|
assertThat(color, is(nmsColor));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class DyeColorsTest extends AbstractTestingBase {
|
||||||
@Test
|
@Test
|
||||||
public void checkFireworkColor() {
|
public void checkFireworkColor() {
|
||||||
Color color = dye.getFireworkColor();
|
Color color = dye.getFireworkColor();
|
||||||
int nmsColor = ItemDye.b[dye.getData()];
|
int nmsColor = ItemDye.b[dye.getWoolData()];
|
||||||
assertThat(color, is(Color.fromRGB(nmsColor)));
|
assertThat(color, is(Color.fromRGB(nmsColor)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue