diff --git a/paper-generator/src/main/java/io/papermc/generator/rewriter/registration/PaperPatternSourceSetRewriter.java b/paper-generator/src/main/java/io/papermc/generator/rewriter/registration/PaperPatternSourceSetRewriter.java index 08f65d1620..cb9e66d5ec 100644 --- a/paper-generator/src/main/java/io/papermc/generator/rewriter/registration/PaperPatternSourceSetRewriter.java +++ b/paper-generator/src/main/java/io/papermc/generator/rewriter/registration/PaperPatternSourceSetRewriter.java @@ -48,7 +48,7 @@ public class PaperPatternSourceSetRewriter extends SourceSetRewriterImpl CLASS_HEADER = List.of( suppressWarnings("unused", "SpellCheckingInspection"), diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch index ea820acbd1..9727927366 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch @@ -1073,7 +1073,7 @@ } @Override -@@ -1767,17 +_,25 @@ +@@ -1767,17 +_,24 @@ @Override public void onTickingStart(Entity entity) { @@ -1086,8 +1086,7 @@ ServerLevel.this.entityTickList.remove(entity); + // Paper start - Reset pearls when they stop being ticked + if (ServerLevel.this.paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && ServerLevel.this.paperConfig().misc.legacyEnderPearlBehavior && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { -+ pearl.cachedOwner = null; -+ pearl.ownerUUID = null; ++ pearl.setOwner(null); + } + // Paper end - Reset pearls when they stop being ticked } diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch index ec72ebd4eb..c1c8ee04d7 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch @@ -1355,11 +1355,11 @@ public void loadGameTypes(@Nullable ValueInput input) { + // Paper start - Expand PlayerGameModeChangeEvent -+ if (this.server.getForcedGameType() != null && this.server.getForcedGameType() != readPlayerMode(tag, "playerGameType")) { ++ if (this.server.getForcedGameType() != null && this.server.getForcedGameType() != readPlayerMode(input, "playerGameType")) { + if (new org.bukkit.event.player.PlayerGameModeChangeEvent(this.getBukkitEntity(), org.bukkit.GameMode.getByValue(this.server.getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) { + this.gameMode.setGameModeForPlayer(this.server.getForcedGameType(), GameType.DEFAULT_MODE); + } else { -+ this.gameMode.setGameModeForPlayer(readPlayerMode(input,"playerGameType"), readPlayerMode(tag, "previousPlayerGameType")); ++ this.gameMode.setGameModeForPlayer(readPlayerMode(input,"playerGameType"), readPlayerMode(input, "previousPlayerGameType")); + } + return; + } diff --git a/paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch b/paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch index f65b7938df..da18c6208f 100644 --- a/paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch @@ -114,7 +114,7 @@ + return; + } + -+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); ++ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); + + final net.minecraft.resources.ResourceLocation identifier = packet.payload().type().id(); + final byte[] data = discardedPayload.data(); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/Mob.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/Mob.java.patch index d12afa66b5..74a0fcfb95 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/Mob.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/Mob.java.patch @@ -88,7 +88,7 @@ if (this.isNoAi()) { output.putBoolean("NoAI", this.isNoAi()); } -+ compound.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit ++ output.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch index a176ff3e20..816a48094a 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch @@ -89,7 +89,7 @@ output.putInt("Temper", this.getTemper()); output.putBoolean("Tame", this.isTamed()); EntityReference.store(this.owner, output, "Owner"); -+ compound.putInt("Bukkit.MaxDomestication", this.maxDomestication); // Paper - max domestication ++ output.putInt("Bukkit.MaxDomestication", this.maxDomestication); // Paper - max domestication } @Override @@ -97,7 +97,7 @@ this.setTemper(input.getIntOr("Temper", 0)); this.setTamed(input.getBooleanOr("Tame", false)); this.owner = EntityReference.readWithOldOwnerConversion(input, "Owner", this.level()); -+ this.maxDomestication = compound.getIntOr("Bukkit.MaxDomestication", this instanceof Llama ? 30 : 100); // Paper - max domestication ++ this.maxDomestication = input.getIntOr("Bukkit.MaxDomestication", this instanceof Llama ? 30 : 100); // Paper - max domestication } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/decoration/BlockAttachedEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/decoration/BlockAttachedEntity.java.patch index d9459c367d..1e7680143c 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/decoration/BlockAttachedEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/decoration/BlockAttachedEntity.java.patch @@ -100,9 +100,9 @@ + + // CraftBukkit start - selectively save tile position + @Override -+ public void addAdditionalSaveData(CompoundTag nbt, boolean includeAll) { ++ protected void addAdditionalSaveData(final net.minecraft.world.level.storage.ValueOutput output, final boolean includeAll) { + if (includeAll) { -+ this.addAdditionalSaveData(nbt); ++ this.addAdditionalSaveData(output); + } + } + // CraftBukkit end diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch index c641fe0608..4b66486e6a 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch @@ -72,14 +72,14 @@ - @Override - public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem) { - super.onEquipItem(slot, oldItem, newItem); -+ this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API ++ this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API + } + + // Paper start - shouldBurnInDay API + @Override -+ public void addAdditionalSaveData(final net.minecraft.nbt.CompoundTag nbt) { -+ super.addAdditionalSaveData(nbt); -+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); ++ protected void addAdditionalSaveData(final net.minecraft.world.level.storage.ValueOutput output) { ++ super.addAdditionalSaveData(output); ++ output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); + } + // Paper end - shouldBurnInDay API + diff --git a/paper-server/patches/sources/net/minecraft/world/item/crafting/RecipeManager.java.patch b/paper-server/patches/sources/net/minecraft/world/item/crafting/RecipeManager.java.patch index f7d87732f4..723d1f665f 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/crafting/RecipeManager.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/crafting/RecipeManager.java.patch @@ -17,7 +17,7 @@ + if (this.featureflagset != null) { + this.finalizeRecipeLoading(this.featureflagset); + -+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().reloadRecipes(); ++ net.minecraft.server.MinecraftServer.getServer().getPlayerList().reloadResources(); + } + } + diff --git a/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch b/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch index 408cb7ff8b..92c2992f13 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch @@ -65,6 +65,15 @@ serverLevel.setDefaultSpawnPos(serverLevel.getSharedSpawnPos(), serverLevel.getSharedSpawnAngle()); }) ); +@@ -223,7 +_,7 @@ + "tntExplodes", GameRules.Category.MISC, GameRules.BooleanValue.create(true) + ); + public static final GameRules.Key RULE_LOCATOR_BAR = register( +- "locatorBar", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true, (server, value) -> server.getAllLevels().forEach(level -> { ++ "locatorBar", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true, (server, value) -> java.util.Optional.of(server).ifPresent(level -> { // Paper + ServerWaypointManager waypointManager = level.getWaypointManager(); + if (value.get()) { + level.players().forEach(waypointManager::updatePlayer); @@ -234,6 +_,7 @@ ); private final Map, GameRules.Value> rules; diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java.patch index 196b1b49d7..2c30547282 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java.patch @@ -6,8 +6,8 @@ } + // Paper start - Configurable sculk sensor listener range + @Override -+ protected void saveRangeOverride(final net.minecraft.nbt.CompoundTag nbt) { -+ if (this.rangeOverride != null && this.rangeOverride != 16) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default ++ protected void saveRangeOverride(final net.minecraft.world.level.storage.ValueOutput output) { ++ if (this.rangeOverride != null && this.rangeOverride != 16) output.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default + } + // Paper end - Configurable sculk sensor listener range diff --git a/paper-server/src/main/java/io/papermc/paper/entity/activation/ActivationType.java b/paper-server/src/main/java/io/papermc/paper/entity/activation/ActivationType.java index bed83c5897..493914c8d1 100644 --- a/paper-server/src/main/java/io/papermc/paper/entity/activation/ActivationType.java +++ b/paper-server/src/main/java/io/papermc/paper/entity/activation/ActivationType.java @@ -1,12 +1,13 @@ package io.papermc.paper.entity.activation; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.FlyingMob; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ambient.AmbientCreature; import net.minecraft.world.entity.animal.AgeableWaterCreature; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.monster.Enemy; +import net.minecraft.world.entity.monster.Ghast; +import net.minecraft.world.entity.monster.Phantom; import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.raid.Raider; import net.minecraft.world.phys.AABB; @@ -33,7 +34,7 @@ public enum ActivationType { return ActivationType.WATER; } else if (entity instanceof Villager) { return ActivationType.VILLAGER; - } else if (entity instanceof FlyingMob && entity instanceof Enemy) { + } else if (entity instanceof Ghast || entity instanceof Phantom) { // TODO: some kind of better distinction here? return ActivationType.FLYING_MONSTER; } else if (entity instanceof Raider) { return ActivationType.RAIDER; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index aae378697b..675a60c84b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -828,7 +828,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { CraftPlayer cp = (CraftPlayer) p; if (cp.getHandle().connection == null) continue; - cp.getHandle().connection.send(new ClientboundSetTimePacket(cp.getHandle().level().getGameTime(), cp.getHandle().getPlayerTime(), cp.getHandle().relativeTime && cp.getHandle().serverLevel().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); + cp.getHandle().connection.send(new ClientboundSetTimePacket(cp.getHandle().level().getGameTime(), cp.getHandle().getPlayerTime(), cp.getHandle().relativeTime && cp.getHandle().level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java index 974ed7be3f..b88bc01f2f 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java @@ -1,17 +1,14 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.world.entity.FlyingMob; +import net.minecraft.world.entity.Mob; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Flying; +// TODO: REMOVE? public class CraftFlying extends CraftMob implements Flying { - public CraftFlying(CraftServer server, FlyingMob entity) { + public CraftFlying(CraftServer server, Mob entity) { super(server, entity); } - @Override - public FlyingMob getHandle() { - return (FlyingMob) this.entity; - } }