diff --git a/build-data/paper.at b/build-data/paper.at index 1c79532b5a..48a44de360 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -12,3 +12,7 @@ public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/Tick # AT remap issue? todo 1.18 public net.minecraft.world.level.dimension.end.EndDragonFight findExitPortal()Lnet/minecraft/world/level/block/state/pattern/BlockPattern$BlockPatternMatch; public net.minecraft.nbt.TagParser readArrayTag()Lnet/minecraft/nbt/Tag; + +# TODO 1.20 remapSpigotAt.at doesn't remap the return type for this method for some reason +public net/minecraft/world/entity/Display$TextDisplay getText()Lnet/minecraft/network/chat/Component; +public net/minecraft/world/entity/Display$BlockDisplay getBlockState()Lnet/minecraft/world/level/block/state/BlockState; diff --git a/patches/api/Multi-Block-Change-API.patch b/patches/api/Multi-Block-Change-API.patch index 8489c2f8cd..4efe8d8d09 100644 --- a/patches/api/Multi-Block-Change-API.patch +++ b/patches/api/Multi-Block-Change-API.patch @@ -19,9 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param blockChanges A map of the positions you want to change to their new block data + */ -+ default void sendMultiBlockChange(@NotNull Map blockChanges) { -+ this.sendMultiBlockChange(blockChanges, false); -+ } ++ void sendMultiBlockChange(@NotNull Map blockChanges); + + /** + * Send multiple block changes. This fakes a multi block change packet for each @@ -29,8 +27,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param blockChanges A map of the positions you want to change to their new block data + * @param suppressLightUpdates Whether to suppress light updates or not ++ * @deprecated suppressLightUpdates is no longer available in 1.20+, use {@link #sendMultiBlockChange(Map)} + */ -+ void sendMultiBlockChange(@NotNull Map blockChanges, boolean suppressLightUpdates); ++ @Deprecated ++ default void sendMultiBlockChange(@NotNull Map blockChanges, boolean suppressLightUpdates) { ++ this.sendMultiBlockChange(blockChanges); ++ } + // Paper end + /** diff --git a/patches/server/Ability-to-control-player-s-insomnia-and-phantoms.patch b/patches/server/Ability-to-control-player-s-insomnia-and-phantoms.patch index af0b179c39..ad3e5b79d0 100644 --- a/patches/server/Ability-to-control-player-s-insomnia-and-phantoms.patch +++ b/patches/server/Ability-to-control-player-s-insomnia-and-phantoms.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return !entity.isSpectator(); }; public static final Predicate CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); -- public static Predicate isInsomniac = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper +- public static Predicate IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper + // Paper start -+ public static Predicate isInsomniac = (player) -> { ++ public static Predicate IS_INSOMNIAC = (player) -> { + net.minecraft.server.level.ServerPlayer serverPlayer = (net.minecraft.server.level.ServerPlayer) player; -+ int playerInsomniaTicks = serverPlayer.getLevel().paperConfig().entities.behavior.playerInsomniaStartTicks; ++ int playerInsomniaTicks = serverPlayer.level().paperConfig().entities.behavior.playerInsomniaStartTicks; + + if (playerInsomniaTicks <= 0) { + return false; diff --git a/patches/server/Add-BellRevealRaiderEvent.patch b/patches/server/Add-BellRevealRaiderEvent.patch index 3bea43f9b8..efd4d8b45f 100644 --- a/patches/server/Add-BellRevealRaiderEvent.patch +++ b/patches/server/Add-BellRevealRaiderEvent.patch @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + private static void glow(LivingEntity entity) { glow(entity, null); } + private static void glow(LivingEntity entity, @javax.annotation.Nullable BlockPos pos) { -+ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level.getWorld().getBlockAt(io.papermc.paper.util.MCUtil.toLocation(entity.level, pos)), entity.getBukkitEntity()).callEvent()) return; ++ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level().getWorld().getBlockAt(io.papermc.paper.util.MCUtil.toLocation(entity.level(), pos)), entity.getBukkitEntity()).callEvent()) return; + // Paper end entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60)); } diff --git a/patches/server/Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch index 1b1a04877e..67c8675967 100644 --- a/patches/server/Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch +++ b/patches/server/Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch @@ -235,7 +235,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + merchantRecipe.increaseUses(); + } + if (event == null || event.isRewardingExp()) { -+ this.tradingPlayer.level.addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(tradingPlayer.level, tradingPlayer.getX(), tradingPlayer.getY(), tradingPlayer.getZ(), merchantRecipe.getXp(), org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.tradingPlayer, null)); ++ this.tradingPlayer.level().addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(this.tradingPlayer.level(), this.tradingPlayer.getX(), this.tradingPlayer.getY(), this.tradingPlayer.getZ(), merchantRecipe.getXp(), org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.tradingPlayer, null)); + } + } + this.notifyTrade(merchantRecipe); diff --git a/patches/server/Add-WardenAngerChangeEvent.patch b/patches/server/Add-WardenAngerChangeEvent.patch index 257a5cf510..a595e0da21 100644 --- a/patches/server/Add-WardenAngerChangeEvent.patch +++ b/patches/server/Add-WardenAngerChangeEvent.patch @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + int activeAnger = this.angerManagement.getActiveAnger(entity); + io.papermc.paper.event.entity.WardenAngerChangeEvent event = new io.papermc.paper.event.entity.WardenAngerChangeEvent((org.bukkit.entity.Warden) this.getBukkitEntity(), entity.getBukkitEntity(), activeAnger, Math.min(150, activeAnger + amount)); -+ this.level.getCraftServer().getPluginManager().callEvent(event); ++ this.level().getCraftServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return; + } diff --git a/patches/server/Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/Add-config-for-mobs-immune-to-default-effects.patch index 3552bff64a..9f6acc617a 100644 --- a/patches/server/Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/Add-config-for-mobs-immune-to-default-effects.patch @@ -52,6 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean canBeAffected(MobEffectInstance effect) { - return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect); -+ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper ++ return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper } } diff --git a/patches/server/Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/Add-paper-mobcaps-and-paper-playermobcaps.patch index 58b49f9790..6a84a75e15 100644 --- a/patches/server/Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + final ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); -+ final ServerLevel level = serverPlayer.getLevel(); ++ final ServerLevel level = serverPlayer.serverLevel(); + + if (!level.paperConfig().entities.spawning.perPlayerMobSpawns) { + sender.sendMessage(Component.text("Use '/paper mobcaps' for worlds where per-player mob spawning is disabled.", NamedTextColor.RED)); diff --git a/patches/server/Add-phantom-creative-and-insomniac-controls.patch b/patches/server/Add-phantom-creative-and-insomniac-controls.patch index 845cf44c55..d2e2b523c3 100644 --- a/patches/server/Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/Add-phantom-creative-and-insomniac-controls.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return !entity.isSpectator(); }; public static final Predicate CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); -+ public static Predicate isInsomniac = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper ++ public static Predicate IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper private EntitySelector() {} // Paper start @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Player entityhuman = (Player) iterator.next(); if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { -+ if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.isInsomniac.test(entityhuman)) // Paper ++ if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.IS_INSOMNIAC.test(entityhuman)) // Paper Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason return true; } diff --git a/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch index 25045a0d6b..88cc7c57ca 100644 --- a/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch +++ b/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 float f = difficulty.getSpecialMultiplier(); - this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f); -+ this.setCanPickUpLoot(this.level.paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper ++ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper if (object == null) { object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true); } diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index b63a7e9b2a..7ab2c3e07a 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -479,7 +479,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + final Set viewers = event.viewers(); + final ResourceKey chatTypeKey = renderer instanceof ChatRenderer.Default ? ChatType.CHAT : ChatType.RAW; -+ final ChatType.Bound chatType = ChatType.bind(chatTypeKey, this.player().level.registryAccess(), PaperAdventure.asVanilla(displayName(player))); ++ final ChatType.Bound chatType = ChatType.bind(chatTypeKey, this.player.level().registryAccess(), PaperAdventure.asVanilla(displayName(player))); + + OutgoingChat outgoingChat = viewers instanceof LazyChatAudienceSet lazyAudienceSet && lazyAudienceSet.isLazy() ? new ServerOutgoingChat() : new ViewersOutgoingChat(); + /* if (this.flags.get(FORCE_PREVIEW_USE)) { // TODO (future, maybe?) diff --git a/patches/server/Allow-to-change-the-podium-for-the-EnderDragon.patch b/patches/server/Allow-to-change-the-podium-for-the-EnderDragon.patch index ceb703ca6a..b111f0376c 100644 --- a/patches/server/Allow-to-change-the-podium-for-the-EnderDragon.patch +++ b/patches/server/Allow-to-change-the-podium-for-the-EnderDragon.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + public BlockPos getPodium() { + if (this.podium == null) { -+ return EndPodiumFeature.END_PODIUM_LOCATION; ++ return EndPodiumFeature.getLocation(this.getFightOrigin()); + } + return this.podium; + } diff --git a/patches/server/Configurable-sculk-sensor-listener-range.patch b/patches/server/Configurable-sculk-sensor-listener-range.patch index 1200d845b1..1df84f4c53 100644 --- a/patches/server/Configurable-sculk-sensor-listener-range.patch +++ b/patches/server/Configurable-sculk-sensor-listener-range.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.vibrationData = listener; }); } -+ if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) this.listener.listenerRange = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); // Paper ++ if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) this.getListener().rangeOverride = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); // Paper } @@ -26,10 +26,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> { nbt.put("listener", listenerNbt); }); -+ if (this.listener.listenerRange != ((SculkSensorBlock) net.minecraft.world.level.block.Blocks.SCULK_SENSOR).getListenerRange()) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.listener.listenerRange); // Paper - only save if it's different from the default ++ if (this.getListener().rangeOverride != null || this.getListener().rangeOverride != VibrationUser.LISTENER_RANGE) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.getListener().rangeOverride); // Paper - only save if it's different from the default } @Override +diff --git a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java +@@ -0,0 +0,0 @@ public interface VibrationSystem { + public static class Listener implements GameEventListener { + + private final VibrationSystem system; ++ @Nullable public Integer rangeOverride = null; // Paper + + public Listener(VibrationSystem receiver) { + this.system = receiver; +@@ -0,0 +0,0 @@ public interface VibrationSystem { + + @Override + public int getListenerRadius() { ++ if (this.rangeOverride != null) return this.rangeOverride; // Paper + return this.system.getVibrationUser().getListenerRadius(); + } + diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java @@ -41,13 +61,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override + public int getListenerRange() { -+ return this.getSnapshot().getListener().listenerRange; ++ return this.getSnapshot().getListener().getListenerRadius(); + } + + @Override + public void setListenerRange(int range) { + Preconditions.checkArgument(range > 0, "Vibration listener range must be greater than 0"); -+ this.getSnapshot().getListener().listenerRange = range; ++ this.getSnapshot().getListener().rangeOverride = range; + } + // Paper end } diff --git a/patches/server/Detail-more-information-in-watchdog-dumps.patch b/patches/server/Detail-more-information-in-watchdog-dumps.patch index 7e0be52c44..9e24d48000 100644 --- a/patches/server/Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/Detail-more-information-in-watchdog-dumps.patch @@ -230,7 +230,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + String entityType = net.minecraft.world.entity.EntityType.getKey(entity.getType()).toString(); + java.util.UUID entityUUID = entity.getUUID(); -+ net.minecraft.world.level.Level world = entity.level; ++ net.minecraft.world.level.Level world = entity.level(); + + log.log(Level.SEVERE, "Ticking entity: " + entityType + ", entity class: " + entity.getClass().getName()); + log.log(Level.SEVERE, "Entity status: removed: " + entity.isRemoved() + ", valid: " + entity.valid + ", alive: " + entity.isAlive() + ", is passenger: " + entity.isPassenger()); diff --git a/patches/server/Dolphin-API.patch b/patches/server/Dolphin-API.patch index 4917802d36..89d7135523 100644 --- a/patches/server/Dolphin-API.patch +++ b/patches/server/Dolphin-API.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public org.bukkit.Location getTreasureLocation() { -+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level, this.getHandle().getTreasurePos()); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getTreasurePos()); + } + + @Override diff --git a/patches/server/Fix-invulnerable-end-crystals.patch b/patches/server/Fix-invulnerable-end-crystals.patch index d98c2db362..14488ae949 100644 --- a/patches/server/Fix-invulnerable-end-crystals.patch +++ b/patches/server/Fix-invulnerable-end-crystals.patch @@ -22,11 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end } + // Paper start - Fix invulnerable end crystals -+ if (this.level.paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { -+ if (!java.util.Objects.equals(((ServerLevel) this.level).uuid, this.getOriginWorld()) -+ || ((ServerLevel) this.level).dragonFight() == null -+ || ((ServerLevel) this.level).dragonFight().respawnStage == null -+ || ((ServerLevel) this.level).dragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) { ++ if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { ++ if (!java.util.Objects.equals(((ServerLevel) this.level()).uuid, this.getOriginWorld()) ++ || ((ServerLevel) this.level()).getDragonFight() == null ++ || ((ServerLevel) this.level()).getDragonFight().respawnStage == null ++ || ((ServerLevel) this.level()).getDragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) { + this.setInvulnerable(false); + this.setBeamTarget(null); + } diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index d7f77eada7..490be31b16 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -6202,21 +6202,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( -+ this.level, x, z, ChunkHolder.FullChunkStatus.ENTITY_TICKING, true, ++ this.level, x, z, FullChunkStatus.ENTITY_TICKING, true, + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ); + } + + public void getTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( -+ this.level, x, z, ChunkHolder.FullChunkStatus.TICKING, true, ++ this.level, x, z, FullChunkStatus.BLOCK_TICKING, true, + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ); + } + + public void getFullChunkAsync(int x, int z, java.util.function.Consumer onLoad) { + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( -+ this.level, x, z, ChunkHolder.FullChunkStatus.BORDER, true, ++ this.level, x, z, FullChunkStatus.FULL, true, + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ); + } diff --git a/patches/server/Missing-Entity-Behavior-API.patch b/patches/server/Missing-Entity-Behavior-API.patch index 719241c70c..27fe53ab18 100644 --- a/patches/server/Missing-Entity-Behavior-API.patch +++ b/patches/server/Missing-Entity-Behavior-API.patch @@ -444,7 +444,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + -+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos); + } + + @Override @@ -885,7 +885,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + -+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos); + } + + @Override @@ -1172,7 +1172,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + -+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos); + } + + @Override diff --git a/patches/server/Multi-Block-Change-API-Implementation.patch b/patches/server/Multi-Block-Change-API-Implementation.patch index bf7b3e249d..3744c4686a 100644 --- a/patches/server/Multi-Block-Change-API-Implementation.patch +++ b/patches/server/Multi-Block-Change-API-Implementation.patch @@ -13,11 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper start -+ public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap blockChanges, boolean suppressLightUpdates) { ++ public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap blockChanges) { + this.sectionPos = sectionPos; + this.positions = blockChanges.keySet().toShortArray(); + this.states = blockChanges.values().toArray(new BlockState[0]); -+ this.suppressLightUpdates = suppressLightUpdates; + } + // Paper end + @@ -34,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override -+ public void sendMultiBlockChange(final Map blockChanges, final boolean suppressLightUpdates) { ++ public void sendMultiBlockChange(final Map blockChanges) { + if (this.getHandle().connection == null) return; + + Map> sectionMap = new HashMap<>(); @@ -52,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + SectionPos sectionPos = entry.getKey(); + it.unimi.dsi.fastutil.shorts.Short2ObjectMap blockData = entry.getValue(); + -+ net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket packet = new net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket(sectionPos, blockData, suppressLightUpdates); ++ net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket packet = new net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket(sectionPos, blockData); + this.getHandle().connection.send(packet); + } + } diff --git a/patches/server/Properly-resend-entities.patch b/patches/server/Properly-resend-entities.patch index 2ba286c5f0..93b57013ef 100644 --- a/patches/server/Properly-resend-entities.patch +++ b/patches/server/Properly-resend-entities.patch @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + net.minecraft.server.level.ServerEntity serverEntity = this.entity.tracker.serverEntity; + if (player.getBukkitEntity().canSee(entity.getBukkitEntity())) { -+ serverEntity.sendPairingData(player.connection::send, player); ++ serverEntity.sendPairingData(player, player.connection::send); + } + } + // Paper end diff --git a/patches/server/Rewrite-chunk-system.patch b/patches/server/Rewrite-chunk-system.patch index 78c0ce2a64..675c29204b 100644 --- a/patches/server/Rewrite-chunk-system.patch +++ b/patches/server/Rewrite-chunk-system.patch @@ -10939,6 +10939,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ChunkHolder; ++import net.minecraft.server.level.ChunkLevel; +import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.FullChunkStatus; +import net.minecraft.server.level.ServerLevel; @@ -11520,8 +11521,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + // ticket level state -+ private int oldTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1; -+ private int currentTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1; ++ private int oldTicketLevel = ChunkLevel.MAX_LEVEL + 1; ++ private int currentTicketLevel = ChunkLevel.MAX_LEVEL + 1; + + public int getTicketLevel() { + return this.currentTicketLevel; @@ -11605,7 +11606,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + // chunk must be marked inaccessible (i.e unloaded to plugins) -+ if (this.getChunkStatus() != ChunkHolder.FullChunkStatus.INACCESSIBLE) { ++ if (this.getChunkStatus() != FullChunkStatus.INACCESSIBLE) { + return "fullchunkstatus"; + } + @@ -11844,8 +11845,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + this.oldTicketLevel = newLevel; + -+ final ChunkHolder.FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel); -+ final ChunkHolder.FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel); ++ final FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel); ++ final FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel); + final boolean oldUnloaded = oldLevel > ChunkHolderManager.MAX_TICKET_LEVEL; + final boolean newUnloaded = newLevel > ChunkHolderManager.MAX_TICKET_LEVEL; + @@ -11853,7 +11854,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final ChunkStatus maxGenerationStatusNew = ChunkHolder.getStatus(newLevel); + + // check for cancellations from downgrading ticket level -+ if (this.requestedGenStatus != null && !newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && newLevel > oldLevel) { ++ if (this.requestedGenStatus != null && !newState.isOrAfter(FullChunkStatus.FULL) && newLevel > oldLevel) { + // note: cancel() may invoke onChunkGenComplete synchronously here + if (newUnloaded) { + // need to cancel all tasks @@ -11888,7 +11889,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (newState != oldState) { + if (newState.isOrAfter(oldState)) { + // status upgrade -+ if (!oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { ++ if (!oldState.isOrAfter(FullChunkStatus.FULL) && newState.isOrAfter(FullChunkStatus.FULL)) { + // may need to schedule full load + if (this.currentGenStatus != ChunkStatus.FULL) { + if (this.requestedGenStatus != null) { @@ -11905,16 +11906,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } else { + // status downgrade -+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING)) { -+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.ENTITY_TICKING, null); ++ if (!newState.isOrAfter(FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(FullChunkStatus.ENTITY_TICKING)) { ++ this.completeFullStatusConsumers(FullChunkStatus.ENTITY_TICKING, null); + } + -+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING)) { -+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.TICKING, null); ++ if (!newState.isOrAfter(FullChunkStatus.BLOCK_TICKING) && oldState.isOrAfter(FullChunkStatus.BLOCK_TICKING)) { ++ this.completeFullStatusConsumers(FullChunkStatus.BLOCK_TICKING, null); + } + -+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { -+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.BORDER, null); ++ if (!newState.isOrAfter(FullChunkStatus.FULL) && oldState.isOrAfter(FullChunkStatus.FULL)) { ++ this.completeFullStatusConsumers(FullChunkStatus.FULL, null); + } + } + } @@ -13942,6 +13943,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import io.papermc.paper.util.MCUtil; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ChunkHolder; ++import net.minecraft.server.level.FullChunkStatus; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ImposterProtoChunk; @@ -14031,8 +14033,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + int total = 0; + int inactive = 0; -+ int border = 0; -+ int ticking = 0; ++ int full = 0; ++ int blockTicking = 0; + int entityTicking = 0; + + for (final ChunkHolder chunk : io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(world)) { @@ -14042,29 +14044,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + ++total; + -+ ChunkHolder.FullChunkStatus state = chunk.getFullStatus(); ++ FullChunkStatus state = chunk.getFullStatus(); + + switch (state) { + case INACCESSIBLE -> ++inactive; -+ case BORDER -> ++border; -+ case TICKING -> ++ticking; ++ case FULL -> ++full; ++ case BLOCK_TICKING -> ++blockTicking; + case ENTITY_TICKING -> ++entityTicking; + } + } + + accumulatedTotal += total; + accumulatedInactive += inactive; -+ accumulatedBorder += border; -+ accumulatedTicking += ticking; ++ accumulatedBorder += full; ++ accumulatedTicking += blockTicking; + accumulatedEntityTicking += entityTicking; + + sender.sendMessage(text().append(text("Chunks in ", BLUE), text(bukkitWorld.getName(), GREEN), text(":"))); + sender.sendMessage(text().color(DARK_AQUA).append( + text("Total: ", BLUE), text(total), + text(" Inactive: ", BLUE), text(inactive), -+ text(" Border: ", BLUE), text(border), -+ text(" Ticking: ", BLUE), text(ticking), -+ text(" Entity: ", BLUE), text(entityTicking) ++ text(" Full: ", BLUE), text(full), ++ text(" Block Ticking: ", BLUE), text(blockTicking), ++ text(" Entity Ticking: ", BLUE), text(entityTicking) + )); + } + if (worlds.size() > 1) { @@ -14072,9 +14074,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + sender.sendMessage(text().color(DARK_AQUA).append( + text("Total: ", BLUE), text(accumulatedTotal), + text(" Inactive: ", BLUE), text(accumulatedInactive), -+ text(" Border: ", BLUE), text(accumulatedBorder), -+ text(" Ticking: ", BLUE), text(accumulatedTicking), -+ text(" Entity: ", BLUE), text(accumulatedEntityTicking) ++ text(" Full: ", BLUE), text(accumulatedBorder), ++ text(" Block Ticking: ", BLUE), text(accumulatedTicking), ++ text(" Entity Ticking: ", BLUE), text(accumulatedEntityTicking) + )); + } + } @@ -14387,7 +14389,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + JsonObject playerData = new JsonObject(); + players.add(playerData); + -+ Level playerWorld = player.getLevel(); ++ Level playerWorld = player.level(); + org.bukkit.World craftWorld = playerWorld.getWorld(); + Entity.RemovalReason removalReason = player.getRemovalReason(); + diff --git a/patches/server/Turtle-API.patch b/patches/server/Turtle-API.patch index 3bc720aeee..8ccba0b1c7 100644 --- a/patches/server/Turtle-API.patch +++ b/patches/server/Turtle-API.patch @@ -71,27 +71,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override + public org.bukkit.Location getHome() { -+ return io.papermc.paper.util.MCUtil.toLocation(getHandle().getLevel(), getHandle().getHomePos()); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getHomePos()); + } + + @Override + public void setHome(org.bukkit.Location location) { -+ getHandle().setHomePos(io.papermc.paper.util.MCUtil.toBlockPosition(location)); ++ this.getHandle().setHomePos(io.papermc.paper.util.MCUtil.toBlockPosition(location)); + } + + @Override + public boolean isGoingHome() { -+ return getHandle().isGoingHome(); ++ return this.getHandle().isGoingHome(); + } + + @Override + public boolean isDigging() { -+ return getHandle().isLayingEgg(); ++ return this.getHandle().isLayingEgg(); + } + + @Override + public void setHasEgg(boolean hasEgg) { -+ getHandle().setHasEgg(hasEgg); ++ this.getHandle().setHasEgg(hasEgg); + } + // Paper end } diff --git a/patches/server/additions-to-PlayerGameModeChangeEvent.patch b/patches/server/additions-to-PlayerGameModeChangeEvent.patch index f8664214b7..3b9982a734 100644 --- a/patches/server/additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/additions-to-PlayerGameModeChangeEvent.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - extend PlayerGameModeChangeEvent + org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty()); + if (event != null && event.isCancelled()) { -+ source.sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); ++ source.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); } + // Paper end + ++i; @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 logGamemodeChange(context.getSource(), serverPlayer, gameMode); ++i; + } else if (event != null && event.cancelMessage() != null) { -+ context.getSource().sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); ++ context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); + // Paper end } } diff --git a/patches/server/check-global-player-list-where-appropriate.patch b/patches/server/check-global-player-list-where-appropriate.patch index a84c8661b0..323b45ce7c 100644 --- a/patches/server/check-global-player-list-where-appropriate.patch +++ b/patches/server/check-global-player-list-where-appropriate.patch @@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static ServerPlayer tryGetPlayer(@Nullable Entity entity) { + // Paper start - ensure level is the same for sculk events + final ServerPlayer player = tryGetPlayer0(entity); -+ return player != null && player.level == entity.level ? player : null; ++ return player != null && player.level() == entity.level() ? player : null; + } + @Nullable + private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) {