diff --git a/patches/unapplied/server/Actually-unload-POI-data.patch b/patches/server/Actually-unload-POI-data.patch similarity index 97% rename from patches/unapplied/server/Actually-unload-POI-data.patch rename to patches/server/Actually-unload-POI-data.patch index 1dcf0aaf1d..09eb32de74 100644 --- a/patches/unapplied/server/Actually-unload-POI-data.patch +++ b/patches/server/Actually-unload-POI-data.patch @@ -51,9 +51,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.poiManager.loadInData(pos, chunkHolder.poiData); chunkHolder.tasks.forEach(Runnable::run); + this.getPoiManager().dequeueUnload(pos.longKey); // Paper - // Paper end - if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.level.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async + if (chunkHolder.protoChunk != null) { + ProtoChunk protochunk = chunkHolder.protoChunk; diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java @@ -87,10 +87,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - unload poi data private final LongSet loadedChunks = new LongOpenHashSet(); - public final net.minecraft.server.level.ServerLevel world; // Paper // Paper public + private final net.minecraft.server.level.ServerLevel world; // Paper - public PoiManager(Path path, DataFixer dataFixer, boolean dsync, LevelHeightAccessor world) { - super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, world); + public PoiManager(Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) { + super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world); + if (world == null) { throw new IllegalStateException("world must be non-null"); } // Paper - require non-null this.world = (net.minecraft.server.level.ServerLevel)world; // Paper - this.distanceTracker = new PoiManager.DistanceTracker(); @@ -210,7 +210,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - actually unload POI data + - public void add(BlockPos pos, PoiType type) { + public void add(BlockPos pos, Holder type) { this.getOrCreate(SectionPos.asLong(pos)).add(pos, type); } @@ -0,0 +0,0 @@ public class PoiManager extends SectionStorage { diff --git a/patches/unapplied/server/Add-API-for-item-entity-health.patch b/patches/server/Add-API-for-item-entity-health.patch similarity index 100% rename from patches/unapplied/server/Add-API-for-item-entity-health.patch rename to patches/server/Add-API-for-item-entity-health.patch diff --git a/patches/unapplied/server/Add-PlayerItemFrameChangeEvent.patch b/patches/server/Add-PlayerItemFrameChangeEvent.patch similarity index 99% rename from patches/unapplied/server/Add-PlayerItemFrameChangeEvent.patch rename to patches/server/Add-PlayerItemFrameChangeEvent.patch index 7758eddf6e..0f56baa171 100644 --- a/patches/unapplied/server/Add-PlayerItemFrameChangeEvent.patch +++ b/patches/server/Add-PlayerItemFrameChangeEvent.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java @@ -0,0 +0,0 @@ package net.minecraft.world.entity.decoration; - import com.mojang.logging.LogUtils; + import java.util.OptionalInt; import javax.annotation.Nullable; +import io.papermc.paper.event.player.PlayerItemFrameChangeEvent; // Paper import net.minecraft.core.BlockPos; diff --git a/patches/unapplied/server/Add-config-option-for-worlds-affected-by-time-cmd.patch b/patches/server/Add-config-option-for-worlds-affected-by-time-cmd.patch similarity index 100% rename from patches/unapplied/server/Add-config-option-for-worlds-affected-by-time-cmd.patch rename to patches/server/Add-config-option-for-worlds-affected-by-time-cmd.patch diff --git a/patches/unapplied/server/Add-more-Campfire-API.patch b/patches/server/Add-more-Campfire-API.patch similarity index 94% rename from patches/unapplied/server/Add-more-Campfire-API.patch rename to patches/server/Add-more-Campfire-API.patch index 13950e1ece..8bf9f43507 100644 --- a/patches/unapplied/server/Add-more-Campfire-API.patch +++ b/patches/server/Add-more-Campfire-API.patch @@ -9,16 +9,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java @@ -0,0 +0,0 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { - private final NonNullList items; public final int[] cookingProgress; public final int[] cookingTime; + private final RecipeManager.CachedCheck quickCheck; + public final boolean[] stopCooking; // Paper public CampfireBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityType.CAMPFIRE, pos, state); - this.items = NonNullList.withSize(4, ItemStack.EMPTY); +@@ -0,0 +0,0 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { this.cookingProgress = new int[4]; this.cookingTime = new int[4]; + this.quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING); + this.stopCooking = new boolean[4]; // Paper } diff --git a/patches/unapplied/server/Add-player-health-update-API.patch b/patches/server/Add-player-health-update-API.patch similarity index 100% rename from patches/unapplied/server/Add-player-health-update-API.patch rename to patches/server/Add-player-health-update-API.patch diff --git a/patches/unapplied/server/Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch similarity index 100% rename from patches/unapplied/server/Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/server/Allow-delegation-to-vanilla-chunk-gen.patch diff --git a/patches/unapplied/server/Always-parse-protochunk-light-sources-unless-it-is-m.patch b/patches/server/Always-parse-protochunk-light-sources-unless-it-is-m.patch similarity index 93% rename from patches/unapplied/server/Always-parse-protochunk-light-sources-unless-it-is-m.patch rename to patches/server/Always-parse-protochunk-light-sources-unless-it-is-m.patch index 3c41d11814..26076c8d0f 100644 --- a/patches/unapplied/server/Always-parse-protochunk-light-sources-unless-it-is-m.patch +++ b/patches/server/Always-parse-protochunk-light-sources-unless-it-is-m.patch @@ -13,9 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -0,0 +0,0 @@ public class ChunkSerializer { BelowZeroRetrogen belowzeroretrogen = protochunk.getBelowZeroRetrogen(); - boolean flag2 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT); + boolean flag5 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT); -- if (!flag && flag2) { +- 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 @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + continue; + } -- if (((ChunkAccess) object).getBlockState(blockposition).getLightEmission() != 0) { +- 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))); diff --git a/patches/unapplied/server/Bucketable-API.patch b/patches/server/Bucketable-API.patch similarity index 100% rename from patches/unapplied/server/Bucketable-API.patch rename to patches/server/Bucketable-API.patch diff --git a/patches/unapplied/server/Check-player-world-in-endPortalSoundRadius.patch b/patches/server/Check-player-world-in-endPortalSoundRadius.patch similarity index 100% rename from patches/unapplied/server/Check-player-world-in-endPortalSoundRadius.patch rename to patches/server/Check-player-world-in-endPortalSoundRadius.patch diff --git a/patches/unapplied/server/Configurable-max-block-light-for-monster-spawning.patch b/patches/server/Configurable-max-block-light-for-monster-spawning.patch similarity index 69% rename from patches/unapplied/server/Configurable-max-block-light-for-monster-spawning.patch rename to patches/server/Configurable-max-block-light-for-monster-spawning.patch index 4eaae3353c..14110defeb 100644 --- a/patches/unapplied/server/Configurable-max-block-light-for-monster-spawning.patch +++ b/patches/server/Configurable-max-block-light-for-monster-spawning.patch @@ -23,11 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java @@ -0,0 +0,0 @@ public abstract class Monster extends PathfinderMob implements Enemy { - public static boolean isDarkEnoughToSpawn(ServerLevelAccessor world, BlockPos pos, Random random) { - if (world.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) { - return false; -- } else if (world.getBrightness(LightLayer.BLOCK, pos) > 0) { -+ } else if (world.getBrightness(LightLayer.BLOCK, pos) > (world.getLevel().paperConfig.maxBlockLightForMonsterSpawning >= 0 ? world.getLevel().paperConfig.maxBlockLightForMonsterSpawning : 0)) { // Paper - configurable max block light level return false; } else { - int i = world.getLevel().isThundering() ? world.getMaxLocalRawBrightness(pos, 10) : world.getMaxLocalRawBrightness(pos); + DimensionType dimensionType = world.dimensionType(); +- int i = dimensionType.monsterSpawnBlockLightLimit(); ++ int i = world.getLevel().paperConfig.maxBlockLightForMonsterSpawning >= 0 ? world.getLevel().paperConfig.maxBlockLightForMonsterSpawning : dimensionType.monsterSpawnBlockLightLimit(); // Paper + if (i < 15 && world.getBrightness(LightLayer.BLOCK, pos) > i) { + return false; + } else { diff --git a/patches/unapplied/server/Entity-powdered-snow-API.patch b/patches/server/Entity-powdered-snow-API.patch similarity index 100% rename from patches/unapplied/server/Entity-powdered-snow-API.patch rename to patches/server/Entity-powdered-snow-API.patch diff --git a/patches/unapplied/server/Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/server/Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch similarity index 100% rename from patches/unapplied/server/Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch rename to patches/server/Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch diff --git a/patches/unapplied/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch similarity index 90% rename from patches/unapplied/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch rename to patches/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch index ca253b106b..dd04497acc 100644 --- a/patches/unapplied/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch +++ b/patches/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop iregistry = worlddata.worldGenSettings().dimensions(); + LevelStem worlddimension = (LevelStem) iregistry.get(actualDimension); -- WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), holder.value()); -+ WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), holder.value(), chunkgenerator, this.getHandle().getServer().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY)); // Paper +- WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.typeHolder().value()); ++ WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.typeHolder().value(), worlddimension.generator(), this.getHandle().getServer().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY)); // Paper if (biomeProvider == null && generator != null) { biomeProvider = generator.getDefaultBiomeProvider(worldInfo); } @@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.vanillaChunkGenerator = chunkGenerator; + // Paper end this.name = worldDataServer.getLevelName(); - this.uuid = WorldUUID.getUUID(session.levelPath.toFile()); + this.uuid = WorldUUID.getUUID(session.levelDirectory.path().toFile()); this.environment = environment; @@ -0,0 +0,0 @@ public class CraftWorldInfo implements WorldInfo { } diff --git a/patches/unapplied/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch b/patches/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch similarity index 85% rename from patches/unapplied/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch rename to patches/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch index 61cf6e5a42..3bcefa9942 100644 --- a/patches/unapplied/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch +++ b/patches/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch @@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { - PalettedContainer>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; + PalettedContainerRO>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); -- Codec>> biomeCodec = PalettedContainer.codec(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes +- Codec>> biomeCodec = PalettedContainer.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); for (int i = 0; i < cs.length; i++) { - CompoundTag data = new CompoundTag(); diff --git a/patches/unapplied/server/Fix-bees-aging-inside-hives.patch b/patches/server/Fix-bees-aging-inside-hives.patch similarity index 100% rename from patches/unapplied/server/Fix-bees-aging-inside-hives.patch rename to patches/server/Fix-bees-aging-inside-hives.patch diff --git a/patches/unapplied/server/Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/Fix-entity-type-tags-suggestions-in-selectors.patch similarity index 98% rename from patches/unapplied/server/Fix-entity-type-tags-suggestions-in-selectors.patch rename to patches/server/Fix-entity-type-tags-suggestions-in-selectors.patch index 2c974a01c1..f831960e5b 100644 --- a/patches/unapplied/server/Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/Fix-entity-type-tags-suggestions-in-selectors.patch @@ -80,9 +80,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java @@ -0,0 +0,0 @@ public class EntityArgument implements ArgumentType { + StringReader stringreader = new StringReader(suggestionsbuilder.getInput()); stringreader.setCursor(suggestionsbuilder.getStart()); - SharedSuggestionProvider icompletionprovider = (SharedSuggestionProvider) commandcontext.getSource(); - EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2)); + EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2), true); // Paper @@ -118,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java @@ -0,0 +0,0 @@ public class EntitySelectorOptions { public static final DynamicCommandExceptionType ERROR_ENTITY_TYPE_INVALID = new DynamicCommandExceptionType((entity) -> { - return new TranslatableComponent("argument.entity.options.type.invalid", entity); + return Component.translatable("argument.entity.options.type.invalid", entity); }); + // Paper start + public static final DynamicCommandExceptionType ERROR_ENTITY_TAG_INVALID = new DynamicCommandExceptionType((object) -> { diff --git a/patches/unapplied/server/Fix-fluid-logging-on-Block-breakNaturally.patch b/patches/server/Fix-fluid-logging-on-Block-breakNaturally.patch similarity index 100% rename from patches/unapplied/server/Fix-fluid-logging-on-Block-breakNaturally.patch rename to patches/server/Fix-fluid-logging-on-Block-breakNaturally.patch diff --git a/patches/unapplied/server/Fix-removing-recipes-from-RecipeIterator.patch b/patches/server/Fix-removing-recipes-from-RecipeIterator.patch similarity index 100% rename from patches/unapplied/server/Fix-removing-recipes-from-RecipeIterator.patch rename to patches/server/Fix-removing-recipes-from-RecipeIterator.patch diff --git a/patches/unapplied/server/Fix-saving-configs-with-more-long-comments.patch b/patches/server/Fix-saving-configs-with-more-long-comments.patch similarity index 100% rename from patches/unapplied/server/Fix-saving-configs-with-more-long-comments.patch rename to patches/server/Fix-saving-configs-with-more-long-comments.patch diff --git a/patches/unapplied/server/Fix-sticky-pistons-and-BlockPistonRetractEvent.patch b/patches/server/Fix-sticky-pistons-and-BlockPistonRetractEvent.patch similarity index 100% rename from patches/unapplied/server/Fix-sticky-pistons-and-BlockPistonRetractEvent.patch rename to patches/server/Fix-sticky-pistons-and-BlockPistonRetractEvent.patch diff --git a/patches/unapplied/server/Fix-tripwire-state-inconsistency.patch b/patches/server/Fix-tripwire-state-inconsistency.patch similarity index 100% rename from patches/unapplied/server/Fix-tripwire-state-inconsistency.patch rename to patches/server/Fix-tripwire-state-inconsistency.patch diff --git a/patches/unapplied/server/Forward-CraftEntity-in-teleport-command.patch b/patches/server/Forward-CraftEntity-in-teleport-command.patch similarity index 100% rename from patches/unapplied/server/Forward-CraftEntity-in-teleport-command.patch rename to patches/server/Forward-CraftEntity-in-teleport-command.patch diff --git a/patches/unapplied/server/Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/Hide-unnecessary-itemmeta-from-clients.patch similarity index 100% rename from patches/unapplied/server/Hide-unnecessary-itemmeta-from-clients.patch rename to patches/server/Hide-unnecessary-itemmeta-from-clients.patch diff --git a/patches/unapplied/server/Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch b/patches/server/Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch similarity index 100% rename from patches/unapplied/server/Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch rename to patches/server/Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch diff --git a/patches/unapplied/server/Improve-scoreboard-entries.patch b/patches/server/Improve-scoreboard-entries.patch similarity index 100% rename from patches/unapplied/server/Improve-scoreboard-entries.patch rename to patches/server/Improve-scoreboard-entries.patch diff --git a/patches/unapplied/server/Load-effect-amplifiers-greater-than-127-correctly.patch b/patches/server/Load-effect-amplifiers-greater-than-127-correctly.patch similarity index 100% rename from patches/unapplied/server/Load-effect-amplifiers-greater-than-127-correctly.patch rename to patches/server/Load-effect-amplifiers-greater-than-127-correctly.patch diff --git a/patches/unapplied/server/Make-water-animal-spawn-height-configurable.patch b/patches/server/Make-water-animal-spawn-height-configurable.patch similarity index 98% rename from patches/unapplied/server/Make-water-animal-spawn-height-configurable.patch rename to patches/server/Make-water-animal-spawn-height-configurable.patch index fccab2f85e..4119dbd4ca 100644 --- a/patches/unapplied/server/Make-water-animal-spawn-height-configurable.patch +++ b/patches/server/Make-water-animal-spawn-height-configurable.patch @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java +++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java @@ -0,0 +0,0 @@ public abstract class WaterAnimal extends PathfinderMob { - public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType type, LevelAccessor world, MobSpawnType reason, BlockPos pos, Random random) { + public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) { int i = world.getSeaLevel(); int j = i - 13; + // Paper start diff --git a/patches/unapplied/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch b/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch similarity index 100% rename from patches/unapplied/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch rename to patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch diff --git a/patches/unapplied/server/Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/Optimise-collision-checking-in-player-move-packet-ha.patch similarity index 100% rename from patches/unapplied/server/Optimise-collision-checking-in-player-move-packet-ha.patch rename to patches/server/Optimise-collision-checking-in-player-move-packet-ha.patch diff --git a/patches/unapplied/server/Optimize-HashMapPalette.patch b/patches/server/Optimize-HashMapPalette.patch similarity index 100% rename from patches/unapplied/server/Optimize-HashMapPalette.patch rename to patches/server/Optimize-HashMapPalette.patch diff --git a/patches/unapplied/server/Prevent-ContainerOpenersCounter-openCount-from-going.patch b/patches/server/Prevent-ContainerOpenersCounter-openCount-from-going.patch similarity index 100% rename from patches/unapplied/server/Prevent-ContainerOpenersCounter-openCount-from-going.patch rename to patches/server/Prevent-ContainerOpenersCounter-openCount-from-going.patch diff --git a/patches/unapplied/server/Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/Prevent-sending-oversized-item-data-in-equipment-and.patch similarity index 100% rename from patches/unapplied/server/Prevent-sending-oversized-item-data-in-equipment-and.patch rename to patches/server/Prevent-sending-oversized-item-data-in-equipment-and.patch diff --git a/patches/unapplied/server/Update-Log4j.patch b/patches/server/Update-Log4j.patch similarity index 88% rename from patches/unapplied/server/Update-Log4j.patch rename to patches/server/Update-Log4j.patch index f71efe9377..dc2cfd169c 100644 --- a/patches/unapplied/server/Update-Log4j.patch +++ b/patches/server/Update-Log4j.patch @@ -19,6 +19,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper + implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.17.1") // Paper - implementation("org.ow2.asm:asm:9.2") - implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation - runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") + implementation("org.ow2.asm:asm:9.3") + implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation + implementation("commons-lang:commons-lang:2.6") diff --git a/patches/unapplied/server/Validate-usernames.patch b/patches/server/Validate-usernames.patch similarity index 88% rename from patches/unapplied/server/Validate-usernames.patch rename to patches/server/Validate-usernames.patch index f961150baf..dc5ad47a0d 100644 --- a/patches/unapplied/server/Validate-usernames.patch +++ b/patches/server/Validate-usernames.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener - private ServerPlayer delayedAcceptPlayer; + private ProfilePublicKey playerProfilePublicKey; public String hostname = ""; // CraftBukkit - add field private int velocityLoginMessageId = -1; // Paper - Velocity support + public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) { this.state = ServerLoginPacketListenerImpl.State.HELLO; @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener - // Paper end + } } + // Paper start - validate usernames @@ -60,19 +60,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void handleHello(ServerboundHelloPacket packet) { Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]); - this.gameProfile = packet.getGameProfile(); - Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(this.gameProfile.getName()), "Invalid characters in username", new Object[0]); + Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); + // Paper start - validate usernames + if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) { -+ if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(this.gameProfile.getName())) { ++ if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(packet.name())) { + ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); + return; + } + } + // Paper end - validate usernames - if (this.server.usesAuthentication() && !this.connection.isMemoryConnection()) { - this.state = ServerLoginPacketListenerImpl.State.KEY; - this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce)); + + try { + this.playerProfilePublicKey = ServerLoginPacketListenerImpl.validatePublicKey(packet, this.server.getServiceSignatureValidator(), this.server.enforceSecureProfile()); 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/Fix-kelp-modifier-changing-growth-for-other-crops.patch b/patches/unapplied/server/Fix-kelp-modifier-changing-growth-for-other-crops.patch deleted file mode 100644 index 21cc54c784..0000000000 --- a/patches/unapplied/server/Fix-kelp-modifier-changing-growth-for-other-crops.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Fri, 3 Dec 2021 17:09:24 -0800 -Subject: [PATCH] Fix kelp modifier changing growth for other crops - -Also add growth modifiers for twisting vines, weeping vines, cave vines, -and glow berries - -Also fix above-mentioned modifiers from having the reverse effect - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java -@@ -0,0 +0,0 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl - - @Override - protected BlockState getGrowIntoState(BlockState state, Random random) { -- return (BlockState) super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, random.nextFloat() < 0.11F); -+ // Paper start -+ return this.getGrowIntoState(state, random, null); - } - -+ @Override -+ protected BlockState getGrowIntoState(BlockState state, Random random, Level level) { -+ final boolean value = (level == null ? random.nextFloat() : random.nextFloat(100.00F / level.spigotConfig.glowBerryModifier)) < 0.11F; -+ return super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, value); -+ } -+ // Paper end -+ - @Override - public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) { - return new ItemStack(Items.GLOW_BERRIES); -diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java -@@ -0,0 +0,0 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements - - @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { -- if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (100.0D / world.spigotConfig.kelpModifier) * this.growPerTickProbability) { // Spigot -+ // Paper start -+ final int modifier; -+ if (state.is(Blocks.TWISTING_VINES) || state.is(Blocks.TWISTING_VINES_PLANT)) { -+ modifier = world.spigotConfig.twistingVinesModifier; -+ } else if (state.is(Blocks.WEEPING_VINES) || state.is(Blocks.WEEPING_VINES_PLANT)) { -+ modifier = world.spigotConfig.weepingVinesModifier; -+ } else if (state.is(Blocks.CAVE_VINES) || state.is(Blocks.CAVE_VINES_PLANT)) { -+ modifier = world.spigotConfig.caveVinesModifier; -+ } else if (state.is(Blocks.KELP) || state.is(Blocks.KELP_PLANT)) { -+ modifier = world.spigotConfig.kelpModifier; -+ } else { -+ modifier = 100; // Above cases are exhaustive as of 1.18 -+ } -+ if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (modifier / 100.0D) * this.growPerTickProbability) { // Spigot // Paper - fix growth modifier having the reverse effect -+ // Paper end - BlockPos blockposition1 = pos.relative(this.growthDirection); - - if (this.canGrowInto(world.getBlockState(blockposition1))) { -- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random)); // CraftBukkit -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random, world)); // CraftBukkit // Paper - } - } - - } - -+ // Paper start -+ protected BlockState getGrowIntoState(BlockState state, Random random, Level level) { -+ return this.getGrowIntoState(state, random); -+ } -+ // Paper end -+ - protected BlockState getGrowIntoState(BlockState state, Random random) { - return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE); - } -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class SpigotWorldConfig - public int bambooModifier; - public int sweetBerryModifier; - public int kelpModifier; -+ // Paper start -+ public int twistingVinesModifier; -+ public int weepingVinesModifier; -+ public int caveVinesModifier; -+ public int glowBerryModifier; -+ // Paper end - private int getAndValidateGrowth(String crop) - { - int modifier = this.getInt( "growth." + crop.toLowerCase(java.util.Locale.ENGLISH) + "-modifier", 100 ); -@@ -0,0 +0,0 @@ public class SpigotWorldConfig - this.bambooModifier = this.getAndValidateGrowth( "Bamboo" ); - this.sweetBerryModifier = this.getAndValidateGrowth( "SweetBerry" ); - this.kelpModifier = this.getAndValidateGrowth( "Kelp" ); -+ // Paper start -+ this.twistingVinesModifier = this.getAndValidateGrowth("TwistingVines"); -+ this.weepingVinesModifier = this.getAndValidateGrowth("WeepingVines"); -+ this.caveVinesModifier = this.getAndValidateGrowth("CaveVines"); -+ this.glowBerryModifier = this.getAndValidateGrowth("GlowBerry"); -+ // Paper end - } - - public double itemMerge;