structure lag, booyah

This commit is contained in:
gnembon committed 2020-06-23 00:34:53 -03:00
1 parent 5665aff67d
commit 0e88f37b13
1 file changed
+17
@@ -105,6 +105,7 @@ import net.minecraft.stat.Stat;
import net.minecraft.stat.StatType;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.Property;
import net.minecraft.structure.StructureFeatures;
import net.minecraft.structure.StructurePiece;
import net.minecraft.structure.StructureStart;
import net.minecraft.text.LiteralText;
@@ -123,6 +124,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.StructureFeature;
import net.minecraft.world.poi.PointOfInterest;
@@ -353,6 +355,18 @@ public class CarpetExpression
return MapValue.wrap(ret);
}
private static long lastSeed = -1;
private void BooYah(ChunkGenerator generator)
{
synchronized (generator)
{
if (generator.getSeed() != lastSeed)
{
StructureFeatures.STRONGHOLD.shouldStartAt(null, generator, null, 0, 0, null);
lastSeed = generator.getSeed();
}
}
}
private void API_BlockManipulation()
{
this.expr.addLazyFunction("block", -1, (c, t, lv) ->
@@ -1135,6 +1149,9 @@ public class CarpetExpression
BlockArgument locator = BlockArgument.findIn(cc, lv, 0);
ServerWorld world = cc.s.getWorld();
BooYah(world.getChunkManager().getChunkGenerator());
BlockPos pos = locator.block.getPos();
StructureFeature<?> structure = null;
boolean needSize = false;