From 57a91fb8839c53573241d187b1ba013d6d406154 Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Wed, 23 Oct 2024 22:52:43 +0200 Subject: [PATCH] moooore --- .../api/Fix-SpawnerEntry-Equipment-API.patch | 2 +- ...-command-sender-which-forwards-feedb.patch | 0 .../Add-API-for-item-entity-health.patch | 0 .../server/Add-GameEvent-tags.patch | 6 +- .../Add-TameableDeathMessageEvent.patch | 24 +++++++ ...tion-for-worlds-affected-by-time-cmd.patch | 0 ...-configurable-height-for-slime-spawn.patch | 18 +++--- ...check-for-PersistentDataContainer-ha.patch | 0 ...date-calls-to-CraftServer-getSpawnLi.patch | 0 .../server/Add-missing-block-data-API.patch | 0 ...d-missing-structure-set-seed-configs.patch | 0 ...llow-changing-the-EnderDragon-podium.patch | 53 +++++++-------- .../server/Bucketable-API.patch | 0 .../server/Buffer-OOB-setBlock-calls.patch | 0 ...eys-and-optimize-reference-Holder-ta.patch | 2 +- ...max-block-light-for-monster-spawning.patch | 0 ...igurable-sculk-sensor-listener-range.patch | 4 +- .../server/Custom-Potion-Mixes.patch | 10 +-- ...cle-movement-from-players-while-tele.patch | 0 ...assenger-world-matches-ridden-entity.patch | 0 .../server/Entity-powdered-snow-API.patch | 0 ...sks-fairly-for-worlds-while-waiting-.patch | 0 .../server/Expand-PlayerItemDamageEvent.patch | 23 +++++++ .../Expose-furnace-minecart-push-values.patch | 0 ...d-canSmelt-methods-to-FurnaceInvento.patch | 0 ...vanilla-BiomeProvider-from-WorldInfo.patch | 10 +-- ...E-in-CraftPersistentDataTypeRegistry.patch | 0 ...verriding-a-block-entity-during-worl.patch | 0 .../server/Fix-NotePlayEvent.patch | 0 ...elled-powdered-snow-bucket-placement.patch | 12 ++-- ...rojectileHitEvent-for-piercing-arrow.patch | 2 +- .../Fix-falling-block-spawn-methods.patch | 0 ...lock-data-for-EntityChangeBlockEvent.patch | 64 +++++++++---------- .../server/Fix-saving-in-unloadWorld.patch | 0 ...-pistons-and-BlockPistonRetractEvent.patch | 0 ...ix-swamp-hut-cat-generation-deadlock.patch | 8 +-- .../Fix-xp-reward-for-baby-zombies.patch | 6 +- .../Force-close-world-loading-screen.patch | 10 +-- .../server/Freeze-Tick-Lock-API.patch | 20 +++--- .../server/Furnace-RecipesUsed-API.patch | 0 .../Implement-enchantWithLevels-API.patch | 0 .../Implement-getComputedBiome-API.patch | 0 .../server/Make-some-itemstacks-nonnull.patch | 0 ...ter-animal-spawn-height-configurable.patch | 0 .../server/More-PotionEffectType-API.patch | 0 .../server/More-Projectile-API.patch | 36 ++++++----- ...ulti-Block-Change-API-Implementation.patch | 0 .../Multiple-Entries-with-Scoreboards.patch | 0 ...efault-CustomSpawners-in-custom-worl.patch | 0 ...nt-tile-entity-copies-loading-chunks.patch | 0 ...o-worldlist-before-initing-the-world.patch | 2 +- .../Reset-placed-block-on-exception.patch | 0 ...-for-StructureTemplate.Pallete-cache.patch | 4 +- ...tead-of-display-name-in-PlayerList-g.patch | 0 .../server/Validate-usernames.patch | 0 .../server/WorldCreator-keepSpawnLoaded.patch | 0 ...ables-running-when-mob-loot-gamerule.patch | 2 +- .../Add-TameableDeathMessageEvent.patch | 24 ------- .../server/Expand-PlayerItemDamageEvent.patch | 23 ------- 59 files changed, 179 insertions(+), 186 deletions(-) rename patches/{unapplied => }/server/API-for-creating-command-sender-which-forwards-feedb.patch (100%) rename patches/{unapplied => }/server/Add-API-for-item-entity-health.patch (100%) rename patches/{unapplied => }/server/Add-GameEvent-tags.patch (91%) create mode 100644 patches/server/Add-TameableDeathMessageEvent.patch rename patches/{unapplied => }/server/Add-config-option-for-worlds-affected-by-time-cmd.patch (100%) rename patches/{unapplied => }/server/Add-configurable-height-for-slime-spawn.patch (74%) rename patches/{unapplied => }/server/Add-missing-IAE-check-for-PersistentDataContainer-ha.patch (100%) rename patches/{unapplied => }/server/Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch (100%) rename patches/{unapplied => }/server/Add-missing-block-data-API.patch (100%) rename patches/{unapplied => }/server/Add-missing-structure-set-seed-configs.patch (100%) rename patches/{unapplied => }/server/Allow-changing-the-EnderDragon-podium.patch (74%) rename patches/{unapplied => }/server/Bucketable-API.patch (100%) rename patches/{unapplied => }/server/Buffer-OOB-setBlock-calls.patch (100%) rename patches/{unapplied => }/server/Cache-resource-keys-and-optimize-reference-Holder-ta.patch (97%) rename patches/{unapplied => }/server/Configurable-max-block-light-for-monster-spawning.patch (100%) rename patches/{unapplied => }/server/Configurable-sculk-sensor-listener-range.patch (98%) rename patches/{unapplied => }/server/Custom-Potion-Mixes.patch (95%) rename patches/{unapplied => }/server/Don-t-allow-vehicle-movement-from-players-while-tele.patch (100%) rename patches/{unapplied => }/server/Ensure-entity-passenger-world-matches-ridden-entity.patch (100%) rename patches/{unapplied => }/server/Entity-powdered-snow-API.patch (100%) rename patches/{unapplied => }/server/Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch (100%) create mode 100644 patches/server/Expand-PlayerItemDamageEvent.patch rename patches/{unapplied => }/server/Expose-furnace-minecart-push-values.patch (100%) rename patches/{unapplied => }/server/Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch (100%) rename patches/{unapplied => }/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch (97%) rename patches/{unapplied => }/server/Fix-CME-in-CraftPersistentDataTypeRegistry.patch (100%) rename patches/{unapplied => }/server/Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch (100%) rename patches/{unapplied => }/server/Fix-NotePlayEvent.patch (100%) rename patches/{unapplied => }/server/Fix-cancelled-powdered-snow-bucket-placement.patch (71%) rename patches/{unapplied => }/server/Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch (99%) rename patches/{unapplied => }/server/Fix-falling-block-spawn-methods.patch (100%) rename patches/{unapplied => }/server/Fix-new-block-data-for-EntityChangeBlockEvent.patch (85%) rename patches/{unapplied => }/server/Fix-saving-in-unloadWorld.patch (100%) rename patches/{unapplied => }/server/Fix-sticky-pistons-and-BlockPistonRetractEvent.patch (100%) rename patches/{unapplied => }/server/Fix-swamp-hut-cat-generation-deadlock.patch (89%) rename patches/{unapplied => }/server/Fix-xp-reward-for-baby-zombies.patch (87%) rename patches/{unapplied => }/server/Force-close-world-loading-screen.patch (79%) rename patches/{unapplied => }/server/Freeze-Tick-Lock-API.patch (86%) rename patches/{unapplied => }/server/Furnace-RecipesUsed-API.patch (100%) rename patches/{unapplied => }/server/Implement-enchantWithLevels-API.patch (100%) rename patches/{unapplied => }/server/Implement-getComputedBiome-API.patch (100%) rename patches/{unapplied => }/server/Make-some-itemstacks-nonnull.patch (100%) rename patches/{unapplied => }/server/Make-water-animal-spawn-height-configurable.patch (100%) rename patches/{unapplied => }/server/More-PotionEffectType-API.patch (100%) rename patches/{unapplied => }/server/More-Projectile-API.patch (96%) rename patches/{unapplied => }/server/Multi-Block-Change-API-Implementation.patch (100%) rename patches/{unapplied => }/server/Multiple-Entries-with-Scoreboards.patch (100%) rename patches/{unapplied => }/server/Option-to-have-default-CustomSpawners-in-custom-worl.patch (100%) rename patches/{unapplied => }/server/Prevent-tile-entity-copies-loading-chunks.patch (100%) rename patches/{unapplied => }/server/Put-world-into-worldlist-before-initing-the-world.patch (97%) rename patches/{unapplied => }/server/Reset-placed-block-on-exception.patch (100%) rename patches/{unapplied => }/server/Use-a-CHM-for-StructureTemplate.Pallete-cache.patch (92%) rename patches/{unapplied => }/server/Use-username-instead-of-display-name-in-PlayerList-g.patch (100%) rename patches/{unapplied => }/server/Validate-usernames.patch (100%) rename patches/{unapplied => }/server/WorldCreator-keepSpawnLoaded.patch (100%) rename patches/{unapplied => }/server/fix-player-loottables-running-when-mob-loot-gamerule.patch (93%) delete mode 100644 patches/unapplied/server/Add-TameableDeathMessageEvent.patch delete mode 100644 patches/unapplied/server/Expand-PlayerItemDamageEvent.patch diff --git a/patches/api/Fix-SpawnerEntry-Equipment-API.patch b/patches/api/Fix-SpawnerEntry-Equipment-API.patch index f46e77856c..2e3227ee9e 100644 --- a/patches/api/Fix-SpawnerEntry-Equipment-API.patch +++ b/patches/api/Fix-SpawnerEntry-Equipment-API.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Set the loot table for the spawned entity's equipment slots. *
- * To remove a loot table use null. -+ * To remove a loot table use {@link LootTables#EMPTY}. ++ * To remove a loot table use {@link org.bukkit.loot.LootTables#EMPTY}. * * @param table this {@link org.bukkit.entity.Mob} will have. */ diff --git a/patches/unapplied/server/API-for-creating-command-sender-which-forwards-feedb.patch b/patches/server/API-for-creating-command-sender-which-forwards-feedb.patch similarity index 100% rename from patches/unapplied/server/API-for-creating-command-sender-which-forwards-feedb.patch rename to patches/server/API-for-creating-command-sender-which-forwards-feedb.patch 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-GameEvent-tags.patch b/patches/server/Add-GameEvent-tags.patch similarity index 91% rename from patches/unapplied/server/Add-GameEvent-tags.patch rename to patches/server/Add-GameEvent-tags.patch index dfd7db23a9..2fa7e549a2 100644 --- a/patches/unapplied/server/Add-GameEvent-tags.patch +++ b/patches/server/Add-GameEvent-tags.patch @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - return (org.bukkit.Tag) new CraftEntityTag(BuiltInRegistries.ENTITY_TYPE, entityTagKey); + return (org.bukkit.Tag) new CraftDamageTag(damageRegistry, damageTagKey); } } + // Paper start @@ -66,8 +66,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - net.minecraft.core.Registry> entityTags = BuiltInRegistries.ENTITY_TYPE; - return entityTags.getTags().map(pair -> (org.bukkit.Tag) new CraftEntityTag(entityTags, pair.getFirst())).collect(ImmutableList.toImmutableList()); + net.minecraft.core.Registry damageTags = CraftRegistry.getMinecraftRegistry(Registries.DAMAGE_TYPE); + return damageTags.getTags().map(pair -> (org.bukkit.Tag) new CraftDamageTag(damageTags, pair.key())).collect(ImmutableList.toImmutableList()); } + // Paper start + case org.bukkit.Tag.REGISTRY_GAME_EVENTS -> { diff --git a/patches/server/Add-TameableDeathMessageEvent.patch b/patches/server/Add-TameableDeathMessageEvent.patch new file mode 100644 index 0000000000..f658c3d6fd --- /dev/null +++ b/patches/server/Add-TameableDeathMessageEvent.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Mon, 21 Jun 2021 21:24:45 -0400 +Subject: [PATCH] Add TameableDeathMessageEvent + + +diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java ++++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +@@ -0,0 +0,0 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { + if (entityliving instanceof ServerPlayer) { + ServerPlayer entityplayer = (ServerPlayer) entityliving; + +- entityplayer.sendSystemMessage(this.getCombatTracker().getDeathMessage()); ++ // Paper start - Add TameableDeathMessageEvent ++ io.papermc.paper.event.entity.TameableDeathMessageEvent event = new io.papermc.paper.event.entity.TameableDeathMessageEvent((org.bukkit.entity.Tameable) getBukkitEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getCombatTracker().getDeathMessage())); ++ if (event.callEvent()) { ++ entityplayer.sendSystemMessage(this.getCombatTracker().getDeathMessage()); ++ } ++ // Paper end - Add TameableDeathMessageEvent + } + } + } 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-configurable-height-for-slime-spawn.patch b/patches/server/Add-configurable-height-for-slime-spawn.patch similarity index 74% rename from patches/unapplied/server/Add-configurable-height-for-slime-spawn.patch rename to patches/server/Add-configurable-height-for-slime-spawn.patch index f6e9dabfa5..d0a596ee2f 100644 --- a/patches/unapplied/server/Add-configurable-height-for-slime-spawn.patch +++ b/patches/server/Add-configurable-height-for-slime-spawn.patch @@ -9,27 +9,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java @@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy { - return checkMobSpawnRules(type, world, spawnReason, pos, random); - } + return checkMobSpawnRules(type, world, spawnReason, pos, random); + } -- if (world.getBiome(pos).is(BiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) && pos.getY() > 50 && pos.getY() < 70 && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { +- if (world.getBiome(pos).is(BiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) && pos.getY() > 50 && pos.getY() < 70 && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { + // Paper start - Replace rules for Height in Swamp Biome + final double maxHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.surfaceBiome.maximum; + final double minHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.surfaceBiome.minimum; + if (world.getBiome(pos).is(BiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) && pos.getY() > minHeightSwamp && pos.getY() < maxHeightSwamp && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { + // Paper end - Replace rules for Height in Swamp Biome - return checkMobSpawnRules(type, world, spawnReason, pos, random); - } + return checkMobSpawnRules(type, world, spawnReason, pos, random); + } @@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy { - ChunkPos chunkcoordintpair = new ChunkPos(pos); + ChunkPos chunkcoordintpair = new ChunkPos(pos); boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper -- if (random.nextInt(10) == 0 && flag && pos.getY() < 40) { +- if (random.nextInt(10) == 0 && flag && pos.getY() < 40) { + // Paper start - Replace rules for Height in Slime Chunks + final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; + if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) { + // Paper end - Replace rules for Height in Slime Chunks - return checkMobSpawnRules(type, world, spawnReason, pos, random); - } + return checkMobSpawnRules(type, world, spawnReason, pos, random); } + } diff --git a/patches/unapplied/server/Add-missing-IAE-check-for-PersistentDataContainer-ha.patch b/patches/server/Add-missing-IAE-check-for-PersistentDataContainer-ha.patch similarity index 100% rename from patches/unapplied/server/Add-missing-IAE-check-for-PersistentDataContainer-ha.patch rename to patches/server/Add-missing-IAE-check-for-PersistentDataContainer-ha.patch diff --git a/patches/unapplied/server/Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch b/patches/server/Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch similarity index 100% rename from patches/unapplied/server/Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch rename to patches/server/Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch diff --git a/patches/unapplied/server/Add-missing-block-data-API.patch b/patches/server/Add-missing-block-data-API.patch similarity index 100% rename from patches/unapplied/server/Add-missing-block-data-API.patch rename to patches/server/Add-missing-block-data-API.patch diff --git a/patches/unapplied/server/Add-missing-structure-set-seed-configs.patch b/patches/server/Add-missing-structure-set-seed-configs.patch similarity index 100% rename from patches/unapplied/server/Add-missing-structure-set-seed-configs.patch rename to patches/server/Add-missing-structure-set-seed-configs.patch diff --git a/patches/unapplied/server/Allow-changing-the-EnderDragon-podium.patch b/patches/server/Allow-changing-the-EnderDragon-podium.patch similarity index 74% rename from patches/unapplied/server/Allow-changing-the-EnderDragon-podium.patch rename to patches/server/Allow-changing-the-EnderDragon-podium.patch index 23ac2aa4ec..a438ad2c73 100644 --- a/patches/unapplied/server/Allow-changing-the-EnderDragon-podium.patch +++ b/patches/server/Allow-changing-the-EnderDragon-podium.patch @@ -39,15 +39,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean isFlapping() { float f = Mth.cos(this.flapTime * 6.2831855F); -@@ -0,0 +0,0 @@ public class EnderDragon extends Mob implements Enemy { - d0 = segment2[1] - segment1[1]; - } - } else { -- BlockPos blockposition = this.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.fightOrigin)); -+ BlockPos blockposition = this.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.getPodium()); // Paper - Allow changing the EnderDragon podium - double d1 = Math.max(Math.sqrt(blockposition.distToCenterSqr(this.position())) / 4.0D, 1.0D); - - d0 = (double) segmentOffset / d1; @@ -0,0 +0,0 @@ public class EnderDragon extends Mob implements Enemy { vec3d = this.getViewVector(tickDelta); } @@ -62,11 +53,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java @@ -0,0 +0,0 @@ public class DragonDeathPhase extends AbstractDragonPhaseInstance { + public void doServerTick(ServerLevel world) { + this.time++; if (this.targetLocation == null) { - BlockPos blockPos = this.dragon - .level() -- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium +- BlockPos blockPos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ BlockPos blockPos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium this.targetLocation = Vec3.atBottomCenterOf(blockPos); } @@ -75,11 +66,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java @@ -0,0 +0,0 @@ public class DragonHoldingPatternPhase extends AbstractDragonPhaseInstance { + + private void findNewTarget(ServerLevel world) { if (this.currentPath != null && this.currentPath.isDone()) { - BlockPos blockPos = this.dragon - .level() -- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(EndPodiumFeature.getLocation(this.dragon.getFightOrigin()))); -+ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(this.dragon.getPodium())); // Paper - Allow changing the EnderDragon podium +- BlockPos blockPos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ BlockPos blockPos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(this.dragon.getPodium())); // Paper - Allow changing the EnderDragon podium int i = this.dragon.getDragonFight() == null ? 0 : this.dragon.getDragonFight().getCrystalsAlive(); if (this.dragon.getRandom().nextInt(i + 3) == 0) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.LANDING_APPROACH); @@ -88,24 +79,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java @@ -0,0 +0,0 @@ public class DragonLandingApproachPhase extends AbstractDragonPhaseInstance { + private void findNewTarget(ServerLevel world) { + if (this.currentPath == null || this.currentPath.isDone()) { int i = this.dragon.findClosestNode(); - BlockPos blockPos = this.dragon - .level() -- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium - Player player = this.dragon - .level() - .getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, (double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ()); +- BlockPos blockPos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ BlockPos blockPos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + Player player = world.getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, (double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ()); + int j; + if (player != null) { diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java @@ -0,0 +0,0 @@ public class DragonLandingPhase extends AbstractDragonPhaseInstance { - public void doServerTick() { + public void doServerTick(ServerLevel world) { if (this.targetLocation == null) { this.targetLocation = Vec3.atBottomCenterOf( -- this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())) -+ this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()) // Paper - Allow changing the EnderDragon podium +- world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())) ++ world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()) // Paper - Allow changing the EnderDragon podium ); } @@ -114,11 +105,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java @@ -0,0 +0,0 @@ public class DragonTakeoffPhase extends AbstractDragonPhaseInstance { + @Override + public void doServerTick(ServerLevel world) { if (!this.firstTick && this.currentPath != null) { - BlockPos blockPos = this.dragon - .level() -- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium +- BlockPos blockPos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ BlockPos blockPos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium if (!blockPos.closerToCenterThan(this.dragon.position(), 10.0)) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN); } 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/Buffer-OOB-setBlock-calls.patch b/patches/server/Buffer-OOB-setBlock-calls.patch similarity index 100% rename from patches/unapplied/server/Buffer-OOB-setBlock-calls.patch rename to patches/server/Buffer-OOB-setBlock-calls.patch diff --git a/patches/unapplied/server/Cache-resource-keys-and-optimize-reference-Holder-ta.patch b/patches/server/Cache-resource-keys-and-optimize-reference-Holder-ta.patch similarity index 97% rename from patches/unapplied/server/Cache-resource-keys-and-optimize-reference-Holder-ta.patch rename to patches/server/Cache-resource-keys-and-optimize-reference-Holder-ta.patch index a547802912..7feb0672f3 100644 --- a/patches/unapplied/server/Cache-resource-keys-and-optimize-reference-Holder-ta.patch +++ b/patches/server/Cache-resource-keys-and-optimize-reference-Holder-ta.patch @@ -63,4 +63,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + .getOptional(KEY_CACHE.computeIfAbsent(bukkit, type -> net.minecraft.resources.ResourceKey.create(Registries.ENTITY_TYPE, CraftNamespacedKey.toMinecraft(type.getKey())))).orElseThrow(); } - public static String bukkitToString(EntityType bukkit) { + public static Holder> bukkitToMinecraftHolder(EntityType bukkit) { 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 100% 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 diff --git a/patches/unapplied/server/Configurable-sculk-sensor-listener-range.patch b/patches/server/Configurable-sculk-sensor-listener-range.patch similarity index 98% rename from patches/unapplied/server/Configurable-sculk-sensor-listener-range.patch rename to patches/server/Configurable-sculk-sensor-listener-range.patch index bc69aeaf73..8293a2d15e 100644 --- a/patches/unapplied/server/Configurable-sculk-sensor-listener-range.patch +++ b/patches/server/Configurable-sculk-sensor-listener-range.patch @@ -58,8 +58,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected static final String PAPER_LISTENER_RANGE_NBT_KEY = "Paper.ListenerRange"; // Paper - Configurable sculk sensor listener range @Override - protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) { - super.saveAdditional(nbt, registryLookup); + protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registries) { + super.saveAdditional(nbt, registries); @@ -0,0 +0,0 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList .encodeStart(registryOps, this.vibrationData) .resultOrPartial(string -> LOGGER.error("Failed to encode vibration listener for Sculk Sensor: '{}'", string)) diff --git a/patches/unapplied/server/Custom-Potion-Mixes.patch b/patches/server/Custom-Potion-Mixes.patch similarity index 95% rename from patches/unapplied/server/Custom-Potion-Mixes.patch rename to patches/server/Custom-Potion-Mixes.patch index 8c7f5f7be8..b1034805d3 100644 --- a/patches/unapplied/server/Custom-Potion-Mixes.patch +++ b/patches/server/Custom-Potion-Mixes.patch @@ -100,9 +100,9 @@ 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 +Date: Sun, 10 Apr 2022 06:26:32 +0100 +Subject: [PATCH] Expand PlayerItemDamageEvent + + +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { + } + + public void hurtAndBreak(int amount, ServerLevel world, @Nullable LivingEntity player, Consumer breakCallback) { // Paper - Add EntityDamageItemEvent ++ int originalDamage = amount; // Paper - Expand PlayerItemDamageEvent + int j = this.processDurabilityChange(amount, world, player); + // CraftBukkit start + if (player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent +- PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), j); // Paper - Add EntityDamageItemEvent ++ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), j, originalDamage); // Paper - Add EntityDamageItemEvent + event.getPlayer().getServer().getPluginManager().callEvent(event); + + if (j != event.getDamage() || event.isCancelled()) { diff --git a/patches/unapplied/server/Expose-furnace-minecart-push-values.patch b/patches/server/Expose-furnace-minecart-push-values.patch similarity index 100% rename from patches/unapplied/server/Expose-furnace-minecart-push-values.patch rename to patches/server/Expose-furnace-minecart-push-values.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 97% rename from patches/unapplied/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch rename to patches/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch index 4b15af9e2e..80d607aa8f 100644 --- a/patches/unapplied/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch +++ b/patches/server/Expose-vanilla-BiomeProvider-from-WorldInfo.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver)); - LevelStem worlddimension = (LevelStem) dimensions.get(dimensionKey); + LevelStem worlddimension = (LevelStem) dimensions.getValue(dimensionKey); - org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.type().value()); + org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.type().value(), worlddimension.generator(), this.registryAccess()); // Paper - Expose vanilla BiomeProvider from WorldInfo @@ -21,12 +21,12 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.serverLevelData.setWorld(this); if (biomeProvider != null) { -- BiomeSource worldChunkManager = new CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().registryOrThrow(Registries.BIOME)); -+ BiomeSource worldChunkManager = new CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().registryOrThrow(Registries.BIOME), chunkgenerator.getBiomeSource()); // Paper - add vanillaBiomeProvider +- BiomeSource worldChunkManager = new CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().lookupOrThrow(Registries.BIOME)); ++ BiomeSource worldChunkManager = new CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().lookupOrThrow(Registries.BIOME), chunkgenerator.getBiomeSource()); // Paper - add vanillaBiomeProvider if (chunkgenerator instanceof NoiseBasedChunkGenerator cga) { chunkgenerator = new NoiseBasedChunkGenerator(worldChunkManager, cga.settings); } else if (chunkgenerator instanceof FlatLevelSource cpf) { @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { List list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata)); - LevelStem worlddimension = iregistry.get(actualDimension); + LevelStem worlddimension = iregistry.getValue(actualDimension); - WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.type().value()); + WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.type().value(), worlddimension.generator(), this.getHandle().getServer().registryAccess()); // Paper - Expose vanilla BiomeProvider from WorldInfo diff --git a/patches/unapplied/server/Fix-CME-in-CraftPersistentDataTypeRegistry.patch b/patches/server/Fix-CME-in-CraftPersistentDataTypeRegistry.patch similarity index 100% rename from patches/unapplied/server/Fix-CME-in-CraftPersistentDataTypeRegistry.patch rename to patches/server/Fix-CME-in-CraftPersistentDataTypeRegistry.patch diff --git a/patches/unapplied/server/Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch b/patches/server/Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch similarity index 100% rename from patches/unapplied/server/Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch rename to patches/server/Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch diff --git a/patches/unapplied/server/Fix-NotePlayEvent.patch b/patches/server/Fix-NotePlayEvent.patch similarity index 100% rename from patches/unapplied/server/Fix-NotePlayEvent.patch rename to patches/server/Fix-NotePlayEvent.patch diff --git a/patches/unapplied/server/Fix-cancelled-powdered-snow-bucket-placement.patch b/patches/server/Fix-cancelled-powdered-snow-bucket-placement.patch similarity index 71% rename from patches/unapplied/server/Fix-cancelled-powdered-snow-bucket-placement.patch rename to patches/server/Fix-cancelled-powdered-snow-bucket-placement.patch index b4998cd645..7238ae03fe 100644 --- a/patches/unapplied/server/Fix-cancelled-powdered-snow-bucket-placement.patch +++ b/patches/server/Fix-cancelled-powdered-snow-bucket-placement.patch @@ -21,11 +21,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // special case bonemeal if (item == Items.BONE_MEAL) { @@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { - world.capturedBlockStates.clear(); - if (blocks.size() > 1) { - placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ()); -- } else if (blocks.size() == 1) { + world.capturedBlockStates.clear(); + if (blocks.size() > 1) { + placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ()); +- } else if (blocks.size() == 1) { + } else if (blocks.size() == 1 && item != Items.POWDER_SNOW_BUCKET) { // Paper - Fix cancelled powdered snow bucket placement - placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ()); - } + placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ()); + } diff --git a/patches/unapplied/server/Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch b/patches/server/Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch similarity index 99% rename from patches/unapplied/server/Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch rename to patches/server/Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch index 042b9661a3..a1fb271159 100644 --- a/patches/unapplied/server/Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch +++ b/patches/server/Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -0,0 +0,0 @@ public abstract class AbstractArrow extends Projectile { - } + } + // Paper start - Fix cancelling ProjectileHitEvent for piercing arrows diff --git a/patches/unapplied/server/Fix-falling-block-spawn-methods.patch b/patches/server/Fix-falling-block-spawn-methods.patch similarity index 100% rename from patches/unapplied/server/Fix-falling-block-spawn-methods.patch rename to patches/server/Fix-falling-block-spawn-methods.patch diff --git a/patches/unapplied/server/Fix-new-block-data-for-EntityChangeBlockEvent.patch b/patches/server/Fix-new-block-data-for-EntityChangeBlockEvent.patch similarity index 85% rename from patches/unapplied/server/Fix-new-block-data-for-EntityChangeBlockEvent.patch rename to patches/server/Fix-new-block-data-for-EntityChangeBlockEvent.patch index d4114b7d17..a8570e365c 100644 --- a/patches/unapplied/server/Fix-new-block-data-for-EntityChangeBlockEvent.patch +++ b/patches/server/Fix-new-block-data-for-EntityChangeBlockEvent.patch @@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockPos blockposition = this.mob.blockPosition(); - if (EatBlockGoal.IS_TALL_GRASS.test(this.level.getBlockState(blockposition))) { -- if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit +- if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit + final BlockState blockState = this.level.getBlockState(blockposition); // Paper - fix wrong block state + if (EatBlockGoal.IS_TALL_GRASS.test(blockState)) { // Paper - fix wrong block state -+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, blockState.getFluidState().createLegacyBlock(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state ++ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state this.level.destroyBlock(blockposition, false); } @@ -59,8 +59,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockPos blockposition1 = blockposition.below(); if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) { -- if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit -+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.DIRT.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state +- if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit ++ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState())); this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2); } @@ -81,7 +81,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements RangedAttackMob { if (WitherBoss.canDestroy(iblockdata)) { // CraftBukkit start @@ -109,13 +109,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java @@ -0,0 +0,0 @@ public class Ravager extends Raider { - if (block instanceof LeavesBlock) { - // CraftBukkit start -- if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) { -+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state - continue; - } - // CraftBukkit end + if (block instanceof LeavesBlock) { + // CraftBukkit start +- if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) { ++ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state + continue; + } + // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java @@ -134,7 +134,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie +@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile { if (iblockdata.is(BlockTags.FIRE)) { // CraftBukkit start @@ -148,34 +148,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/ChorusFlowerBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChorusFlowerBlock.java @@ -0,0 +0,0 @@ public class ChorusFlowerBlock extends Block { - - if (!world.isClientSide && projectile.mayInteract(world, blockposition) && projectile.mayBreak(world)) { - // CraftBukkit -- if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState())) { -+ if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, state.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state - return; - } - // CraftBukkit end + if (world instanceof ServerLevel worldserver) { + if (projectile.mayInteract(worldserver, blockposition) && projectile.mayBreak(worldserver)) { + // CraftBukkit +- if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState())) { ++ if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, state.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state + return; + } + // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java @@ -0,0 +0,0 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate - if (projectile.mayInteract(world, blockposition) && projectile.mayBreak(world) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6D) { - // CraftBukkit start -- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState())) { -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, state.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state - return; - } - // CraftBukkit end + if (projectile.mayInteract(worldserver, blockposition) && projectile.mayBreak(worldserver) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6D) { + // CraftBukkit start +- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState())) { ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, state.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state + return; + } + // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/level/block/TntBlock.java b/src/main/java/net/minecraft/world/level/block/TntBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/TntBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TntBlock.java @@ -0,0 +0,0 @@ public class TntBlock extends Block { - if (projectile.isOnFire() && projectile.mayInteract(world, blockposition)) { + if (projectile.isOnFire() && projectile.mayInteract(worldserver, blockposition)) { // CraftBukkit start - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState()) || !CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.PROJECTILE, projectile, null)) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, state.getFluidState().createLegacyBlock()) || !CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.PROJECTILE, projectile, null)) { // Paper - fix wrong block state @@ -187,8 +187,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java +++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java @@ -0,0 +0,0 @@ public class WaterlilyBlock extends BushBlock { - if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (world instanceof ServerLevel && entity instanceof Boat) { + super.entityInside(state, world, pos, entity); + if (world instanceof ServerLevel && entity instanceof AbstractBoat) { // CraftBukkit start - if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) { + if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state @@ -199,7 +199,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ public class CraftEventFactory { +@@ -0,0 +0,0 @@ populateFields(victim, event); // Paper - make cancellable return event; } diff --git a/patches/unapplied/server/Fix-saving-in-unloadWorld.patch b/patches/server/Fix-saving-in-unloadWorld.patch similarity index 100% rename from patches/unapplied/server/Fix-saving-in-unloadWorld.patch rename to patches/server/Fix-saving-in-unloadWorld.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-swamp-hut-cat-generation-deadlock.patch b/patches/server/Fix-swamp-hut-cat-generation-deadlock.patch similarity index 89% rename from patches/unapplied/server/Fix-swamp-hut-cat-generation-deadlock.patch rename to patches/server/Fix-swamp-hut-cat-generation-deadlock.patch index cafdf56803..5fac7028f0 100644 --- a/patches/unapplied/server/Fix-swamp-hut-cat-generation-deadlock.patch +++ b/patches/server/Fix-swamp-hut-cat-generation-deadlock.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK).isValid()) { + if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK, world).isValid()) { // Paper - Fix swamp hut cat generation deadlock - this.setVariant((Holder) BuiltInRegistries.CAT_VARIANT.getHolderOrThrow(CatVariant.ALL_BLACK)); + this.setVariant((Holder) BuiltInRegistries.CAT_VARIANT.getOrThrow(CatVariant.ALL_BLACK)); this.setPersistenceRequired(); } diff --git a/src/main/java/net/minecraft/world/level/StructureManager.java b/src/main/java/net/minecraft/world/level/StructureManager.java @@ -54,11 +54,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public StructureStart getStructureWithPieceAt(BlockPos pos, Predicate> predicate, @Nullable ServerLevelAccessor levelAccessor) { + // Paper end - Fix swamp hut cat generation deadlock - Registry registry = this.registryAccess().registryOrThrow(Registries.STRUCTURE); + Registry registry = this.registryAccess().lookupOrThrow(Registries.STRUCTURE); for (StructureStart structureStart : this.startsForStructure( -- new ChunkPos(pos), structure -> registry.getHolder(registry.getId(structure)).map(predicate::test).orElse(false) -+ new ChunkPos(pos), structure -> registry.getHolder(registry.getId(structure)).map(predicate::test).orElse(false), levelAccessor // Paper - Fix swamp hut cat generation deadlock +- new ChunkPos(pos), structure -> registry.get(registry.getId(structure)).map(predicate::test).orElse(false) ++ new ChunkPos(pos), structure -> registry.get(registry.getId(structure)).map(predicate::test).orElse(false), levelAccessor // Paper - Fix swamp hut cat generation deadlock )) { if (this.structureHasPieceAt(pos, structureStart)) { return structureStart; diff --git a/patches/unapplied/server/Fix-xp-reward-for-baby-zombies.patch b/patches/server/Fix-xp-reward-for-baby-zombies.patch similarity index 87% rename from patches/unapplied/server/Fix-xp-reward-for-baby-zombies.patch rename to patches/server/Fix-xp-reward-for-baby-zombies.patch index 807669a5b8..83f63e3be8 100644 --- a/patches/unapplied/server/Fix-xp-reward-for-baby-zombies.patch +++ b/patches/server/Fix-xp-reward-for-baby-zombies.patch @@ -15,15 +15,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Zombie extends Monster { @Override - protected int getBaseExperienceReward() { + protected int getBaseExperienceReward(ServerLevel world) { + final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward if (this.isBaby()) { this.xpReward = (int) ((double) this.xpReward * 2.5D); } -- return super.getBaseExperienceReward(); +- return super.getBaseExperienceReward(world); + // Paper start - store previous value to reset after calculating XP reward -+ int reward = super.getBaseExperienceReward(); ++ int reward = super.getBaseExperienceReward(world); + this.xpReward = previousReward; + return reward; + // Paper end - store previous value to reset after calculating XP reward diff --git a/patches/unapplied/server/Force-close-world-loading-screen.patch b/patches/server/Force-close-world-loading-screen.patch similarity index 79% rename from patches/unapplied/server/Force-close-world-loading-screen.patch rename to patches/server/Force-close-world-loading-screen.patch index 597e1b3551..afab1e9cef 100644 --- a/patches/unapplied/server/Force-close-world-loading-screen.patch +++ b/patches/server/Force-close-world-loading-screen.patch @@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - this.sendActivePlayerEffects(player); - // Paper start - Fire PlayerJoinEvent when Player is actually ready; move vehicle into method so it can be called above - short circuit around that code - this.onPlayerJoinFinish(player, worldserver1, s1); + this.registries = registryManager; + this.maxPlayers = maxPlayers; + this.playerIo = saveHandler; + // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead + if (player.isDeadOrDying()) { + net.minecraft.core.Holder plains = worldserver1.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME) @@ -28,5 +28,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - Send empty chunk } - private void mountSavedVehicle(ServerPlayer player, ServerLevel worldserver1, Optional optional) { - // Paper end - Fire PlayerJoinEvent when Player is actually ready + abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor + diff --git a/patches/unapplied/server/Freeze-Tick-Lock-API.patch b/patches/server/Freeze-Tick-Lock-API.patch similarity index 86% rename from patches/unapplied/server/Freeze-Tick-Lock-API.patch rename to patches/server/Freeze-Tick-Lock-API.patch index 0f07fc1114..0ecce634c5 100644 --- a/patches/unapplied/server/Freeze-Tick-Lock-API.patch +++ b/patches/server/Freeze-Tick-Lock-API.patch @@ -17,14 +17,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void setOrigin(@javax.annotation.Nonnull Location location) { this.origin = location.toVector(); @@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.setRemainingFireTicks(this.remainingFireTicks - 1); - } + this.setRemainingFireTicks(this.remainingFireTicks - 1); + } -- if (this.getTicksFrozen() > 0) { -+ if (this.getTicksFrozen() > 0 && !freezeLocked) { // Paper - Freeze Tick Lock API - this.setTicksFrozen(0); - this.level().levelEvent((Player) null, 1009, this.blockPosition, 1); - } +- if (this.getTicksFrozen() > 0) { ++ if (this.getTicksFrozen() > 0 && !freezeLocked) { // Paper - Freeze Tick Lock API + this.setTicksFrozen(0); + this.level().levelEvent((Player) null, 1009, this.blockPosition, 1); + } @@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (fromNetherPortal) { nbttagcompound.putBoolean("Paper.FromNetherPortal", true); @@ -50,9 +50,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - - this.level().getProfiler().pop(); - this.level().getProfiler().push("freezing"); + this.calculateEntityAnimation(this instanceof FlyingAnimal); + gameprofilerfiller.pop(); + gameprofilerfiller.push("freezing"); - if (!this.level().isClientSide && !this.isDeadOrDying()) { + if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API int i = this.getTicksFrozen(); diff --git a/patches/unapplied/server/Furnace-RecipesUsed-API.patch b/patches/server/Furnace-RecipesUsed-API.patch similarity index 100% rename from patches/unapplied/server/Furnace-RecipesUsed-API.patch rename to patches/server/Furnace-RecipesUsed-API.patch diff --git a/patches/unapplied/server/Implement-enchantWithLevels-API.patch b/patches/server/Implement-enchantWithLevels-API.patch similarity index 100% rename from patches/unapplied/server/Implement-enchantWithLevels-API.patch rename to patches/server/Implement-enchantWithLevels-API.patch diff --git a/patches/unapplied/server/Implement-getComputedBiome-API.patch b/patches/server/Implement-getComputedBiome-API.patch similarity index 100% rename from patches/unapplied/server/Implement-getComputedBiome-API.patch rename to patches/server/Implement-getComputedBiome-API.patch diff --git a/patches/unapplied/server/Make-some-itemstacks-nonnull.patch b/patches/server/Make-some-itemstacks-nonnull.patch similarity index 100% rename from patches/unapplied/server/Make-some-itemstacks-nonnull.patch rename to patches/server/Make-some-itemstacks-nonnull.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 100% rename from patches/unapplied/server/Make-water-animal-spawn-height-configurable.patch rename to patches/server/Make-water-animal-spawn-height-configurable.patch diff --git a/patches/unapplied/server/More-PotionEffectType-API.patch b/patches/server/More-PotionEffectType-API.patch similarity index 100% rename from patches/unapplied/server/More-PotionEffectType-API.patch rename to patches/server/More-PotionEffectType-API.patch diff --git a/patches/unapplied/server/More-Projectile-API.patch b/patches/server/More-Projectile-API.patch similarity index 96% rename from patches/unapplied/server/More-Projectile-API.patch rename to patches/server/More-Projectile-API.patch index 98d347b384..051904e3fd 100644 --- a/patches/unapplied/server/More-Projectile-API.patch +++ b/patches/server/More-Projectile-API.patch @@ -69,7 +69,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie +@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile { @Override protected void onHit(HitResult hitResult) { super.onHit(hitResult); @@ -78,28 +78,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + public void splash(@Nullable HitResult hitResult) { + // Paper end - More projectile API - if (!this.level().isClientSide) { + Level world = this.level(); +- + if (world instanceof ServerLevel worldserver) { ItemStack itemstack = this.getItem(); PotionContents potioncontents = (PotionContents) itemstack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie +@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile { if (this.isLingering()) { showParticles = this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper } else { -- showParticles = this.applySplash(potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper -+ showParticles = this.applySplash(potioncontents.getAllEffects(), hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper - More projectile API +- showParticles = this.applySplash(worldserver, potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper ++ showParticles = this.applySplash(worldserver, potioncontents.getAllEffects(), hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper - More projectile API } } -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie +@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile { } -- private boolean applySplash(Iterable iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events -+ private boolean applySplash(Iterable iterable, @Nullable Entity entity, @Nullable HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events & More projectile API +- private boolean applySplash(ServerLevel worldserver, Iterable iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events ++ private boolean applySplash(ServerLevel worldserver, Iterable iterable, @Nullable Entity entity, @Nullable HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events & More projectile API AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D); - List list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb); + List list = worldserver.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb); Map affected = new HashMap(); // CraftBukkit -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie +@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile { } @@ -275,7 +277,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud public void clearCustomEffects() { PotionContents old = this.getHandle().potionContents; - this.getHandle().setPotionContents(new PotionContents(old.potion(), old.customColor(), List.of())); + this.getHandle().setPotionContents(new PotionContents(old.potion(), old.customColor(), List.of(), old.customName())); - this.getHandle().updateColor(); + // this.getHandle().updateColor(); // Paper - already done above } @@ -297,7 +299,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow { public void clearCustomEffects() { PotionContents old = this.getHandle().getPotionContents(); - this.getHandle().setPotionContents(new PotionContents(old.potion(), old.customColor(), List.of())); + this.getHandle().setPotionContents(new PotionContents(old.potion(), old.customColor(), List.of(), old.customName())); - this.getHandle().updateColor(); + // this.getHandle().updateColor(); // Paper - already done above } @@ -310,7 +312,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - int colorRGB = (color == null) ? -1 : color.asRGB(); + int colorRGB = (color == null) ? net.minecraft.world.entity.projectile.Arrow.NO_EFFECT_COLOR : color.asARGB(); // Paper PotionContents old = this.getHandle().getPotionContents(); - this.getHandle().setPotionContents(new PotionContents(old.potion(), Optional.of(colorRGB), old.customEffects())); + this.getHandle().setPotionContents(new PotionContents(old.potion(), Optional.of(colorRGB), old.customEffects(), old.customName())); } @Override @@ -335,8 +337,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - register(new EntityTypeData<>(EntityType.FIREWORK_ROCKET, Firework.class, CraftFirework::new, spawnData -> new FireworkRocketEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), net.minecraft.world.item.ItemStack.EMPTY))); + register(new EntityTypeData<>(EntityType.FIREWORK_ROCKET, Firework.class, CraftFirework::new, spawnData -> new FireworkRocketEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), FireworkRocketEntity.getDefaultItem()))); // Paper - pass correct default to rocket for data storage register(new EntityTypeData<>(EntityType.EVOKER_FANGS, EvokerFangs.class, CraftEvokerFangs::new, spawnData -> new net.minecraft.world.entity.projectile.EvokerFangs(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), (float) Math.toRadians(spawnData.yaw()), 0, null))); - register(new EntityTypeData<>(EntityType.COMMAND_BLOCK_MINECART, CommandMinecart.class, CraftMinecartCommand::new, spawnData -> new MinecartCommandBlock(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); - register(new EntityTypeData<>(EntityType.MINECART, RideableMinecart.class, CraftMinecartRideable::new, spawnData -> new Minecart(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); + register(new EntityTypeData<>(EntityType.COMMAND_BLOCK_MINECART, CommandMinecart.class, CraftMinecartCommand::new, createMinecart(net.minecraft.world.entity.EntityType.COMMAND_BLOCK_MINECART))); + register(new EntityTypeData<>(EntityType.MINECART, RideableMinecart.class, CraftMinecartRideable::new, createMinecart(net.minecraft.world.entity.EntityType.MINECART))); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java @@ -546,7 +548,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ((net.minecraft.world.entity.projectile.AbstractArrow) launch).shootFromRotation(this.getHandle(), this.getHandle().getXRot(), this.getHandle().getYRot(), 0.0F, Trident.class.isAssignableFrom(projectile) ? net.minecraft.world.item.TridentItem.SHOOT_POWER : 3.0F, 1.0F); // ItemBow // Paper - see TridentItem } else if (ThrownPotion.class.isAssignableFrom(projectile)) { if (LingeringPotion.class.isAssignableFrom(projectile)) { - launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, this.getHandle()); + launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, this.getHandle(), new net.minecraft.world.item.ItemStack(Items.LINGERING_POTION)); @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } else if (Firework.class.isAssignableFrom(projectile)) { Location location = this.getEyeLocation(); @@ -905,7 +907,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (false && Fireball.class.isAssignableFrom(projectile)) { // Paper - more project API - dispensers cannot launch anything but fire charges. AbstractHurtingProjectile customFireball = null; if (WitherSkull.class.isAssignableFrom(projectile)) { - launch = customFireball = EntityType.WITHER_SKULL.create(world); + launch = customFireball = EntityType.WITHER_SKULL.create(world, EntitySpawnReason.TRIGGERED); @@ -0,0 +0,0 @@ public class CraftBlockProjectileSource implements BlockProjectileSource { } } diff --git a/patches/unapplied/server/Multi-Block-Change-API-Implementation.patch b/patches/server/Multi-Block-Change-API-Implementation.patch similarity index 100% rename from patches/unapplied/server/Multi-Block-Change-API-Implementation.patch rename to patches/server/Multi-Block-Change-API-Implementation.patch diff --git a/patches/unapplied/server/Multiple-Entries-with-Scoreboards.patch b/patches/server/Multiple-Entries-with-Scoreboards.patch similarity index 100% rename from patches/unapplied/server/Multiple-Entries-with-Scoreboards.patch rename to patches/server/Multiple-Entries-with-Scoreboards.patch diff --git a/patches/unapplied/server/Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/Option-to-have-default-CustomSpawners-in-custom-worl.patch similarity index 100% rename from patches/unapplied/server/Option-to-have-default-CustomSpawners-in-custom-worl.patch rename to patches/server/Option-to-have-default-CustomSpawners-in-custom-worl.patch diff --git a/patches/unapplied/server/Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/Prevent-tile-entity-copies-loading-chunks.patch similarity index 100% rename from patches/unapplied/server/Prevent-tile-entity-copies-loading-chunks.patch rename to patches/server/Prevent-tile-entity-copies-loading-chunks.patch diff --git a/patches/unapplied/server/Put-world-into-worldlist-before-initing-the-world.patch b/patches/server/Put-world-into-worldlist-before-initing-the-world.patch similarity index 97% rename from patches/unapplied/server/Put-world-into-worldlist-before-initing-the-world.patch rename to patches/server/Put-world-into-worldlist-before-initing-the-world.patch index 15758c20a0..d6a006706e 100644 --- a/patches/unapplied/server/Put-world-into-worldlist-before-initing-the-world.patch +++ b/patches/server/Put-world-into-worldlist-before-initing-the-world.patch @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.console.addLevel(internal); // Paper - Put world into worldlist before initing the world; move up this.console.initWorld(internal, worlddata, worlddata, worlddata.worldGenOptions()); - internal.setSpawnSettings(true, true); + internal.setSpawnSettings(true); - this.console.addLevel(internal); + // Paper - Put world into worldlist before initing the world; move up diff --git a/patches/unapplied/server/Reset-placed-block-on-exception.patch b/patches/server/Reset-placed-block-on-exception.patch similarity index 100% rename from patches/unapplied/server/Reset-placed-block-on-exception.patch rename to patches/server/Reset-placed-block-on-exception.patch diff --git a/patches/unapplied/server/Use-a-CHM-for-StructureTemplate.Pallete-cache.patch b/patches/server/Use-a-CHM-for-StructureTemplate.Pallete-cache.patch similarity index 92% rename from patches/unapplied/server/Use-a-CHM-for-StructureTemplate.Pallete-cache.patch rename to patches/server/Use-a-CHM-for-StructureTemplate.Pallete-cache.patch index 3585603518..e027f9acf7 100644 --- a/patches/unapplied/server/Use-a-CHM-for-StructureTemplate.Pallete-cache.patch +++ b/patches/server/Use-a-CHM-for-StructureTemplate.Pallete-cache.patch @@ -15,6 +15,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final List blocks; - private final Map> cache = Maps.newHashMap(); + private final Map> cache = Maps.newConcurrentMap(); // Paper - Fix CME due to this collection being shared across threads + @Nullable + private List cachedJigsaws; - Palette(List infos) { - this.blocks = infos; diff --git a/patches/unapplied/server/Use-username-instead-of-display-name-in-PlayerList-g.patch b/patches/server/Use-username-instead-of-display-name-in-PlayerList-g.patch similarity index 100% rename from patches/unapplied/server/Use-username-instead-of-display-name-in-PlayerList-g.patch rename to patches/server/Use-username-instead-of-display-name-in-PlayerList-g.patch diff --git a/patches/unapplied/server/Validate-usernames.patch b/patches/server/Validate-usernames.patch similarity index 100% rename from patches/unapplied/server/Validate-usernames.patch rename to patches/server/Validate-usernames.patch diff --git a/patches/unapplied/server/WorldCreator-keepSpawnLoaded.patch b/patches/server/WorldCreator-keepSpawnLoaded.patch similarity index 100% rename from patches/unapplied/server/WorldCreator-keepSpawnLoaded.patch rename to patches/server/WorldCreator-keepSpawnLoaded.patch diff --git a/patches/unapplied/server/fix-player-loottables-running-when-mob-loot-gamerule.patch b/patches/server/fix-player-loottables-running-when-mob-loot-gamerule.patch similarity index 93% rename from patches/unapplied/server/fix-player-loottables-running-when-mob-loot-gamerule.patch rename to patches/server/fix-player-loottables-running-when-mob-loot-gamerule.patch index 3973a896aa..ae84af00a7 100644 --- a/patches/unapplied/server/fix-player-loottables-running-when-mob-loot-gamerule.patch +++ b/patches/server/fix-player-loottables-running-when-mob-loot-gamerule.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - fix player loottables running when mob loot gamerule is false // SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule) - this.dropFromLootTable(damageSource, this.lastHurtByPlayerTime > 0); + this.dropFromLootTable(this.serverLevel(), damageSource, this.lastHurtByPlayerTime > 0); this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag); loot.addAll(this.drops); diff --git a/patches/unapplied/server/Add-TameableDeathMessageEvent.patch b/patches/unapplied/server/Add-TameableDeathMessageEvent.patch deleted file mode 100644 index 7a418fe3e5..0000000000 --- a/patches/unapplied/server/Add-TameableDeathMessageEvent.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Mon, 21 Jun 2021 21:24:45 -0400 -Subject: [PATCH] Add TameableDeathMessageEvent - - -diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java -+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -@@ -0,0 +0,0 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { - @Override - public void die(DamageSource damageSource) { - if (!this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) && this.getOwner() instanceof ServerPlayer) { -- this.getOwner().sendSystemMessage(this.getCombatTracker().getDeathMessage()); -+ // Paper start - Add TameableDeathMessageEvent -+ io.papermc.paper.event.entity.TameableDeathMessageEvent event = new io.papermc.paper.event.entity.TameableDeathMessageEvent((org.bukkit.entity.Tameable) getBukkitEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getCombatTracker().getDeathMessage())); -+ if (event.callEvent()) { -+ this.getOwner().sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.deathMessage())); -+ } -+ // Paper end - Add TameableDeathMessageEvent - } - - super.die(damageSource); diff --git a/patches/unapplied/server/Expand-PlayerItemDamageEvent.patch b/patches/unapplied/server/Expand-PlayerItemDamageEvent.patch deleted file mode 100644 index a3b8ef8d07..0000000000 --- a/patches/unapplied/server/Expand-PlayerItemDamageEvent.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: HexedHero <6012891+HexedHero@users.noreply.github.com> -Date: Sun, 10 Apr 2022 06:26:32 +0100 -Subject: [PATCH] Expand PlayerItemDamageEvent - - -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { - if (this.isDamageableItem()) { - if (player == null || !player.hasInfiniteMaterials()) { - if (amount > 0) { -+ int originalDamage = amount; // Paper - Expand PlayerItemDamageEvent - amount = EnchantmentHelper.processDurabilityChange(world, this, amount); - // CraftBukkit start - if (player instanceof ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent -- PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper - Add EntityDamageItemEvent -+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount, originalDamage); // Paper - Add EntityDamageItemEvent & Expand PlayerItemDamageEvent - event.getPlayer().getServer().getPluginManager().callEvent(event); - - if (amount != event.getDamage() || event.isCancelled()) {