From 1ec314e45b2a4336dfe7fbc73870813cd436e2c9 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Tue, 1 Mar 2016 04:39:56 +0100 Subject: [PATCH] Fixed lag during asteroid field generation --- .../java/cr0s/warpdrive/config/filler/Filler.java | 4 +++- .../warpdrive/config/structures/MetaOrbInstance.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/cr0s/warpdrive/config/filler/Filler.java b/src/main/java/cr0s/warpdrive/config/filler/Filler.java index 08a7c232..d75e5565 100644 --- a/src/main/java/cr0s/warpdrive/config/filler/Filler.java +++ b/src/main/java/cr0s/warpdrive/config/filler/Filler.java @@ -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 } diff --git a/src/main/java/cr0s/warpdrive/config/structures/MetaOrbInstance.java b/src/main/java/cr0s/warpdrive/config/structures/MetaOrbInstance.java index 89fb0e43..bcfd62e4 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/MetaOrbInstance.java +++ b/src/main/java/cr0s/warpdrive/config/structures/MetaOrbInstance.java @@ -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; }