这是我的搜索代码:插口改变染色陶土色
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()返回? –