Fixed lag during asteroid field generation
This commit is contained in:
parent
8a6c5f3e9a
commit
1ec314e45b
2 changed files with 15 additions and 1 deletions
|
@ -6,6 +6,7 @@ import org.w3c.dom.Element;
|
|||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.config.InvalidXmlException;
|
||||
import cr0s.warpdrive.config.XmlRepresentable;
|
||||
import cr0s.warpdrive.data.JumpBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -68,7 +69,8 @@ public class Filler implements XmlRepresentable {
|
|||
}
|
||||
|
||||
public void setBlock(World world, int x, int y, int z) {
|
||||
world.setBlock(x, y, z, block, metadata, 2);
|
||||
JumpBlock.setBlockNoLight(world, x, y, z, block, metadata, 2);
|
||||
// world.setBlock(x, y, z, block, metadata, 2);
|
||||
// TODO set NBT data
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,18 @@ public class MetaOrbInstance extends OrbInstance {
|
|||
addShell(world, new VectorI(x, y2, z).add(location), maxLocalRadius);
|
||||
}
|
||||
|
||||
int minYclamped = Math.max(0, y2 - totalThickness);
|
||||
int maxYclamped = Math.min(255, y2 + totalThickness);
|
||||
for (int xIndex = x - totalThickness; xIndex <= x + totalThickness; xIndex++) {
|
||||
for (int zIndex = z - totalThickness; zIndex <= z + totalThickness; zIndex++) {
|
||||
for (int yIndex = minYclamped; yIndex <= maxYclamped; yIndex++) {
|
||||
if (world.getBlock(xIndex, yIndex, zIndex) != Blocks.air) {
|
||||
world.markBlockForUpdate(xIndex, yIndex, zIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LocalProfiler.stop();
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue