【发布时间】:2017-10-06 22:15:01
【问题描述】:
这是我的搜索代码:
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() 返回什么?