diff --git a/patches/unapplied/server/Add-config-option-for-logging-player-ip-addresses.patch b/patches/server/Add-config-option-for-logging-player-ip-addresses.patch similarity index 95% rename from patches/unapplied/server/Add-config-option-for-logging-player-ip-addresses.patch rename to patches/server/Add-config-option-for-logging-player-ip-addresses.patch index 0a6aeebe93..400903fc5e 100644 --- a/patches/unapplied/server/Add-config-option-for-logging-player-ip-addresses.patch +++ b/patches/server/Add-config-option-for-logging-player-ip-addresses.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception); + LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper } - net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error"); + net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error"); networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> { diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -61,9 +61,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", networkmanager.getRemoteAddress(), exception); + ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "", exception); // Paper - TextComponent chatcomponenttext = new TextComponent("Internal server error"); + MutableComponent ichatmutablecomponent = Component.literal("Internal server error"); - networkmanager.send(new ClientboundDisconnectPacket(chatcomponenttext), (future) -> { + networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), (future) -> { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } - @Override + @Nullable diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/patches/unapplied/server/Add-root-admin-user-detection.patch b/patches/server/Add-root-admin-user-detection.patch similarity index 100% rename from patches/unapplied/server/Add-root-admin-user-detection.patch rename to patches/server/Add-root-admin-user-detection.patch diff --git a/patches/unapplied/server/Always-allow-item-changing-in-Fireball.patch b/patches/server/Always-allow-item-changing-in-Fireball.patch similarity index 100% rename from patches/unapplied/server/Always-allow-item-changing-in-Fireball.patch rename to patches/server/Always-allow-item-changing-in-Fireball.patch diff --git a/patches/unapplied/server/Async-catch-modifications-to-critical-entity-state.patch b/patches/server/Async-catch-modifications-to-critical-entity-state.patch similarity index 100% rename from patches/unapplied/server/Async-catch-modifications-to-critical-entity-state.patch rename to patches/server/Async-catch-modifications-to-critical-entity-state.patch diff --git a/patches/unapplied/server/Check-requirement-before-suggesting-root-nodes.patch b/patches/server/Check-requirement-before-suggesting-root-nodes.patch similarity index 100% rename from patches/unapplied/server/Check-requirement-before-suggesting-root-nodes.patch rename to patches/server/Check-requirement-before-suggesting-root-nodes.patch diff --git a/patches/unapplied/server/Configurable-feature-seeds.patch b/patches/server/Configurable-feature-seeds.patch similarity index 97% rename from patches/unapplied/server/Configurable-feature-seeds.patch rename to patches/server/Configurable-feature-seeds.patch index 37566cb518..f08b07d5cc 100644 --- a/patches/unapplied/server/Configurable-feature-seeds.patch +++ b/patches/server/Configurable-feature-seeds.patch @@ -82,7 +82,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -0,0 +0,0 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { +@@ -0,0 +0,0 @@ public abstract class ChunkGenerator { int j = list.size(); try { @@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int k = Math.max(GenerationStep.Decoration.values().length, j); for (int l = 0; l < k; ++l) { -@@ -0,0 +0,0 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { +@@ -0,0 +0,0 @@ public abstract class ChunkGenerator { return (String) optional.orElseGet(placedfeature::toString); }; diff --git a/patches/unapplied/server/Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch b/patches/server/Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch similarity index 100% rename from patches/unapplied/server/Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch rename to patches/server/Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch diff --git a/patches/unapplied/server/Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch b/patches/server/Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch similarity index 100% rename from patches/unapplied/server/Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch rename to patches/server/Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch diff --git a/patches/unapplied/server/Don-t-log-debug-logging-being-disabled.patch b/patches/server/Don-t-log-debug-logging-being-disabled.patch similarity index 100% rename from patches/unapplied/server/Don-t-log-debug-logging-being-disabled.patch rename to patches/server/Don-t-log-debug-logging-being-disabled.patch diff --git a/patches/unapplied/server/Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch similarity index 100% rename from patches/unapplied/server/Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch rename to patches/server/Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch diff --git a/patches/unapplied/server/Ensure-valid-vehicle-status.patch b/patches/server/Ensure-valid-vehicle-status.patch similarity index 100% rename from patches/unapplied/server/Ensure-valid-vehicle-status.patch rename to patches/server/Ensure-valid-vehicle-status.patch diff --git a/patches/unapplied/server/Fix-Bukkit-NamespacedKey-shenanigans.patch b/patches/server/Fix-Bukkit-NamespacedKey-shenanigans.patch similarity index 76% rename from patches/unapplied/server/Fix-Bukkit-NamespacedKey-shenanigans.patch rename to patches/server/Fix-Bukkit-NamespacedKey-shenanigans.patch index a5e677c606..6e29047208 100644 --- a/patches/unapplied/server/Fix-Bukkit-NamespacedKey-shenanigans.patch +++ b/patches/server/Fix-Bukkit-NamespacedKey-shenanigans.patch @@ -4,16 +4,16 @@ Date: Sun, 24 Oct 2021 15:49:35 +0200 Subject: [PATCH] Fix Bukkit NamespacedKey shenanigans -diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java +diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java -+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java -@@ -0,0 +0,0 @@ public class PaperMinecartLootableInventory implements PaperLootableEntityInvent +--- a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java ++++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java +@@ -0,0 +0,0 @@ public class PaperContainerEntityLootableInventory implements PaperLootableEntit @Override public org.bukkit.loot.LootTable getLootTable() { -- return entity.lootTable != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null; -+ return entity.lootTable != null && !entity.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null; +- return entity.getLootTable() != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null; ++ return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null; } @Override diff --git a/patches/unapplied/server/Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch b/patches/server/Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch similarity index 68% rename from patches/unapplied/server/Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch rename to patches/server/Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch index 574c538dae..c23593a552 100644 --- a/patches/unapplied/server/Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch +++ b/patches/server/Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CocoaDecorator extends TreeDecorator { @Override - public void place(LevelSimulatedReader world, BiConsumer replacer, Random random, List logPositions, List leavesPositions) { -+ if (logPositions.isEmpty()) return; // Paper - if (!(random.nextFloat() >= this.probability)) { - int i = logPositions.get(0).getY(); - logPositions.stream().filter((pos) -> { + public void place(TreeDecorator.Context generator) { ++ if (generator.logs().isEmpty()) return; // Paper + RandomSource randomSource = generator.random(); + if (!(randomSource.nextFloat() >= this.probability)) { + List list = generator.logs(); diff --git a/patches/unapplied/server/Fix-CraftCriteria-defaults-map.patch b/patches/server/Fix-CraftCriteria-defaults-map.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftCriteria-defaults-map.patch rename to patches/server/Fix-CraftCriteria-defaults-map.patch diff --git a/patches/unapplied/server/Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/Fix-merchant-inventory-not-closing-on-entity-removal.patch similarity index 100% rename from patches/unapplied/server/Fix-merchant-inventory-not-closing-on-entity-removal.patch rename to patches/server/Fix-merchant-inventory-not-closing-on-entity-removal.patch diff --git a/patches/unapplied/server/Fix-setPatternColor-on-tropical-fish-bucket-meta.patch b/patches/server/Fix-setPatternColor-on-tropical-fish-bucket-meta.patch similarity index 100% rename from patches/unapplied/server/Fix-setPatternColor-on-tropical-fish-bucket-meta.patch rename to patches/server/Fix-setPatternColor-on-tropical-fish-bucket-meta.patch diff --git a/patches/unapplied/server/Fix-upstreams-block-state-factories.patch b/patches/server/Fix-upstreams-block-state-factories.patch similarity index 96% rename from patches/unapplied/server/Fix-upstreams-block-state-factories.patch rename to patches/server/Fix-upstreams-block-state-factories.patch index c8cbb56ee9..8ac34ae782 100644 --- a/patches/unapplied/server/Fix-upstreams-block-state-factories.patch +++ b/patches/server/Fix-upstreams-block-state-factories.patch @@ -81,6 +81,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - Material.DARK_OAK_WALL_SIGN, - Material.JUNGLE_SIGN, - Material.JUNGLE_WALL_SIGN, +- Material.MANGROVE_SIGN, +- Material.MANGROVE_WALL_SIGN, - Material.OAK_SIGN, - Material.OAK_WALL_SIGN, - Material.SPRUCE_SIGN, @@ -209,18 +211,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - ), CraftCampfire.class, CraftCampfire::new, CampfireBlockEntity::new - ); - -- register( -- Arrays.asList( -- Material.CHEST, -- Material.TRAPPED_CHEST -- ), CraftChest.class, CraftChest::new, ChestBlockEntity::new -- ); -- - register(Material.BARREL, CraftBarrel.class, CraftBarrel::new, BarrelBlockEntity::new); - register(Material.BEACON, CraftBeacon.class, CraftBeacon::new, BeaconBlockEntity::new); - register(Material.BELL, CraftBell.class, CraftBell::new, BellBlockEntity::new); - register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new); - register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new); +- register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new); - register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new); - register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new); - register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new); @@ -236,10 +232,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - register(Material.JUKEBOX, CraftJukebox.class, CraftJukebox::new, JukeboxBlockEntity::new); - register(Material.LECTERN, CraftLectern.class, CraftLectern::new, LecternBlockEntity::new); - register(Material.MOVING_PISTON, CraftMovingPiston.class, CraftMovingPiston::new, PistonMovingBlockEntity::new); +- register(Material.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new, SculkCatalystBlockEntity::new); - register(Material.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new, SculkSensorBlockEntity::new); +- register(Material.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new, SculkShriekerBlockEntity::new); - register(Material.SMOKER, CraftSmoker.class, CraftSmoker::new, SmokerBlockEntity::new); - register(Material.SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new, SpawnerBlockEntity::new); - register(Material.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new, StructureBlockEntity::new); +- register(Material.TRAPPED_CHEST, CraftChest.class, CraftChest::new, TrappedChestBlockEntity::new); + // Paper start - simplify + register(BlockEntityType.SIGN, CraftSign.class, CraftSign::new); + register(BlockEntityType.SKULL, CraftSkull.class, CraftSkull::new); @@ -249,13 +248,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + register(BlockEntityType.BED, CraftBed.class, CraftBed::new); + register(BlockEntityType.BEEHIVE, CraftBeehive.class, CraftBeehive::new); + register(BlockEntityType.CAMPFIRE, CraftCampfire.class, CraftCampfire::new); -+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new); // Paper - split up chests due to different block entity types -+ register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new); // Paper - split up chests due to different block entity types + register(BlockEntityType.BARREL, CraftBarrel.class, CraftBarrel::new); + register(BlockEntityType.BEACON, CraftBeacon.class, CraftBeacon::new); + register(BlockEntityType.BELL, CraftBell.class, CraftBell::new); + register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new); + register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new); ++ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new); + register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new); + register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new); + register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new); @@ -271,10 +269,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + register(BlockEntityType.JUKEBOX, CraftJukebox.class, CraftJukebox::new); + register(BlockEntityType.LECTERN, CraftLectern.class, CraftLectern::new); + register(BlockEntityType.PISTON, CraftMovingPiston.class, CraftMovingPiston::new); ++ register(BlockEntityType.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new); + register(BlockEntityType.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new); ++ register(BlockEntityType.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new); + register(BlockEntityType.SMOKER, CraftSmoker.class, CraftSmoker::new); + register(BlockEntityType.MOB_SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new); + register(BlockEntityType.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new); ++ register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new); + // Paper end } @@ -284,21 +285,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static > void register( - Material blockType, +- Class blockStateType, +- BiFunction blockStateConstructor, +- BiFunction tileEntityConstructor +- ) { +- CraftBlockStates.register(Collections.singletonList(blockType), blockStateType, blockStateConstructor, tileEntityConstructor); +- } +- +- private static > void register( +- List blockTypes, + net.minecraft.world.level.block.entity.BlockEntityType blockEntityType, // Paper Class blockStateType, - BiFunction blockStateConstructor, - BiFunction tileEntityConstructor + BiFunction blockStateConstructor // Paper ) { -- CraftBlockStates.register(Collections.singletonList(blockType), blockStateType, blockStateConstructor, tileEntityConstructor); -- } -- -- private static > void register( -- List blockTypes, -- Class blockStateType, -- BiFunction blockStateConstructor, -- BiFunction tileEntityConstructor -- ) { - BlockStateFactory factory = new BlockEntityStateFactory<>(blockStateType, blockStateConstructor, tileEntityConstructor); - for (Material blockType : blockTypes) { - CraftBlockStates.register(blockType, factory); @@ -328,6 +329,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static Class getBlockStateType(Material material) { Preconditions.checkNotNull(material, "material is null"); return CraftBlockStates.getFactory(material).blockStateType; +@@ -0,0 +0,0 @@ public final class CraftBlockStates { + return null; } + // Paper start diff --git a/patches/unapplied/server/Preserve-overstacked-loot.patch b/patches/server/Preserve-overstacked-loot.patch similarity index 98% rename from patches/unapplied/server/Preserve-overstacked-loot.patch rename to patches/server/Preserve-overstacked-loot.patch index cf55371fc2..0b6da48322 100644 --- a/patches/unapplied/server/Preserve-overstacked-loot.patch +++ b/patches/server/Preserve-overstacked-loot.patch @@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items } - public List getRandomItems(LootContext context) { + public ObjectArrayList getRandomItems(LootContext context) { diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java diff --git a/patches/unapplied/server/Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/Prevent-excessive-velocity-through-repeated-crits.patch similarity index 100% rename from patches/unapplied/server/Prevent-excessive-velocity-through-repeated-crits.patch rename to patches/server/Prevent-excessive-velocity-through-repeated-crits.patch diff --git a/patches/unapplied/server/Prevent-softlocked-end-exit-portal-generation.patch b/patches/server/Prevent-softlocked-end-exit-portal-generation.patch similarity index 91% rename from patches/unapplied/server/Prevent-softlocked-end-exit-portal-generation.patch rename to patches/server/Prevent-softlocked-end-exit-portal-generation.patch index d3ab79c1ca..56a3cac973 100644 --- a/patches/unapplied/server/Prevent-softlocked-end-exit-portal-generation.patch +++ b/patches/server/Prevent-softlocked-end-exit-portal-generation.patch @@ -17,6 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1); + } + // Paper end - endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), new Random(), this.portalLocation); + endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation); } diff --git a/patches/unapplied/server/Reduce-worldgen-thread-worker-count-for-low-core-cou.patch b/patches/server/Reduce-worldgen-thread-worker-count-for-low-core-cou.patch similarity index 100% rename from patches/unapplied/server/Reduce-worldgen-thread-worker-count-for-low-core-cou.patch rename to patches/server/Reduce-worldgen-thread-worker-count-for-low-core-cou.patch diff --git a/patches/unapplied/server/Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/Remove-client-side-code-using-deprecated-for-removal.patch similarity index 100% rename from patches/unapplied/server/Remove-client-side-code-using-deprecated-for-removal.patch rename to patches/server/Remove-client-side-code-using-deprecated-for-removal.patch diff --git a/patches/unapplied/server/Rewrite-the-light-engine.patch b/patches/server/Rewrite-the-light-engine.patch similarity index 98% rename from patches/unapplied/server/Rewrite-the-light-engine.patch rename to patches/server/Rewrite-the-light-engine.patch index 3dc0157b28..7c9648b159 100644 --- a/patches/unapplied/server/Rewrite-the-light-engine.patch +++ b/patches/server/Rewrite-the-light-engine.patch @@ -515,13 +515,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final byte[] src = other.storageUpdating; + final byte[] into; + -+ if (this.storageUpdating != null) { -+ into = this.storageUpdating; ++ if (!this.updatingDirty) { ++ if (this.storageUpdating != null) { ++ into = this.storageUpdating = allocateBytes(); ++ } else { ++ this.storageUpdating = into = allocateBytes(); ++ this.stateUpdating = INIT_STATE_INIT; ++ } ++ this.updatingDirty = true; + } else { -+ this.storageUpdating = into = allocateBytes(); -+ this.stateUpdating = INIT_STATE_INIT; ++ into = this.storageUpdating; + } -+ this.updatingDirty = true; + + final int start = 0; + final int end = (15 | (15 << 4)) >>> 1; @@ -4126,7 +4130,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + private static final Logger LOGGER = LogUtils.getLogger(); + -+ private static final int STARLIGHT_LIGHT_VERSION = 6; ++ private static final int STARLIGHT_LIGHT_VERSION = 8; ++ ++ public static int getLightVersion() { ++ return STARLIGHT_LIGHT_VERSION; ++ } + + private static final String BLOCKLIGHT_STATE_TAG = "starlight.blocklight_state"; + private static final String SKYLIGHT_STATE_TAG = "starlight.skylight_state"; @@ -4249,7 +4257,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + SWMRNibbleArray[] skyNibbles = StarLightEngine.getFilledEmptyLight(world); + + -+ // start copy from from the original method ++ // start copy from the original method + boolean lit = tag.get("isLightOn") != null && tag.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION; + boolean canReadSky = world.dimensionType().hasSkyLight(); + ChunkStatus status = ChunkStatus.byName(tag.getString("Status")); @@ -4443,7 +4451,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final BlockableEventLoop mainThreadExecutor; // Paper - public final java.util.concurrent.Executor mainInvokingExecutor; // Paper public ChunkGenerator generator; - public final Supplier overworldDataStorage; + private RandomState randomState; diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java @@ -4791,9 +4799,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -0,0 +0,0 @@ public abstract class BlockBehaviour { - this.isViewBlocking = blockbase_info.isViewBlocking; this.hasPostProcess = blockbase_info.hasPostProcess; this.emissiveRendering = blockbase_info.emissiveRendering; + this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState()); + this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper } // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time @@ -5005,7 +5013,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -0,0 +0,0 @@ public class PalettedContainer implements PaletteResize { +@@ -0,0 +0,0 @@ public class PalettedContainer implements PaletteResize, PalettedContainer return this.get(this.strategy.getIndex(x, y, z)); } @@ -5036,8 +5044,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -0,0 +0,0 @@ public class ChunkSerializer { - private static final String BLOCK_TICKS_TAG = "block_ticks"; - private static final String FLUID_TICKS_TAG = "fluid_ticks"; + public static final String BLOCK_LIGHT_TAG = "BlockLight"; + public static final String SKY_LIGHT_TAG = "SkyLight"; + // Paper start - replace light engine impl + private static final int STARLIGHT_LIGHT_VERSION = 7; @@ -5069,9 +5077,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final int maxSection = io.papermc.paper.util.WorldUtil.getMaxLightSection(world); + boolean canReadSky = world.dimensionType().hasSkyLight(); + // Paper end - - if (flag) { - tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main + Registry iregistry = world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + Codec>> codec = ChunkSerializer.makeBiomeCodecRW(iregistry); // CraftBukkit - read/write + boolean flag2 = false; @@ -0,0 +0,0 @@ public class ChunkSerializer { DataResult dataresult; @@ -5082,44 +5090,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int k = world.getSectionIndexFromSectionY(b0); @@ -0,0 +0,0 @@ public class ChunkSerializer { - } + boolean flag3 = nbttagcompound1.contains("BlockLight", 7); + boolean flag4 = flag1 && nbttagcompound1.contains("SkyLight", 7); - if (flag) { -- if (nbttagcompound1.contains("BlockLight", 7)) { +- if (flag3 || flag4) { +- if (!flag2) { ++ // Paper start - rewrite the light engine ++ if (true || flag3 || flag4) { ++ if ((flag3 || flag4) && !flag2) { + tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main + lightengine.retainData(chunkPos, true); + }); // Paper - delay this task since we're executing off-main + flag2 = true; + } + ++ int y = sectionData.getByte("Y"); + if (flag3) { - // Paper start - delay this task since we're executing off-main -- DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight")); +- DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight").clone()); - tasksToExecuteOnMain.add(() -> { -- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkcoordintpair1, b0), blockLight, true); +- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, b0), blockLight, true); - }); - // Paper end - delay this task since we're executing off-main -+ // Paper start - rewrite light engine -+ int y = sectionData.getByte("Y"); -+ -+ if (sectionData.contains("BlockLight", 7)) { + // this is where our diff is + blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("BlockLight").clone(), sectionData.getInt(BLOCKLIGHT_STATE_TAG)); // clone for data safety + } else { + blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(BLOCKLIGHT_STATE_TAG)); } -- if (flag1 && nbttagcompound1.contains("SkyLight", 7)) { + if (flag4) { - // Paper start - delay this task since we're executing off-main -- DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight")); +- DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight").clone()); - tasksToExecuteOnMain.add(() -> { -- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkcoordintpair1, b0), skyLight, true); +- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, b0), skyLight, true); - }); - // Paper end - delay this task since we're executing off-mai -+ if (canReadSky) { -+ if (sectionData.contains("SkyLight", 7)) { -+ // we store under the same key so mod programs editing nbt -+ // can still read the data, hopefully. -+ // however, for compatibility we store chunks as unlit so vanilla -+ // is forced to re-light them if it encounters our data. It's too much of a burden -+ // to try and maintain compatibility with a broken and inferior skylight management system. -+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety -+ } else { -+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(SKYLIGHT_STATE_TAG)); -+ } ++ // we store under the same key so mod programs editing nbt ++ // can still read the data, hopefully. ++ // however, for compatibility we store chunks as unlit so vanilla ++ // is forced to re-light them if it encounters our data. It's too much of a burden ++ // to try and maintain compatibility with a broken and inferior skylight management system. ++ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety } + // Paper end - rewrite light engine } @@ -5128,9 +5139,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ChunkSerializer { }, chunkPos); - object = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata); -+ ((LevelChunk)object).setBlockNibbles(blockNibbles); // Paper - replace light impl -+ ((LevelChunk)object).setSkyNibbles(skyNibbles); // Paper - replace light impl + object1 = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata); ++ ((LevelChunk)object1).setBlockNibbles(blockNibbles); // Paper - replace light impl ++ ((LevelChunk)object1).setSkyNibbles(skyNibbles); // Paper - replace light impl } else { ProtoChunkTicks protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> { return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s)); @@ -5141,7 +5152,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protochunk.setBlockNibbles(blockNibbles); // Paper - replace light impl + protochunk.setSkyNibbles(skyNibbles); // Paper - replace light impl - object = protochunk; + object1 = protochunk; protochunk.setInhabitedTime(l); @@ -0,0 +0,0 @@ public class ChunkSerializer { DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()]; diff --git a/patches/unapplied/server/Update-head-rotation-in-missing-places.patch b/patches/server/Update-head-rotation-in-missing-places.patch similarity index 100% rename from patches/unapplied/server/Update-head-rotation-in-missing-places.patch rename to patches/server/Update-head-rotation-in-missing-places.patch diff --git a/patches/unapplied/server/Use-Velocity-compression-and-cipher-natives.patch b/patches/server/Use-Velocity-compression-and-cipher-natives.patch similarity index 99% rename from patches/unapplied/server/Use-Velocity-compression-and-cipher-natives.patch rename to patches/server/Use-Velocity-compression-and-cipher-natives.patch index a3abb6d019..72f157e285 100644 --- a/patches/unapplied/server/Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/Use-Velocity-compression-and-cipher-natives.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -0,0 +0,0 @@ dependencies { - runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2") + runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation + // Paper start - Use Velocity cipher diff --git a/patches/unapplied/server/VanillaCommandWrapper-didnt-account-for-entity-sende.patch b/patches/server/VanillaCommandWrapper-didnt-account-for-entity-sende.patch similarity index 100% rename from patches/unapplied/server/VanillaCommandWrapper-didnt-account-for-entity-sende.patch rename to patches/server/VanillaCommandWrapper-didnt-account-for-entity-sende.patch diff --git a/patches/unapplied/server/don-t-attempt-to-teleport-dead-entities.patch b/patches/server/don-t-attempt-to-teleport-dead-entities.patch similarity index 100% rename from patches/unapplied/server/don-t-attempt-to-teleport-dead-entities.patch rename to patches/server/don-t-attempt-to-teleport-dead-entities.patch diff --git a/patches/unapplied/server/fix-various-menus-with-empty-level-accesses.patch b/patches/server/fix-various-menus-with-empty-level-accesses.patch similarity index 100% rename from patches/unapplied/server/fix-various-menus-with-empty-level-accesses.patch rename to patches/server/fix-various-menus-with-empty-level-accesses.patch diff --git a/patches/unapplied/server/prevent-unintended-light-block-manipulation.patch b/patches/server/prevent-unintended-light-block-manipulation.patch similarity index 100% rename from patches/unapplied/server/prevent-unintended-light-block-manipulation.patch rename to patches/server/prevent-unintended-light-block-manipulation.patch