use of betterwithaddons.block.BlockWorldScale in project BetterWithAddons by DaedalusGame.
the class TileEntityWorldScaleActive method update.
@Override
public void update() {
//if (!this.worldObj.isRemote)
//{
BlockPos pos = this.getPos();
if (!oldPos.equals(pos)) {
unclaimAllChunks();
claimAllChunks();
setOldPos();
}
if (updateTick++ > UPDATE_TICKRATE) {
ChunkPos chunkpos = new ChunkPos(pos);
claimChunk(chunkpos);
for (int z = -MAX_RANGE; z <= MAX_RANGE; z++) for (int x = -MAX_RANGE; x <= MAX_RANGE; x++) {
if (z == x && x == 0)
continue;
BlockPos newpos = pos.add(x, 0, z);
if (!world.isBlockLoaded(newpos))
continue;
IBlockState blockstate = world.getBlockState(newpos);
ChunkPos newchunk = new ChunkPos(chunkpos.chunkXPos + x, chunkpos.chunkZPos + z);
Block block = blockstate.getBlock();
if (block instanceof BlockWorldScale) {
boolean claimed = claimChunk(newchunk);
if (!world.isRemote)
((BlockWorldScale) block).setCracked(world, newpos, blockstate, !claimed);
} else {
unclaimChunk(newchunk);
}
}
updateTick = 0;
}
//}
}
Aggregations