是否有可能以某种方式压缩这两个循环?,我不得不将它们加倍,因为第二个循环处理第一个循环忽略的块
int count = 1;
for(int y = 0; y < cuboidClipboard.getHeight(); y++)
for(int x = 0; x < cuboidClipboard.getWidth(); x++)
for(int z = 0; z < cuboidClipboard.getLength(); z++)
{
BaseBlock baseBlock = cuboidClipboard.getPoint(new Vector(x, y, z));
Vector relativeVector = new Vector(x,y,z).add(orign);
Block buildBlock = world.getBlockAt(relativeVector.getBlockX(), relativeVector.getBlockY(), relativeVector.getBlockZ());
if(Material.getMaterial(baseBlock.getId()).isSolid())
if(buildBlock.getTypeId() != baseBlock.getId())
{
new PopBlockTask(buildBlock, world, baseBlock).runTaskLater(this, 20+(count*2));
count++;
}
}
//we need to place non solid blocks last because they don't attach properly when theres no blocks around them
for(int y = 0; y < cuboidClipboard.getHeight(); y++)
for(int x = 0; x < cuboidClipboard.getWidth(); x++)
for(int z = 0; z < cuboidClipboard.getLength(); z++)
{
BaseBlock baseBlock = cuboidClipboard.getPoint(new Vector(x, y, z));
Vector relativeVector = new Vector(x,y,z).add(orign);
Block buildBlock = world.getBlockAt(relativeVector.getBlockX(), relativeVector.getBlockY(), relativeVector.getBlockZ());
if(!Material.getMaterial(baseBlock.getId()).isSolid())
if(buildBlock.getTypeId() != baseBlock.getId())
{
new PopBlockTask(buildBlock, world, baseBlock).runTaskLater(this, 20+(count*2));
count++;
}
}