mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 11:45:52 -07:00
Clarify dye and wool color datas in DyeColor. Addresses BUKKIT-2786
DyeColor used the wool data for getData(), which is very misleading based on class name. The old method has been deprecated and replaced with getWoolData() and getDyeData() for the appropriate types of data values. The MaterialData classes Dye and Wool were updated appropriately, especially Dye innapropriately using a DyeColor data value compensation. Unit tests were added for the new methods, as well as the getColor on Dye and Wool. By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
@@ -33,7 +33,7 @@ public class Dye extends MaterialData implements Colorable {
|
||||
* @return DyeColor of this dye
|
||||
*/
|
||||
public DyeColor getColor() {
|
||||
return DyeColor.getByData((byte) (15 - getData()));
|
||||
return DyeColor.getByDyeData(getData());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ public class Dye extends MaterialData implements Colorable {
|
||||
* @param color New color of this dye
|
||||
*/
|
||||
public void setColor(DyeColor color) {
|
||||
setData((byte) (15 - color.getData()));
|
||||
setData(color.getDyeData());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -38,7 +38,7 @@ public class Wool extends MaterialData implements Colorable {
|
||||
* @return DyeColor of this dye
|
||||
*/
|
||||
public DyeColor getColor() {
|
||||
return DyeColor.getByData(getData());
|
||||
return DyeColor.getByWoolData(getData());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public class Wool extends MaterialData implements Colorable {
|
||||
* @param color New color of this dye
|
||||
*/
|
||||
public void setColor(DyeColor color) {
|
||||
setData(color.getData());
|
||||
setData(color.getWoolData());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user