0
是否有可能以某种方式压缩这两个环路?Ive有加倍他们,因为与受第一循环压缩此编码?
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++;
}
}
为什么这里不是一个if-else的工作? –
因为使用count var的方式,它被用作抵消任务操作执行的方式,所以我只是不确定最好的方式去做什么 – clienthax
@HarshalPandya,因为显然有一个错误系统需要将非固体块放在后面,因为它们没有正确连接。 – ObieMD5