Merge branch 'master' into 1.16

# Conflicts:
#	src/main/java/carpet/script/CarpetExpression.java
This commit is contained in:
gnembon committed 2020-07-01 14:54:04 -03:00
commit c69f65e68e
8 files changed
+48 -8

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ import static carpet.settings.RuleCategory.CLIENT;
@SuppressWarnings("CanBeFinal")
public class CarpetSettings
{
public static final String carpetVersion = "1.4.0+v200623";
public static final String carpetVersion = "1.4.1+v200701";
public static final Logger LOG = LogManager.getLogger();
public static boolean skipGenerationChecks = false;
public static boolean impendingFillSkipUpdates = false;
@@ -9,5 +9,7 @@ public interface ThreadedAnvilChunkStorageInterface
{
Map<String, Integer> regenerateChunkRegion(List<ChunkPos> requestedChunks);
void relightChunk(ChunkPos pos);
void releaseRelightTicket(ChunkPos pos);
}
@@ -229,6 +229,31 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem
return future.join();
}
@Override
public void relightChunk(ChunkPos pos)
{
this.addTicket(pos);
this.tickTicketManager();
if (this.currentChunkHolders.get(pos.toLong()).getCompletedChunk() == null) // chunk unloaded
if (WorldTools.canHasChunk(this.world, pos, null, true))
this.currentChunkHolders.get(pos.toLong()).createFuture(ChunkStatus.EMPTY, (ThreadedAnvilChunkStorage) (Object) this);
final Chunk chunk = this.getCurrentChunk(pos);
if (!(chunk.getStatus().isAtLeast(ChunkStatus.LIGHT.getPrevious()))) return;
((ServerLightingProviderInterface) this.serverLightingProvider).removeLightData(chunk);
this.addRelightTicket(pos);
final CompletableFuture<?> lightFuture = this.createChunkRegionFuture(pos, 1, (pos_) -> ChunkStatus.LIGHT)
.thenCompose(
either -> either.map(
list -> ((ServerLightingProviderInterface) this.serverLightingProvider).relight(chunk),
unloaded -> {
this.releaseRelightTicket(pos);
return CompletableFuture.completedFuture(null);
}
)
);
this.waitFor(lightFuture);
}
@Override
public Map<String, Integer> regenerateChunkRegion(final List<ChunkPos> requestedChunksList)
{
@@ -3196,9 +3196,8 @@ public class CarpetExpression
BlockArgument locator = BlockArgument.findIn(cc, lv, 0);
BlockPos pos = locator.block.getPos();
ServerWorld world = cc.s.getWorld();
((ServerLightingProviderInterface)world.getChunkManager().getLightingProvider()).resetLight(world.getChunk(pos), new ChunkPos(pos)); //light(world.getChunk(pos), false);
((ThreadedAnvilChunkStorageInterface) world.getChunkManager().threadedAnvilChunkStorage).relightChunk(new ChunkPos(pos));
forceChunkUpdate(pos, world);
world.getChunkManager().getLightingProvider().light(world.getChunk(pos), false);
return LazyValue.TRUE;
});