這是我的搜索代碼:插口改變染色陶土色
for(int x = -100; x < 100; x ++)
{
for(int z = -100; z < 100; z ++)
{
for(int y = 0; y < 50; y ++)
{
Location loc = new Location(Bukkit.getWorld(map_name), x, y, z);
Block block = loc.getBlock();
if(block.getType()
.equals(ConstantsManager.ground_material))
{
if(block.getType().getData()
.equals(ConstantsManager.ground_redId))
orig_redClay.add(block);
if(block.getType().getData()
.equals(ConstantsManager.ground_blueId))
orig_blueClay.add(block);
}
}
}
}
在靜態類ConstantsManager
public static final Material ground_material = Material.STAINED_CLAY;
public static final int ground_blueId = 3;
public static final int ground_redId = 14;
它應該通過100 * 50 * 100的體積爲紅色或藍色搜索弄髒粘土,爲ConstantsManager調用材質和顏色值。該代碼能夠檢測塊是否粘土,但無法檢測到它是紅色還是藍色。我可以在我的代碼中更改哪些內容以檢測粘土顏色?
什麼的getData()返回? –