fix
This commit is contained in:
1 parent
7447129d92
commit
524cb62803
1 file changed
+7
-5
@@ -344,7 +344,7 @@ public class CarpetExpression
|
|||||||
return pcount;
|
return pcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forceChunkUpdate(BlockPos pos, ServerWorld world)
|
private static void forceChunkUpdate(BlockPos pos, ServerWorld world)
|
||||||
{
|
{
|
||||||
Chunk chunk = world.getChunk(pos);
|
Chunk chunk = world.getChunk(pos);
|
||||||
chunk.setShouldSave(true);
|
chunk.setShouldSave(true);
|
||||||
@@ -1135,13 +1135,15 @@ public class CarpetExpression
|
|||||||
BlockPos pos = locator.block.getPos();
|
BlockPos pos = locator.block.getPos();
|
||||||
Chunk chunk = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.BIOMES);
|
Chunk chunk = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.BIOMES);
|
||||||
((BiomeArrayInterface)chunk.getBiomeArray()).setBiomeAtIndex(pos, world, biome);
|
((BiomeArrayInterface)chunk.getBiomeArray()).setBiomeAtIndex(pos, world, biome);
|
||||||
if (doImmediateUpdate) this.forceChunkUpdate(pos, world);
|
if (doImmediateUpdate) forceChunkUpdate(pos, world);
|
||||||
return LazyValue.TRUE;
|
return LazyValue.TRUE;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.expr.addLazyFunction("reload_chunk", -1, (c, t, lv) -> {
|
this.expr.addLazyFunction("reload_chunk", -1, (c, t, lv) -> {
|
||||||
CarpetContext cc = (CarpetContext)c;
|
CarpetContext cc = (CarpetContext)c;
|
||||||
this.forceChunkUpdate(BlockArgument.findIn(cc, lv, 0).block.getPos(), cc.s.getWorld());
|
BlockPos pos = BlockArgument.findIn(cc, lv, 0).block.getPos();
|
||||||
|
ServerWorld world = cc.s.getWorld();
|
||||||
|
cc.s.getMinecraftServer().submitAndJoin( () -> forceChunkUpdate(pos, world));
|
||||||
return LazyValue.TRUE;
|
return LazyValue.TRUE;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1361,7 +1363,7 @@ public class CarpetExpression
|
|||||||
{
|
{
|
||||||
if (world.getChunk(chpos.x, chpos.z, ChunkStatus.FULL, false) != null)
|
if (world.getChunk(chpos.x, chpos.z, ChunkStatus.FULL, false) != null)
|
||||||
{
|
{
|
||||||
this.forceChunkUpdate(chpos.getCenterBlockPos(), world);
|
forceChunkUpdate(chpos.getCenterBlockPos(), world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result[0] = MapValue.wrap(report.entrySet().stream().collect(Collectors.toMap(
|
result[0] = MapValue.wrap(report.entrySet().stream().collect(Collectors.toMap(
|
||||||
@@ -2978,7 +2980,7 @@ public class CarpetExpression
|
|||||||
if (res == null)
|
if (res == null)
|
||||||
return;
|
return;
|
||||||
if (what.equalsIgnoreCase("boulder")) // there might be more of those
|
if (what.equalsIgnoreCase("boulder")) // there might be more of those
|
||||||
this.forceChunkUpdate(locator.block.getPos(), ((CarpetContext) c).s.getWorld());
|
forceChunkUpdate(locator.block.getPos(), ((CarpetContext) c).s.getWorld());
|
||||||
result[0] = new NumericValue(res);
|
result[0] = new NumericValue(res);
|
||||||
});
|
});
|
||||||
Value ret = result[0]; // preventing from lazy evaluating of the result in case a future completes later
|
Value ret = result[0]; // preventing from lazy evaluating of the result in case a future completes later
|
||||||
|
|||||||
Reference in new issue
Block a user