diff options
Diffstat (limited to 'patches/removed/1.20')
10 files changed, 0 insertions, 688 deletions
diff --git a/patches/removed/1.20/0103-Fix-Old-Sign-Conversion.patch b/patches/removed/1.20/0103-Fix-Old-Sign-Conversion.patch deleted file mode 100644 index 3fbfa6af5a..0000000000 --- a/patches/removed/1.20/0103-Fix-Old-Sign-Conversion.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Fri, 17 Jun 2016 20:50:11 -0400 -Subject: [PATCH] Fix Old Sign Conversion - -1) Sign loading code was trying to parse the JSON before the check for oldSign. - That code could then skip the old sign converting code if it triggers a JSON parse exception. -2) New Mojang Schematic system has Tile Entities in the new converted format, but missing the Bukkit.isConverted flag - This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 63acd109a79ed752a05df3d4f1b99309297c2055..b701a1344db066b9368841f2377ee493514bf282 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -32,6 +32,7 @@ public abstract class BlockEntity { - private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); - public CraftPersistentDataContainer persistentDataContainer; - // CraftBukkit end -+ public boolean isLoadingStructure = false; // Paper - private static final Logger LOGGER = LogUtils.getLogger(); - private final BlockEntityType<?> type; - @Nullable -diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index 15695c9da294caf8531c59f72279aaeda6ceb23b..149728fa6371b4d8b0afaae769aacac27401ea03 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -112,7 +112,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C - s = "\"\""; - } - -- if (oldSign) { -+ if (oldSign && !this.isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted - this.messages[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0]; - continue; - } -diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index 9f2f1d286e887a2c47eb4ac6fdd7f41c595adcaf..2ed4453c7744c1c99210d581af8d68bced4659c6 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -284,7 +284,9 @@ public class StructureTemplate { - definedstructure_blockinfo.nbt.putLong("LootTableSeed", random.nextLong()); - } - -+ tileentity.isLoadingStructure = true; // Paper - tileentity.load(definedstructure_blockinfo.nbt); -+ tileentity.isLoadingStructure = false; // Paper - } - } - diff --git a/patches/removed/1.20/0342-Increase-Light-Queue-Size.patch b/patches/removed/1.20/0342-Increase-Light-Queue-Size.patch deleted file mode 100644 index 3b3f2cd829..0000000000 --- a/patches/removed/1.20/0342-Increase-Light-Queue-Size.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Wed, 8 Apr 2020 21:24:05 -0400 -Subject: [PATCH] Increase Light Queue Size - -Wiz mentioned that large WorldEdit operations cause light to run on -main thread. The queue was small, set to 5.. this bumps it to 20 -but makes it configurable per-world. - -The main risk of increasing this higher is during shutdown, some -queued light updates may be lost because mojang did not flush the -light engine on shutdown... - -The queue size only puts a cap on max loss, doesn't solve that problem. - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9367b999e91d53b742fb161fd9131a2c99e35c6d..2e29d1c3e5faf970bfaf3a545ef3553f284d68ef 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -791,7 +791,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa - this.executeModerately(); - // CraftBukkit end - if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper -- chunkproviderserver.getLightEngine().setTaskPerBatch(5); -+ chunkproviderserver.getLightEngine().setTaskPerBatch(worldserver.paperConfig().misc.lightQueueSize); // Paper - increase light queue size - // CraftBukkit start - // this.updateMobSpawningFlags(); - worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); diff --git a/patches/removed/1.20/0407-Reduce-MutableInt-allocations-from-light-engine.patch b/patches/removed/1.20/0407-Reduce-MutableInt-allocations-from-light-engine.patch deleted file mode 100644 index 1a92be0a01..0000000000 --- a/patches/removed/1.20/0407-Reduce-MutableInt-allocations-from-light-engine.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf <[email protected]> -Date: Mon, 27 Apr 2020 02:48:06 -0700 -Subject: [PATCH] Reduce MutableInt allocations from light engine - -We can abuse the fact light is single threaded and share an instance -per light engine instance - -diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java -index 729c4b1763a24bac3c0764bea505555a32e54f57..37d7165dfd17da03428f8dbbbf95aa8005be289c 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java -+++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java -@@ -15,6 +15,7 @@ import org.apache.commons.lang3.mutable.MutableInt; - public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionStorage.BlockDataLayerStorageMap, BlockLightSectionStorage> { - private static final Direction[] DIRECTIONS = Direction.values(); - private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); -+ private final MutableInt mutableInt = new MutableInt(); // Paper - - public BlockLightEngine(LightChunkGetter chunkProvider) { - super(chunkProvider, LightLayer.BLOCK, new BlockLightSectionStorage(chunkProvider)); -@@ -44,7 +45,7 @@ public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionSt - if (direction == null) { - return 15; - } else { -- MutableInt mutableInt = new MutableInt(); -+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded - BlockState blockState = this.getStateAndOpacity(targetId, mutableInt); - if (mutableInt.getValue() >= 15) { - return 15; -diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java -index 56b8f6ac53e7598da4dea2180825242222f86731..ca710a20e8b97341616463f4058b61cf4999af28 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java -+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java -@@ -15,6 +15,7 @@ import org.apache.commons.lang3.mutable.MutableInt; - public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorage.SkyDataLayerStorageMap, SkyLightSectionStorage> { - private static final Direction[] DIRECTIONS = Direction.values(); - private static final Direction[] HORIZONTALS = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST}; -+ private final MutableInt mutableInt = new MutableInt(); // Paper - - public SkyLightEngine(LightChunkGetter chunkProvider) { - super(chunkProvider, LightLayer.SKY, new SkyLightSectionStorage(chunkProvider)); -@@ -26,7 +27,7 @@ public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorag - if (level >= 15) { - return level; - } else { -- MutableInt mutableInt = new MutableInt(); -+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded - BlockState blockState = this.getStateAndOpacity(targetId, mutableInt); - if (mutableInt.getValue() >= 15) { - return 15; diff --git a/patches/removed/1.20/0433-Stop-copy-on-write-operations-for-updating-light-dat.patch b/patches/removed/1.20/0433-Stop-copy-on-write-operations-for-updating-light-dat.patch deleted file mode 100644 index c13f70aec1..0000000000 --- a/patches/removed/1.20/0433-Stop-copy-on-write-operations-for-updating-light-dat.patch +++ /dev/null @@ -1,297 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf <[email protected]> -Date: Mon, 27 Apr 2020 04:05:38 -0700 -Subject: [PATCH] Stop copy-on-write operations for updating light data - -Causes huge memory allocations + gc issues - -diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java -index 573cdb0897978eef8f5fc906ed4928293f4b2ab9..314b46f0becd088d26956b45981217b128d539cb 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java -+++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java -@@ -9,7 +9,7 @@ import net.minecraft.world.level.chunk.LightChunkGetter; - - public class BlockLightSectionStorage extends LayerLightSectionStorage<BlockLightSectionStorage.BlockDataLayerStorageMap> { - protected BlockLightSectionStorage(LightChunkGetter chunkProvider) { -- super(LightLayer.BLOCK, chunkProvider, new BlockLightSectionStorage.BlockDataLayerStorageMap(new Long2ObjectOpenHashMap<>())); -+ super(LightLayer.BLOCK, chunkProvider, new BlockLightSectionStorage.BlockDataLayerStorageMap(new com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<>(), false)); // Paper - avoid copying light data - } - - @Override -@@ -20,13 +20,13 @@ public class BlockLightSectionStorage extends LayerLightSectionStorage<BlockLigh - } - - protected static final class BlockDataLayerStorageMap extends DataLayerStorageMap<BlockLightSectionStorage.BlockDataLayerStorageMap> { -- public BlockDataLayerStorageMap(Long2ObjectOpenHashMap<DataLayer> arrays) { -- super(arrays); -+ public BlockDataLayerStorageMap(com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<DataLayer> long2objectopenhashmap, boolean isVisible) { // Paper - avoid copying light data -+ super(long2objectopenhashmap, isVisible); // Paper - avoid copying light data - } - - @Override - public BlockLightSectionStorage.BlockDataLayerStorageMap copy() { -- return new BlockLightSectionStorage.BlockDataLayerStorageMap(this.map.clone()); -+ return new BlockDataLayerStorageMap(this.data, true); // Paper - avoid copying light data - } - } - } -diff --git a/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java b/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java -index 67ff66e232592203cf8dad605ad01eabc4dded89..f357a3473682c2d37a20fb862522c67b9979402a 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java -+++ b/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java -@@ -9,10 +9,23 @@ public abstract class DataLayerStorageMap<M extends DataLayerStorageMap<M>> { - private final long[] lastSectionKeys = new long[2]; - private final DataLayer[] lastSections = new DataLayer[2]; - private boolean cacheEnabled; -- protected final Long2ObjectOpenHashMap<DataLayer> map; -+ protected final com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<DataLayer> data; // Paper - avoid copying light data -+ protected final boolean isVisible; // Paper - avoid copying light data -+ java.util.function.Function<Long, DataLayer> lookup; // Paper - faster branchless lookup - -- protected DataLayerStorageMap(Long2ObjectOpenHashMap<DataLayer> arrays) { -- this.map = arrays; -+ // Paper start - avoid copying light data -+ protected DataLayerStorageMap(com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<DataLayer> data, boolean isVisible) { -+ if (isVisible) { -+ data.performUpdatesLockMap(); -+ } -+ this.data = data; -+ this.isVisible = isVisible; -+ if (isVisible) { -+ lookup = data::getVisibleAsync; -+ } else { -+ lookup = data::getUpdating; -+ } -+ // Paper end - avoid copying light data - this.clearCache(); - this.cacheEnabled = true; - } -@@ -20,16 +33,17 @@ public abstract class DataLayerStorageMap<M extends DataLayerStorageMap<M>> { - public abstract M copy(); - - public void copyDataLayer(long pos) { -- this.map.put(pos, this.map.get(pos).copy()); -+ if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data -+ this.data.queueUpdate(pos, ((DataLayer) this.data.getUpdating(pos)).copy()); // Paper - avoid copying light data - this.clearCache(); - } - - public boolean hasLayer(long chunkPos) { -- return this.map.containsKey(chunkPos); -+ return lookup.apply(chunkPos) != null; // Paper - avoid copying light data - } - - @Nullable -- public DataLayer getLayer(long chunkPos) { -+ public final DataLayer getLayer(long chunkPos) { // Paper - final - if (this.cacheEnabled) { - for(int i = 0; i < 2; ++i) { - if (chunkPos == this.lastSectionKeys[i]) { -@@ -38,7 +52,7 @@ public abstract class DataLayerStorageMap<M extends DataLayerStorageMap<M>> { - } - } - -- DataLayer dataLayer = this.map.get(chunkPos); -+ DataLayer dataLayer = lookup.apply(chunkPos); // Paper - avoid copying light data - if (dataLayer == null) { - return null; - } else { -@@ -58,11 +72,13 @@ public abstract class DataLayerStorageMap<M extends DataLayerStorageMap<M>> { - - @Nullable - public DataLayer removeLayer(long chunkPos) { -- return this.map.remove(chunkPos); -+ if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data -+ return (DataLayer) this.data.queueRemove(chunkPos); // Paper - avoid copying light data - } - - public void setLayer(long pos, DataLayer data) { -- this.map.put(pos, data); -+ if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data -+ this.data.queueUpdate(pos, data); // Paper - avoid copying light data - } - - public void clearCache() { -diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java -index c899674ee24167ee3abdf1588d7396df0ab4f0aa..85175b01b1623b3bc66c65805cec26eaead48265 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java -+++ b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java -@@ -27,7 +27,7 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>> - protected final LongSet dataSectionSet = new LongOpenHashSet(); - protected final LongSet toMarkNoData = new LongOpenHashSet(); - protected final LongSet toMarkData = new LongOpenHashSet(); -- protected volatile M visibleSectionData; -+ protected volatile M e_visible; protected final Object visibleUpdateLock = new Object(); // Paper - diff on change, should be "visible" - force compile fail on usage change - protected final M updatingSectionData; - protected final LongSet changedSections = new LongOpenHashSet(); - protected final LongSet sectionsAffectedByLightUpdates = new LongOpenHashSet(); -@@ -42,8 +42,8 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>> - this.layer = lightType; - this.chunkSource = chunkProvider; - this.updatingSectionData = lightData; -- this.visibleSectionData = lightData.copy(); -- this.visibleSectionData.disableCache(); -+ this.e_visible = lightData.copy(); // Paper - avoid copying light dat -+ this.e_visible.disableCache(); // Paper - avoid copying light dat - } - - protected boolean storingLightForSection(long sectionPos) { -@@ -52,7 +52,15 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>> - - @Nullable - protected DataLayer getDataLayer(long sectionPos, boolean cached) { -- return this.getDataLayer((M)(cached ? this.updatingSectionData : this.visibleSectionData), sectionPos); -+ // Paper start - avoid copying light data -+ if (cached) { -+ return this.getDataLayer(this.updatingSectionData, sectionPos); -+ } else { -+ synchronized (this.visibleUpdateLock) { -+ return this.getDataLayer(this.e_visible, sectionPos); -+ } -+ } -+ // Paper end - avoid copying light data - } - - @Nullable -@@ -342,9 +350,11 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>> - - protected void swapSectionMap() { - if (!this.changedSections.isEmpty()) { -+ synchronized (this.visibleUpdateLock) { // Paper - avoid copying light data - M dataLayerStorageMap = this.updatingSectionData.copy(); - dataLayerStorageMap.disableCache(); -- this.visibleSectionData = dataLayerStorageMap; -+ this.e_visible = dataLayerStorageMap; // Paper - avoid copying light data -+ } // Paper - avoid copying light data - this.changedSections.clear(); - } - -diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java -index 59d2af9f883541518c203302257f03dbe957aa0b..e6c857c8b4e4e65e3cf6a75ce6d844ff61acb566 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java -+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java -@@ -21,7 +21,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - private volatile boolean hasSourceInconsistencies; - - protected SkyLightSectionStorage(LightChunkGetter chunkProvider) { -- super(LightLayer.SKY, chunkProvider, new SkyLightSectionStorage.SkyDataLayerStorageMap(new Long2ObjectOpenHashMap<>(), new Long2IntOpenHashMap(), Integer.MAX_VALUE)); -+ super(LightLayer.SKY, chunkProvider, new SkyLightSectionStorage.SkyDataLayerStorageMap(new com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<>(), new com.destroystokyo.paper.util.map.QueuedChangesMapLong2Int(), Integer.MAX_VALUE, false)); // Paper - avoid copying light data - } - - @Override -@@ -32,8 +32,9 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - protected int getLightValue(long blockPos, boolean cached) { - long l = SectionPos.blockToSection(blockPos); - int i = SectionPos.y(l); -- SkyLightSectionStorage.SkyDataLayerStorageMap skyDataLayerStorageMap = cached ? this.updatingSectionData : this.visibleSectionData; -- int j = skyDataLayerStorageMap.topSections.get(SectionPos.getZeroNode(l)); -+ synchronized (this.visibleUpdateLock) { // Paper - avoid copying light data -+ SkyLightSectionStorage.SkyDataLayerStorageMap skyDataLayerStorageMap = (SkyLightSectionStorage.SkyDataLayerStorageMap) this.e_visible; // Paper - avoid copying light data - must be after lock acquire -+ int j = skyDataLayerStorageMap.otherData.getVisibleAsync(SectionPos.getZeroNode(l)); // Paper - avoid copying light data - if (j != skyDataLayerStorageMap.currentLowestY && i < j) { - DataLayer dataLayer = this.getDataLayer(skyDataLayerStorageMap, l); - if (dataLayer == null) { -@@ -52,6 +53,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - } else { - return cached && !this.lightOnInSection(l) ? 0 : 15; - } -+ } // Paper - avoid copying light data - } - - @Override -@@ -59,13 +61,13 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - int i = SectionPos.y(sectionPos); - if ((this.updatingSectionData).currentLowestY > i) { - (this.updatingSectionData).currentLowestY = i; -- (this.updatingSectionData).topSections.defaultReturnValue((this.updatingSectionData).currentLowestY); -+ (this.updatingSectionData).otherData.queueDefaultReturnValue((this.updatingSectionData).currentLowestY); // Paper - avoid copying light data - } - - long l = SectionPos.getZeroNode(sectionPos); -- int j = (this.updatingSectionData).topSections.get(l); -+ int j = (this.updatingSectionData).otherData.getUpdating(l); // Paper - avoid copying light data - if (j < i + 1) { -- (this.updatingSectionData).topSections.put(l, i + 1); -+ (this.updatingSectionData).otherData.queueUpdate(l, i + 1); // Paper - avoid copying light data - if (this.columnsWithSkySources.contains(l)) { - this.queueAddSource(sectionPos); - if (j > (this.updatingSectionData).currentLowestY) { -@@ -102,19 +104,19 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - } - - int i = SectionPos.y(sectionPos); -- if ((this.updatingSectionData).topSections.get(l) == i + 1) { -+ if ((this.updatingSectionData).otherData.getUpdating(l) == i + 1) { // Paper - avoid copying light data - long m; - for(m = sectionPos; !this.storingLightForSection(m) && this.hasSectionsBelow(i); m = SectionPos.offset(m, Direction.DOWN)) { - --i; - } - - if (this.storingLightForSection(m)) { -- (this.updatingSectionData).topSections.put(l, i + 1); -+ (this.updatingSectionData).otherData.queueUpdate(l, i + 1); // Paper - avoid copying light data - if (bl) { - this.queueAddSource(m); - } - } else { -- (this.updatingSectionData).topSections.remove(l); -+ (this.updatingSectionData).otherData.queueRemove(l); // Paper - avoid copying light data - } - } - -@@ -128,7 +130,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - protected void enableLightSources(long columnPos, boolean enabled) { - this.runAllUpdates(); - if (enabled && this.columnsWithSkySources.add(columnPos)) { -- int i = (this.updatingSectionData).topSections.get(columnPos); -+ int i = (this.updatingSectionData).otherData.getUpdating(columnPos); // Paper - avoid copying light data - if (i != (this.updatingSectionData).currentLowestY) { - long l = SectionPos.asLong(SectionPos.x(columnPos), i - 1, SectionPos.z(columnPos)); - this.queueAddSource(l); -@@ -152,7 +154,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - return dataLayer; - } else { - long l = SectionPos.offset(sectionPos, Direction.UP); -- int i = (this.updatingSectionData).topSections.get(SectionPos.getZeroNode(sectionPos)); -+ int i = (this.updatingSectionData).otherData.getUpdating(SectionPos.getZeroNode(sectionPos)); // Paper - avoid copying light data - if (i != (this.updatingSectionData).currentLowestY && SectionPos.y(l) < i) { - DataLayer dataLayer2; - while((dataLayer2 = this.getDataLayer(l, true)) == null) { -@@ -275,7 +277,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - - protected boolean isAboveData(long sectionPos) { - long l = SectionPos.getZeroNode(sectionPos); -- int i = (this.updatingSectionData).topSections.get(l); -+ int i = (this.updatingSectionData).otherData.getUpdating(l); // Paper - avoid copying light data - return i == (this.updatingSectionData).currentLowestY || SectionPos.y(sectionPos) >= i; - } - -@@ -286,18 +288,21 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec - - protected static final class SkyDataLayerStorageMap extends DataLayerStorageMap<SkyLightSectionStorage.SkyDataLayerStorageMap> { - int currentLowestY; -- final Long2IntOpenHashMap topSections; -- -- public SkyDataLayerStorageMap(Long2ObjectOpenHashMap<DataLayer> arrays, Long2IntOpenHashMap columnToTopSection, int minSectionY) { -- super(arrays); -- this.topSections = columnToTopSection; -- columnToTopSection.defaultReturnValue(minSectionY); -+ private final com.destroystokyo.paper.util.map.QueuedChangesMapLong2Int otherData; // Paper - avoid copying light data -+ -+ // Paper start - avoid copying light data -+ public SkyDataLayerStorageMap(com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<DataLayer> arrays, com.destroystokyo.paper.util.map.QueuedChangesMapLong2Int columnToTopSection, int minSectionY, boolean isVisible) { -+ super(arrays, isVisible); -+ this.otherData = columnToTopSection; -+ otherData.queueDefaultReturnValue(minSectionY); -+ // Paper end - this.currentLowestY = minSectionY; - } - - @Override - public SkyLightSectionStorage.SkyDataLayerStorageMap copy() { -- return new SkyLightSectionStorage.SkyDataLayerStorageMap(this.map.clone(), this.topSections.clone(), this.currentLowestY); -+ this.otherData.performUpdatesLockMap(); // Paper - avoid copying light data -+ return new SkyLightSectionStorage.SkyDataLayerStorageMap(this.data, this.otherData, this.currentLowestY, true); // Paper - avoid copying light data - } - } - } diff --git a/patches/removed/1.20/0571-copy-TESign-isEditable-from-snapshots.patch b/patches/removed/1.20/0571-copy-TESign-isEditable-from-snapshots.patch deleted file mode 100644 index 2eb5d9a101..0000000000 --- a/patches/removed/1.20/0571-copy-TESign-isEditable-from-snapshots.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder <[email protected]> -Date: Tue, 23 Mar 2021 06:43:30 +0000 -Subject: [PATCH] copy TESign#isEditable from snapshots - -Dropped in 1.20 as isEditable no longer exists and the full uuid of the editing player -is stored. New API is needed, but the current #setEditable only mutates the is_waxed state of a sign, which -is part of the compound tag and hence already copied by applyTo. -diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -index 97028a14830384f06f4f1de36abfbc6bc1b90a19..a7d75d33367933fdec27538cde5a53cd41f3c252 100644 ---- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -@@ -108,6 +108,7 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState< - this.back.applyLegacyStringToSignSide(); - - super.applyTo(sign); -+ sign.isEditable = getSnapshot().isEditable; // Paper - copy manually - } - - public static void openSign(Sign sign, org.bukkit.entity.HumanEntity player) { // Paper - change move open sign to HumanEntity diff --git a/patches/removed/1.20/0746-Always-parse-protochunk-light-sources-unless-it-is-m.patch b/patches/removed/1.20/0746-Always-parse-protochunk-light-sources-unless-it-is-m.patch deleted file mode 100644 index d994a31849..0000000000 --- a/patches/removed/1.20/0746-Always-parse-protochunk-light-sources-unless-it-is-m.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf <[email protected]> -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. - -Protochunks no longer serialize light sources like this. - -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 34a1976699571608ae19e20dc1b6020759dad909..0ec80b83a99bfdb1f985045d98a81905a8a5a3ac 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 -@@ -327,16 +327,33 @@ public class ChunkSerializer { - BelowZeroRetrogen belowzeroretrogen = protochunk.getBelowZeroRetrogen(); - boolean flag5 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT); - -- if (!flag && flag5) { -- 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) object1).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 - } - } - diff --git a/patches/removed/1.20/0878-Workaround-for-client-lag-spikes-MC-162253.patch b/patches/removed/1.20/0878-Workaround-for-client-lag-spikes-MC-162253.patch deleted file mode 100644 index 13f5686c79..0000000000 --- a/patches/removed/1.20/0878-Workaround-for-client-lag-spikes-MC-162253.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brokkonaut <[email protected]> -Date: Sat, 18 Dec 2021 19:43:36 +0100 -Subject: [PATCH] Workaround for client lag spikes (MC-162253) - -When crossing certain chunk boundaries, the client needlessly -calculates light maps for chunk neighbours. In some specific map -configurations, these calculations cause a 500ms+ freeze on the Client. - -This patch basically serves as a workaround by sending light maps -to the client, so that it doesn't attempt to calculate them. -This mitigates the frametime impact to a minimum (but it's still there). - -Original patch by: MeFisto94 <[email protected]> -Co-authored-by: =?UTF-8?q?Dani=C3=ABl=20Goossens?= <[email protected]> -Co-authored-by: Nassim Jahnke <[email protected]> - -Fixed in 1.20 with new light engine - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 95c50a36dc1e03ae8ab8ca89a96d1ea56da8d94c..fbe209a66c77c47935ad026dd3e45e682af91fd8 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1376,6 +1376,46 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - }); - } - -+ // Paper start - Fix MC-162253 -+ /** -+ * Returns the light mask for the given chunk consisting of all non-empty sections that may need sending. -+ */ -+ private BitSet lightMask(final LevelChunk chunk) { -+ final net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections(); -+ final BitSet mask = new BitSet(this.lightEngine.getLightSectionCount()); -+ -+ // There are 2 more light sections than chunk sections so when iterating over -+ // sections we have to increment the index by 1 -+ for (int i = 0; i < sections.length; i++) { -+ if (!sections[i].hasOnlyAir()) { -+ // Whenever a section is not empty, it can change lighting for the section itself (i + 1), the section below, and the section above -+ mask.set(i); -+ mask.set(i + 1); -+ mask.set(i + 2); -+ i++; // We can skip the already set upper section -+ } -+ } -+ return mask; -+ } -+ -+ /** -+ * Returns the ceiling light mask of all sections that are equal or lower to the highest non-empty section. -+ */ -+ private BitSet ceilingLightMask(final LevelChunk chunk) { -+ final net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections(); -+ for (int i = sections.length - 1; i >= 0; i--) { -+ if (!sections[i].hasOnlyAir()) { -+ // Add one to get the light section, one because blocks in the section above may change, and another because BitSet's toIndex is exclusive -+ final int highest = i + 3; -+ final BitSet mask = new BitSet(highest); -+ mask.set(0, highest); -+ return mask; -+ } -+ } -+ return new BitSet(); -+ } -+ // Paper end - Fix MC-162253 -+ - // Paper start - Anti-Xray - Bypass - private void playerLoadedChunk(ServerPlayer player, MutableObject<java.util.Map<Object, ClientboundLevelChunkWithLightPacket>> cachedDataPackets, LevelChunk chunk) { - if (cachedDataPackets.getValue() == null) { -@@ -1384,6 +1424,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - - Boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk); - player.trackChunk(chunk.getPos(), (Packet) cachedDataPackets.getValue().computeIfAbsent(shouldModify, (s) -> { -+ // Paper start - Fix MC-162253 -+ final int viewDistance = getEffectiveViewDistance(); -+ final int playerChunkX = player.getBlockX() >> 4; -+ final int playerChunkZ = player.getBlockZ() >> 4; -+ -+ // For all loaded neighbours, send sky light for empty sections above highest non-empty section (+1) of the center chunk -+ // otherwise the client will try to calculate lighting there on its own -+ final BitSet lightMask = lightMask(chunk); -+ if (!lightMask.isEmpty()) { -+ for (int x = -1; x <= 1; x++) { -+ for (int z = -1; z <= 1; z++) { -+ if (x == 0 && z == 0) { -+ continue; -+ } -+ -+ if (!chunk.isNeighbourLoaded(x, z)) { -+ continue; -+ } -+ -+ final int neighborChunkX = chunk.getPos().x + x; -+ final int neighborChunkZ = chunk.getPos().z + z; -+ final int distX = Math.abs(playerChunkX - neighborChunkX); -+ final int distZ = Math.abs(playerChunkZ - neighborChunkZ); -+ if (Math.max(distX, distZ) > viewDistance) { -+ continue; -+ } -+ -+ final LevelChunk neighbor = chunk.getRelativeNeighbourIfLoaded(x, z); -+ final BitSet updateLightMask = (BitSet) lightMask.clone(); -+ updateLightMask.andNot(ceilingLightMask(neighbor)); -+ if (updateLightMask.isEmpty()) { -+ continue; -+ } -+ -+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundLightUpdatePacket(new ChunkPos(neighborChunkX, neighborChunkZ), this.lightEngine, updateLightMask, null, true)); -+ } -+ } -+ } -+ // Paper end - Fix MC-162253 - return new ClientboundLevelChunkWithLightPacket(chunk, this.lightEngine, (BitSet) null, (BitSet) null, true, (Boolean) s); - })); - // Paper end diff --git a/patches/removed/1.20/0880-Fix-EndDragonFight-killed-statuses-should-be-false-f.patch b/patches/removed/1.20/0880-Fix-EndDragonFight-killed-statuses-should-be-false-f.patch deleted file mode 100644 index 21107e9d43..0000000000 --- a/patches/removed/1.20/0880-Fix-EndDragonFight-killed-statuses-should-be-false-f.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: elmital <[email protected]> -Date: Fri, 16 Sep 2022 17:44:34 +0200 -Subject: [PATCH] Fix: EndDragonFight killed statuses should be false for newly - created worlds - -This was fixed in 1.20-pre1 - -diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 230de1c71b0a6d6370df2fedb337cf0e332a7596..8cf4ae35eb66e69de32295d707db6845b4b02962 100644 ---- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -113,9 +113,11 @@ public class EndDragonFight { - if (nbt.contains("ExitPortalLocation", 10)) { - this.portalLocation = NbtUtils.readBlockPos(nbt.getCompound("ExitPortalLocation")); - } -- } else { -- this.dragonKilled = true; -- this.previouslyKilled = true; -+ // Paper start - Killed statuses should be false for newly created worlds -+ // } else { -+ // this.dragonKilled = true; -+ // this.previouslyKilled = true; -+ // Paper end - } - - if (nbt.contains("Gateways", 9)) { diff --git a/patches/removed/1.20/0889-Set-position-before-player-sending-on-dimension-chan.patch b/patches/removed/1.20/0889-Set-position-before-player-sending-on-dimension-chan.patch deleted file mode 100644 index 5d6de68da5..0000000000 --- a/patches/removed/1.20/0889-Set-position-before-player-sending-on-dimension-chan.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <[email protected]> -Date: Sat, 6 Aug 2022 18:10:14 -0400 -Subject: [PATCH] Set position before player sending on dimension change - -This causes a moment where the player entity is sent with the previous location, and the -teleport packet which is sent shortly after is meant to correct that. - -Fixed in 1.19.4 (notice how addDuringPortalTeleport is now called AFTER movement is done now) - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b30972c3ab19795e26589cd0cdd54c43414fe368..c5dc769d13fbc2a88a731d42669d0906ee306e4b 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1176,6 +1176,7 @@ public class ServerPlayer extends Player { - - // CraftBukkit end - this.setLevel(worldserver); -+ this.moveTo(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); // Paper - Set the location before - this.connection.teleport(exit); // CraftBukkit - use internal teleport without event - this.connection.resetPosition(); - worldserver.addDuringPortalTeleport(this); diff --git a/patches/removed/1.20/0975-Disable-allowListing-before-received-from-client.patch b/patches/removed/1.20/0975-Disable-allowListing-before-received-from-client.patch deleted file mode 100644 index f46b1e87f5..0000000000 --- a/patches/removed/1.20/0975-Disable-allowListing-before-received-from-client.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <[email protected]> -Date: Sun, 23 Apr 2023 18:22:50 -0400 -Subject: [PATCH] Disable allowListing before received from client - -The client does not send the packet needed to received this information until a little later, which can cause a condition where -despite a player having disabled listing, they are able to be seen for a brief moment. This causes the player to be listed as an Anonymous -Player until the actual configuration value is received from the client. - -Fixed by mojang in 1.20 - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index c4a070d445a0d834152eb53864eb08f4f90947ca..f4526885a57b804a754ab34675649a5466db300d 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -286,7 +286,7 @@ public class ServerPlayer extends Player { - this.recipeBook = new ServerRecipeBook(); - this.lastSectionPos = SectionPos.of(0, 0, 0); - this.respawnDimension = Level.OVERWORLD; -- this.allowsListing = true; -+ this.allowsListing = false; // Paper - Set to false by default... wait for packet sent by client to populate - this.wardenSpawnTracker = new WardenSpawnTracker(0, 0, 0); - this.containerSynchronizer = new ContainerSynchronizer() { - @Override |