geforkt von Mirrors/Paper
1358d1e914
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 881e06e5 PR-725: Add Item Unlimited Lifetime APIs CraftBukkit Changes: 74c08312 SPIGOT-6962: Call EntityChangeBlockEvent when when FallingBlockEntity starts to fall 64db5126 SPIGOT-6959: Make /loot command ignore empty items for spawn 2d760831 Increase outdated build delay 9ed7e4fb SPIGOT-6138, SPIGOT-6415: Don't call CreatureSpawnEvent after cross-dimensional travel fc4ad813 SPIGOT-6895: Trees grown with applyBoneMeal() don't fire the StructureGrowthEvent 59733a2e SPIGOT-6961: Actually return a copy of the ItemMeta Spigot Changes: ffceeae3 SPIGOT-6956: Drop unload queue patch as attempt at fixing stop issue e19ddabd PR-1011: Add Item Unlimited Lifetime APIs 34d40b0e SPIGOT-2942: give command fires PlayerDropItemEvent, cancelling it causes Item Duplication
54 Zeilen
3.1 KiB
Diff
54 Zeilen
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Mon, 23 Aug 2021 04:50:05 -0700
|
|
Subject: [PATCH] Always parse protochunk light sources unless it is marked as
|
|
non-lit
|
|
|
|
Chunks not marked as lit will always go through the light engine,
|
|
so they should always have their block sources parsed.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
|
index 54ade15cdab222e9818f2635a8a12418e78e1ce6..887b3bc6370d23d2ff38e8fdbe286d678b035cc7 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
|
@@ -312,16 +312,33 @@ public class ChunkSerializer {
|
|
BelowZeroRetrogen belowzeroretrogen = protochunk.getBelowZeroRetrogen();
|
|
boolean flag2 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT);
|
|
|
|
- if (!flag && flag2) {
|
|
- Iterator iterator = BlockPos.betweenClosed(chunkPos.getMinBlockX(), world.getMinBuildHeight(), chunkPos.getMinBlockZ(), chunkPos.getMaxBlockX(), world.getMaxBuildHeight() - 1, chunkPos.getMaxBlockZ()).iterator();
|
|
+ if (!flag) { // Paper - fix incorrect parsing of blocks that emit light - it should always parse it, unless the chunk is marked as lit
|
|
+ // Paper start - let's make sure the implementation isn't as slow as possible
|
|
+ int offX = chunkPos.x << 4;
|
|
+ int offZ = chunkPos.z << 4;
|
|
+
|
|
+ int minChunkSection = io.papermc.paper.util.WorldUtil.getMinSection(world);
|
|
+ int maxChunkSection = io.papermc.paper.util.WorldUtil.getMaxSection(world);
|
|
+
|
|
+ LevelChunkSection[] sections = achunksection;
|
|
+ for (int sectionY = minChunkSection; sectionY <= maxChunkSection; ++sectionY) {
|
|
+ LevelChunkSection section = sections[sectionY - minChunkSection];
|
|
+ if (section == null || section.hasOnlyAir()) {
|
|
+ // no sources in empty sections
|
|
+ continue;
|
|
+ }
|
|
+ int offY = sectionY << 4;
|
|
|
|
- while (iterator.hasNext()) {
|
|
- BlockPos blockposition = (BlockPos) iterator.next();
|
|
+ for (int index = 0; index < (16 * 16 * 16); ++index) {
|
|
+ if (section.states.get(index).getLightEmission() <= 0) {
|
|
+ continue;
|
|
+ }
|
|
|
|
- if (((ChunkAccess) object).getBlockState(blockposition).getLightEmission() != 0) {
|
|
- protochunk.addLight(blockposition);
|
|
+ // index = x | (z << 4) | (y << 8)
|
|
+ protochunk.addLight(new BlockPos(offX | (index & 15), offY | (index >>> 8), offZ | ((index >>> 4) & 15)));
|
|
}
|
|
}
|
|
+ // Paper end
|
|
}
|
|
}
|
|
|