Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@5027a22c fix test
PaperMC/Paper@7b1b5f66 applyOrMoveSourcePatches for pre-2
PaperMC/Paper@743ab685 set updatingMinecraft flag
PaperMC/Paper@17d72ad2 26.1-rc-1
PaperMC/Paper@42c355e0 update to rc2
PaperMC/Paper@890e3cd4 fix setPlayerTime's rate, call TimeSkipEvent for time set <markerId>
PaperMC/Paper@8077ce40 cleanup PlayerInteractEvent
PaperMC/Paper@5f86e092 Start porting feature patches
PaperMC/Paper@5ba0e30a More feature patches
PaperMC/Paper@1abe8fe5 Apply redstone patches
PaperMC/Paper@3dfcd069 Simplify CraftStructureManager#loadStructure
PaperMC/Paper@392f8bf3 26.1-rc-3
This commit is contained in:
granny
2026-03-23 17:21:13 -07:00
parent 2df686555d
commit 9d93fc17bd
28 changed files with 140 additions and 146 deletions

View File

@@ -1,9 +1,9 @@
group = org.purpurmc.purpur group = org.purpurmc.purpur
version=26.1-snapshot-11-R0.1-SNAPSHOT version=26.1-rc-3-R0.1-SNAPSHOT
mcVersion=26.1-snapshot-11 mcVersion=26.1-rc-3
apiVersion = 26.1 apiVersion = 26.1
paperCommit = 22c0219b3f42ad0d6a06e41321e020eeacb7b02f paperCommit = 392f8bf36b4749736a17d33e7c7a8e634373b842
org.gradle.configuration-cache = true org.gradle.configuration-cache = true
org.gradle.caching = true org.gradle.caching = true

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/core/BlockPos.java --- a/net/minecraft/core/BlockPos.java
+++ b/net/minecraft/core/BlockPos.java +++ b/net/minecraft/core/BlockPos.java
@@ -58,6 +_,12 @@ @@ -60,6 +_,12 @@
private static final int X_OFFSET = PACKED_Y_LENGTH + PACKED_HORIZONTAL_LENGTH; public static final int MAX_HORIZONTAL_COORDINATE = 33554431;
public static final int MAX_HORIZONTAL_COORDINATE = (1 << PACKED_HORIZONTAL_LENGTH) / 2 - 1; // Paper end - Optimize Bit Operations by inlining
+ // Purpur start - Ridables + // Purpur start - Ridables
+ public BlockPos(net.minecraft.world.entity.Entity entity) { + public BlockPos(net.minecraft.world.entity.Entity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/gametest/framework/GameTestHelper.java --- a/net/minecraft/gametest/framework/GameTestHelper.java
+++ b/net/minecraft/gametest/framework/GameTestHelper.java +++ b/net/minecraft/gametest/framework/GameTestHelper.java
@@ -349,6 +_,8 @@ @@ -354,6 +_,8 @@
return gameType; return gameType;
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/network/Connection.java --- a/net/minecraft/network/Connection.java
+++ b/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java
@@ -460,11 +_,20 @@ @@ -552,11 +_,20 @@
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
private static int joinAttemptsThisTick; // Paper - Buffer joins to world private static int joinAttemptsThisTick; // Paper - Buffer joins to world
private static int currTick; // Paper - Buffer joins to world private static int currTick; // Paper - Buffer joins to world

View File

@@ -63,5 +63,5 @@
+ org.purpurmc.purpur.task.BossBarTask.startAll(); // Purpur - Implement TPSBar + org.purpurmc.purpur.task.BossBarTask.startAll(); // Purpur - Implement TPSBar
+ if (org.purpurmc.purpur.PurpurConfig.beeCountPayload) org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur - Give bee counts in beehives to Purpur clients + if (org.purpurmc.purpur.PurpurConfig.beeCountPayload) org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur - Give bee counts in beehives to Purpur clients
this.saveEverything(false, true, true);
this.notificationManager().serverStarted(); this.notificationManager().serverStarted();
return true;

View File

@@ -9,7 +9,7 @@
private final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this); private final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
// CraftBukkit start // CraftBukkit start
@@ -377,8 +_,25 @@ @@ -378,8 +_,25 @@
// CraftBukkit end // CraftBukkit end
this.tickTime = tickTime; this.tickTime = tickTime;
this.server = server; this.server = server;
@@ -36,7 +36,7 @@
ChunkGenerator generator = levelStem.generator(); ChunkGenerator generator = levelStem.generator();
// CraftBukkit start // CraftBukkit start
this.serverLevelData.setWorld(this); this.serverLevelData.setWorld(this);
@@ -463,6 +_,7 @@ @@ -464,6 +_,7 @@
this.environmentAttributes = EnvironmentAttributeSystem.builder().addDefaultLayers(this).build(); this.environmentAttributes = EnvironmentAttributeSystem.builder().addDefaultLayers(this).build();
this.updateSkyBrightness(); this.updateSkyBrightness();
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
@@ -44,7 +44,7 @@
} }
// Paper start // Paper start
@@ -519,7 +_,7 @@ @@ -520,7 +_,7 @@
} }
int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE); int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
@@ -53,7 +53,7 @@
Optional<Holder<WorldClock>> defaultClock = this.dimensionType().defaultClock(); Optional<Holder<WorldClock>> defaultClock = this.dimensionType().defaultClock();
org.bukkit.event.world.TimeSkipEvent event = null; // Paper - time skip event org.bukkit.event.world.TimeSkipEvent event = null; // Paper - time skip event
if (this.getGameRules().get(GameRules.ADVANCE_TIME) && defaultClock.isPresent()) { if (this.getGameRules().get(GameRules.ADVANCE_TIME) && defaultClock.isPresent()) {
@@ -725,9 +_,18 @@ @@ -728,9 +_,18 @@
&& this.random.nextDouble() < difficulty.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses && this.random.nextDouble() < difficulty.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
&& !this.getBlockState(pos.below()).is(BlockTags.LIGHTNING_RODS); && !this.getBlockState(pos.below()).is(BlockTags.LIGHTNING_RODS);
if (isTrap) { if (isTrap) {
@@ -73,7 +73,7 @@
horse.setAge(0); horse.setAge(0);
horse.setPos(pos.getX(), pos.getY(), pos.getZ()); horse.setPos(pos.getX(), pos.getY(), pos.getZ());
this.addFreshEntity(horse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit this.addFreshEntity(horse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
@@ -762,9 +_,35 @@ @@ -765,9 +_,35 @@
if (state.is(Blocks.SNOW)) { if (state.is(Blocks.SNOW)) {
int currentLayers = state.getValue(SnowLayerBlock.LAYERS); int currentLayers = state.getValue(SnowLayerBlock.LAYERS);
if (currentLayers < Math.min(maxHeight, 8)) { if (currentLayers < Math.min(maxHeight, 8)) {
@@ -109,7 +109,7 @@
} }
} else { } else {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, topPos, Blocks.SNOW.defaultBlockState(), Block.UPDATE_ALL, null); // CraftBukkit org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, topPos, Blocks.SNOW.defaultBlockState(), Block.UPDATE_ALL, null); // CraftBukkit
@@ -785,7 +_,7 @@ @@ -788,7 +_,7 @@
p -> p.is(PoiTypes.LIGHTNING_ROD), p -> p.is(PoiTypes.LIGHTNING_ROD),
lightningRodPos -> lightningRodPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, lightningRodPos.getX(), lightningRodPos.getZ()) - 1, lightningRodPos -> lightningRodPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, lightningRodPos.getX(), lightningRodPos.getZ()) - 1,
center, center,
@@ -118,7 +118,7 @@
PoiManager.Occupancy.ANY PoiManager.Occupancy.ANY
); );
return nearbyLightningRod.map(blockPos -> blockPos.above(1)); return nearbyLightningRod.map(blockPos -> blockPos.above(1));
@@ -833,8 +_,26 @@ @@ -836,8 +_,26 @@
int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE); int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
Component message; Component message;
if (this.sleepStatus.areEnoughSleeping(percentage)) { if (this.sleepStatus.areEnoughSleeping(percentage)) {
@@ -145,7 +145,7 @@
message = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(percentage)); message = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(percentage));
} }
@@ -1000,6 +_,7 @@ @@ -1003,6 +_,7 @@
public void resetWeatherCycle() { public void resetWeatherCycle() {
WeatherData weatherData = this.getWeatherData(); WeatherData weatherData = this.getWeatherData();
// CraftBukkit start // CraftBukkit start
@@ -153,7 +153,7 @@
weatherData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents weatherData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// If we stop due to everyone sleeping we should reset the weather duration to some other random value. // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time.... // Not that everyone ever manages to get the whole server to sleep at the same time....
@@ -1007,6 +_,7 @@ @@ -1010,6 +_,7 @@
weatherData.setRainTime(0); weatherData.setRainTime(0);
} }
// CraftBukkit end // CraftBukkit end
@@ -161,7 +161,7 @@
weatherData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents weatherData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start // CraftBukkit start
// If we stop due to everyone sleeping we should reset the weather duration to some other random value. // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
@@ -1640,7 +_,7 @@ @@ -1655,7 +_,7 @@
Explosion.BlockInteraction blockInteraction = switch (interactionType) { Explosion.BlockInteraction blockInteraction = switch (interactionType) {
case NONE -> Explosion.BlockInteraction.KEEP; case NONE -> Explosion.BlockInteraction.KEEP;
case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY); case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY);
@@ -170,7 +170,7 @@
? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY) ? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY)
: Explosion.BlockInteraction.KEEP; : Explosion.BlockInteraction.KEEP;
case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY); case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY);
@@ -2539,7 +_,7 @@ @@ -2561,7 +_,7 @@
// Spigot start // Spigot start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start - Fix merchant inventory not closing on entity removal // Paper start - Fix merchant inventory not closing on entity removal

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayer.java --- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java
@@ -447,6 +_,9 @@ @@ -448,6 +_,9 @@
public boolean isRealPlayer; // Paper public boolean isRealPlayer; // Paper
public com.destroystokyo.paper.event.entity.@Nullable PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent public com.destroystokyo.paper.event.entity.@Nullable PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public org.bukkit.event.player.PlayerQuitEvent.@Nullable QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event public org.bukkit.event.player.PlayerQuitEvent.@Nullable QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
@@ -10,7 +10,7 @@
public ServerPlayer(final MinecraftServer server, final ServerLevel level, final GameProfile gameProfile, final ClientInformation clientInformation) { public ServerPlayer(final MinecraftServer server, final ServerLevel level, final GameProfile gameProfile, final ClientInformation clientInformation) {
super(level, gameProfile); super(level, gameProfile);
@@ -490,6 +_,9 @@ @@ -491,6 +_,9 @@
this.respawnConfig = input.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null); this.respawnConfig = input.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null);
this.spawnExtraParticlesOnFall = input.getBooleanOr("spawn_extra_particles_on_fall", false); this.spawnExtraParticlesOnFall = input.getBooleanOr("spawn_extra_particles_on_fall", false);
this.raidOmenPosition = input.read("raid_omen_position", BlockPos.CODEC).orElse(null); this.raidOmenPosition = input.read("raid_omen_position", BlockPos.CODEC).orElse(null);
@@ -20,7 +20,7 @@
// Paper start - Expand PlayerGameModeChangeEvent // Paper start - Expand PlayerGameModeChangeEvent
this.loadGameTypes(input); this.loadGameTypes(input);
} }
@@ -531,6 +_,9 @@ @@ -532,6 +_,9 @@
output.store("ShoulderEntityRight", CompoundTag.CODEC, this.getShoulderEntityRight()); output.store("ShoulderEntityRight", CompoundTag.CODEC, this.getShoulderEntityRight());
} }
this.getBukkitEntity().setExtraData(output); // CraftBukkit this.getBukkitEntity().setExtraData(output); // CraftBukkit
@@ -30,7 +30,7 @@
} }
private void saveParentVehicle(final ValueOutput playerOutput) { private void saveParentVehicle(final ValueOutput playerOutput) {
@@ -1166,6 +_,7 @@ @@ -1167,6 +_,7 @@
// Paper - moved up to sendClientboundPlayerCombatKillPacket() // Paper - moved up to sendClientboundPlayerCombatKillPacket()
sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
Team team = this.getTeam(); Team team = this.getTeam();
@@ -38,7 +38,7 @@
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) { if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false); this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) { } else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
@@ -1274,6 +_,13 @@ @@ -1275,6 +_,13 @@
if (this.isInvulnerableTo(level, source)) { if (this.isInvulnerableTo(level, source)) {
return false; return false;
} else { } else {
@@ -52,7 +52,7 @@
Entity entity = source.getEntity(); Entity entity = source.getEntity();
if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false. if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false.
!(entity instanceof Player playerx && !this.canHarmPlayer(playerx)) !(entity instanceof Player playerx && !this.canHarmPlayer(playerx))
@@ -1531,6 +_,7 @@ @@ -1534,6 +_,7 @@
profiler.pop(); profiler.pop();
profiler.push("placing"); profiler.push("placing");
@@ -60,7 +60,7 @@
this.setServerLevel(newLevel); this.setServerLevel(newLevel);
this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit - use internal teleport without event this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition(); this.connection.resetPosition();
@@ -1647,7 +_,7 @@ @@ -1650,7 +_,7 @@
), ),
monster -> monster.isPreventingPlayerRest(this.level(), this) monster -> monster.isPreventingPlayerRest(this.level(), this)
); );
@@ -69,7 +69,7 @@
return Either.left(Player.BedSleepingProblem.NOT_SAFE); return Either.left(Player.BedSleepingProblem.NOT_SAFE);
} }
} }
@@ -1687,8 +_,19 @@ @@ -1690,8 +_,19 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this); CriteriaTriggers.SLEPT_IN_BED.trigger(this);
}); });
if (!this.level().canSleepThroughNights()) { if (!this.level().canSleepThroughNights()) {
@@ -90,7 +90,7 @@
this.level().updateSleepingPlayerList(); this.level().updateSleepingPlayerList();
return result; return result;
@@ -1782,6 +_,7 @@ @@ -1785,6 +_,7 @@
@Override @Override
public void openTextEdit(final SignBlockEntity sign, final boolean isFrontText) { public void openTextEdit(final SignBlockEntity sign, final boolean isFrontText) {
@@ -98,7 +98,7 @@
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), sign.getBlockPos())); this.connection.send(new ClientboundBlockUpdatePacket(this.level(), sign.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), isFrontText)); this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), isFrontText));
} }
@@ -2125,6 +_,26 @@ @@ -2128,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset this.lastSentExp = -1; // CraftBukkit - Added to reset
} }
@@ -125,7 +125,7 @@
@Override @Override
public void completeUsingItem() { public void completeUsingItem() {
if (!this.useItem.isEmpty() && this.isUsingItem()) { if (!this.useItem.isEmpty() && this.isUsingItem()) {
@@ -2364,6 +_,20 @@ @@ -2367,6 +_,20 @@
); );
} }
@@ -146,7 +146,7 @@
@Override @Override
public void sendSystemMessage(final Component message) { public void sendSystemMessage(final Component message) {
this.sendSystemMessage(message, false); this.sendSystemMessage(message, false);
@@ -2511,7 +_,67 @@ @@ -2518,7 +_,67 @@
public void resetLastActionTime() { public void resetLastActionTime() {
this.lastActionTime = Util.getMillis(); this.lastActionTime = Util.getMillis();
@@ -215,7 +215,7 @@
public ServerStatsCounter getStats() { public ServerStatsCounter getStats() {
return this.stats; return this.stats;
@@ -3136,4 +_,65 @@ @@ -3143,4 +_,65 @@
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity(); return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
} }
// CraftBukkit end // CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayerGameMode.java --- a/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -364,6 +_,7 @@ @@ -370,6 +_,7 @@
} }
return false; return false;
} }
@@ -8,7 +8,7 @@
} }
// CraftBukkit end // CraftBukkit end
@@ -494,6 +_,7 @@ @@ -500,6 +_,7 @@
public InteractionResult useItemOn( public InteractionResult useItemOn(
final ServerPlayer player, final Level level, final ItemStack itemStack, final InteractionHand hand, final BlockHitResult hitResult final ServerPlayer player, final Level level, final ItemStack itemStack, final InteractionHand hand, final BlockHitResult hitResult
) { ) {
@@ -16,7 +16,7 @@
BlockPos pos = hitResult.getBlockPos(); BlockPos pos = hitResult.getBlockPos();
BlockState state = level.getBlockState(pos); BlockState state = level.getBlockState(pos);
boolean cancelledBlock = false; boolean cancelledBlock = false;
@@ -542,7 +_,7 @@ @@ -548,7 +_,7 @@
boolean haveSomethingInOurHands = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty(); boolean haveSomethingInOurHands = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
boolean suppressUsingBlock = player.isSecondaryUseActive() && haveSomethingInOurHands; boolean suppressUsingBlock = player.isSecondaryUseActive() && haveSomethingInOurHands;
ItemStack usedItemStack = itemStack.copy(); ItemStack usedItemStack = itemStack.copy();
@@ -25,7 +25,7 @@
InteractionResult itemUse = state.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult); InteractionResult itemUse = state.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult);
if (itemUse.consumesAction()) { if (itemUse.consumesAction()) {
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, pos, usedItemStack); CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, pos, usedItemStack);
@@ -588,4 +_,18 @@ @@ -594,4 +_,18 @@
public void setLevel(final ServerLevel newLevel) { public void setLevel(final ServerLevel newLevel) {
this.level = newLevel; this.level = newLevel;
} }

View File

@@ -206,7 +206,7 @@
private boolean shouldCheckPlayerMovement(final boolean isFallFlying) { private boolean shouldCheckPlayerMovement(final boolean isFallFlying) {
if (this.isSingleplayerOwner()) { if (this.isSingleplayerOwner()) {
return false; return false;
@@ -2155,6 +_,7 @@ @@ -2150,6 +_,7 @@
boolean cancelled; boolean cancelled;
if (hitResult == null || hitResult.getType() != HitResult.Type.BLOCK) { if (hitResult == null || hitResult.getType() != HitResult.Type.BLOCK) {
@@ -214,15 +214,15 @@
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemStack, hand); org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemStack, hand);
cancelled = event.useItemInHand() == Event.Result.DENY; cancelled = event.useItemInHand() == Event.Result.DENY;
} else { } else {
@@ -2800,6 +_,7 @@ @@ -2791,6 +_,7 @@
if (target != null && level.getWorldBorder().isWithinBounds(target.blockPosition())) { ItemStack mainHandItem = this.player.getMainHandItem();
AABB targetBounds = target.getBoundingBox(); if (this.player.isWithinAttackRange(mainHandItem, targetBounds, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience
if (this.player.isWithinAttackRange(this.player.getMainHandItem(), targetBounds, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience value for interact range if (!mainHandItem.has(DataComponents.PIERCING_WEAPON)) {
+ if (target instanceof net.minecraft.world.entity.Mob mob) mob.ticksSinceLastInteraction = 0; // Purpur - Entity lifespan + if (target instanceof net.minecraft.world.entity.Mob mob) mob.ticksSinceLastInteraction = 0; // Purpur - Entity lifespan
if (!(target instanceof ItemEntity) if (target instanceof ItemEntity
&& !(target instanceof ExperienceOrb) || target instanceof ExperienceOrb
&& (target != this.player || this.player.isSpectator()) // CraftBukkit || target == this.player
@@ -3590,7 +_,7 @@ @@ -3572,7 +_,7 @@
@Override @Override
public void handleChangeGameMode(final ServerboundChangeGameModePacket packet) { public void handleChangeGameMode(final ServerboundChangeGameModePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -284,7 +_,7 @@ @@ -282,7 +_,7 @@
ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!"); ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!");
ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(name)); // Spigot ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(name)); // Spigot
} else { } else {

View File

@@ -1,20 +1,20 @@
--- a/net/minecraft/world/clock/ServerClockManager.java --- a/net/minecraft/world/clock/ServerClockManager.java
+++ b/net/minecraft/world/clock/ServerClockManager.java +++ b/net/minecraft/world/clock/ServerClockManager.java
@@ -112,7 +_,7 @@ @@ -122,7 +_,7 @@
ServerClockManager.ClockInstance instance = this.getInstance(clock); ServerClockManager.ClockInstance instance = this.getInstance(clock);
action.accept(instance); action.accept(instance);
Map<Holder<WorldClock>, ClockState> updates = Map.of(clock, instance.packNetworkState(this.server)); Map<Holder<WorldClock>, ClockNetworkState> updates = Map.of(clock, instance.packNetworkState(this.server));
- this.server.getPlayerList().broadcastAll(new ClientboundSetTimePacket(this.getGameTime(), updates)); // TODO 26.1 per-player time - this.server.getPlayerList().broadcastAll(new ClientboundSetTimePacket(this.getGameTime(), updates)); // TODO 26.1 per-player time
+ this.server.getPlayerList().broadcastAll(new ClientboundSetTimePacket(this.getGameTime(), updates)); // TODO 26.1 per-player time // Purpur - TODO: Configurable daylight cycle + this.server.getPlayerList().broadcastAll(new ClientboundSetTimePacket(this.getGameTime(), updates)); // TODO 26.1 per-player time // Purpur - TODO: Configurable daylight cycle
this.setDirty(); this.setDirty();
}
@@ -128,7 +_,7 @@ for (ServerLevel level : this.server.getAllLevels()) {
@@ -151,7 +_,7 @@
// Paper end // Paper end
public ClientboundSetTimePacket createFullSyncPacket() { public ClientboundSetTimePacket createFullSyncPacket() {
- // TODO 26.1 per-player time - // TODO - snapshot: 26.1 per-player time
+ // TODO 26.1 per-player time // Purpur - TODO: Configurable daylight cycle + // TODO - snapshot: 26.1 per-player time // Purpur - TODO: Configurable daylight cycle
return new ClientboundSetTimePacket(this.getGameTime(), Util.mapValues(this.clocks, clock -> clock.packNetworkState(this.server))); return new ClientboundSetTimePacket(this.getGameTime(), Util.mapValues(this.clocks, clock -> clock.packNetworkState(this.server)));
} }

View File

@@ -41,10 +41,10 @@
public int totalEntityAge; // Paper - age-like counter for all entities public int totalEntityAge; // Paper - age-like counter for all entities
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
+ public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API + public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API
// CraftBukkit end // Paper start - EAR 2
public final boolean defaultActivationState;
// Paper start public long activatedTick = Integer.MIN_VALUE;
@@ -434,10 +_,22 @@ @@ -443,10 +_,22 @@
} }
// Paper end // Paper end
@@ -67,7 +67,7 @@
this.position = Vec3.ZERO; this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO; this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO; this.chunkPosition = ChunkPos.ZERO;
@@ -828,6 +_,7 @@ @@ -844,6 +_,7 @@
&& this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
&& (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
// Paper end - Configurable nether ceiling damage // Paper end - Configurable nether ceiling damage
@@ -75,7 +75,7 @@
this.onBelowWorld(); this.onBelowWorld();
} }
} }
@@ -1826,7 +_,7 @@ @@ -1857,7 +_,7 @@
} }
public boolean fireImmune() { public boolean fireImmune() {
@@ -84,7 +84,7 @@
} }
public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) {
@@ -2412,7 +_,7 @@ @@ -2443,7 +_,7 @@
output.putBoolean("Bukkit.invisible", this.persistentInvisibility); output.putBoolean("Bukkit.invisible", this.persistentInvisibility);
} }
// SPIGOT-6907: re-implement LivingEntity#setMaximumAir() // SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
@@ -93,7 +93,7 @@
output.putInt("Bukkit.MaxAirSupply", this.getMaxAirSupply()); output.putInt("Bukkit.MaxAirSupply", this.getMaxAirSupply());
} }
output.putInt("Spigot.ticksLived", this.totalEntityAge); // Paper output.putInt("Spigot.ticksLived", this.totalEntityAge); // Paper
@@ -2499,6 +_,11 @@ @@ -2530,6 +_,11 @@
output.putBoolean("Paper.FreezeLock", true); output.putBoolean("Paper.FreezeLock", true);
} }
// Paper end // Paper end
@@ -105,7 +105,7 @@
} catch (Throwable var7) { } catch (Throwable var7) {
CrashReport report = CrashReport.forThrowable(var7, "Saving entity NBT"); CrashReport report = CrashReport.forThrowable(var7, "Saving entity NBT");
CrashReportCategory category = report.addCategory("Entity being saved"); CrashReportCategory category = report.addCategory("Entity being saved");
@@ -2621,6 +_,9 @@ @@ -2652,6 +_,9 @@
} }
freezeLocked = input.getBooleanOr("Paper.FreezeLock", false); freezeLocked = input.getBooleanOr("Paper.FreezeLock", false);
// Paper end // Paper end
@@ -115,7 +115,7 @@
} catch (Throwable var7) { } catch (Throwable var7) {
CrashReport report = CrashReport.forThrowable(var7, "Loading entity NBT"); CrashReport report = CrashReport.forThrowable(var7, "Loading entity NBT");
CrashReportCategory category = report.addCategory("Entity being loaded"); CrashReportCategory category = report.addCategory("Entity being loaded");
@@ -2800,6 +_,7 @@ @@ -2831,6 +_,7 @@
if (this.isAlive() && this instanceof Leashable leashablex) { if (this.isAlive() && this instanceof Leashable leashablex) {
if (leashablex.getLeashHolder() == player) { if (leashablex.getLeashHolder() == player) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
@@ -123,7 +123,7 @@
// Paper start - EntityUnleashEvent // Paper start - EntityUnleashEvent
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent( if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
leashablex, player, hand, !player.hasInfiniteMaterials(), true leashablex, player, hand, !player.hasInfiniteMaterials(), true
@@ -3230,15 +_,18 @@ @@ -3261,15 +_,18 @@
return Vec3.directionFromRotation(this.getRotationVector()); return Vec3.directionFromRotation(this.getRotationVector());
} }
@@ -143,7 +143,7 @@
} }
} }
} }
@@ -3967,7 +_,7 @@ @@ -3998,7 +_,7 @@
} }
public boolean canUsePortal(final boolean ignorePassenger) { public boolean canUsePortal(final boolean ignorePassenger) {
@@ -152,7 +152,7 @@
} }
public boolean canTeleport(final Level from, final Level to) { public boolean canTeleport(final Level from, final Level to) {
@@ -4515,6 +_,12 @@ @@ -4546,6 +_,12 @@
return Mth.lerp(partial, this.yRotO, this.yRot); return Mth.lerp(partial, this.yRotO, this.yRot);
} }
@@ -165,7 +165,7 @@
public boolean touchingUnloadedChunk() { public boolean touchingUnloadedChunk() {
AABB box = this.getBoundingBox().inflate(1.0); AABB box = this.getBoundingBox().inflate(1.0);
int x0 = Mth.floor(box.minX); int x0 = Mth.floor(box.minX);
@@ -4809,7 +_,7 @@ @@ -4840,7 +_,7 @@
} }
public float maxUpStep() { public float maxUpStep() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/LivingEntity.java --- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java
@@ -440,6 +_,12 @@ @@ -441,6 +_,12 @@
if (dist < 0.0) { if (dist < 0.0) {
double damagePerBlock = level.getWorldBorder().getDamagePerBlock(); double damagePerBlock = level.getWorldBorder().getDamagePerBlock();
if (damagePerBlock > 0.0) { if (damagePerBlock > 0.0) {
@@ -13,7 +13,7 @@
this.hurtServer(level, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-dist * damagePerBlock))); this.hurtServer(level, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-dist * damagePerBlock)));
} }
} }
@@ -455,7 +_,7 @@ @@ -456,7 +_,7 @@
if (this.shouldTakeDrowningDamage()) { if (this.shouldTakeDrowningDamage()) {
this.setAirSupply(0); this.setAirSupply(0);
level.broadcastEntityEvent(this, EntityEvent.DROWN_PARTICLES); level.broadcastEntityEvent(this, EntityEvent.DROWN_PARTICLES);
@@ -22,7 +22,7 @@
} }
} else if (this.getAirSupply() < this.getMaxAirSupply() && MobEffectUtil.shouldEffectsRefillAirsupply(this)) { } else if (this.getAirSupply() < this.getMaxAirSupply() && MobEffectUtil.shouldEffectsRefillAirsupply(this)) {
this.setAirSupply(this.increaseAirSupply(this.getAirSupply())); this.setAirSupply(this.increaseAirSupply(this.getAirSupply()));
@@ -515,7 +_,7 @@ @@ -516,7 +_,7 @@
} }
protected boolean shouldTakeDrowningDamage() { protected boolean shouldTakeDrowningDamage() {
@@ -31,7 +31,7 @@
} }
@Override @Override
@@ -1045,15 +_,33 @@ @@ -1046,15 +_,33 @@
} }
if (targetingEntity != null) { if (targetingEntity != null) {
@@ -74,7 +74,7 @@
return visibilityPercent; return visibilityPercent;
} }
@@ -1100,6 +_,7 @@ @@ -1101,6 +_,7 @@
Iterator<MobEffectInstance> iterator = this.activeEffects.values().iterator(); Iterator<MobEffectInstance> iterator = this.activeEffects.values().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
MobEffectInstance effect = iterator.next(); MobEffectInstance effect = iterator.next();
@@ -82,7 +82,7 @@
EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED); EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
if (event.isCancelled()) { if (event.isCancelled()) {
continue; continue;
@@ -1431,6 +_,24 @@ @@ -1432,6 +_,24 @@
this.stopSleeping(); this.stopSleeping();
} }
@@ -107,7 +107,7 @@
this.noActionTime = 0; this.noActionTime = 0;
if (damage < 0.0F) { if (damage < 0.0F) {
damage = 0.0F; damage = 0.0F;
@@ -1692,10 +_,10 @@ @@ -1693,10 +_,10 @@
protected @Nullable Player resolvePlayerResponsibleForDamage(final DamageSource source) { protected @Nullable Player resolvePlayerResponsibleForDamage(final DamageSource source) {
Entity sourceEntity = source.getEntity(); Entity sourceEntity = source.getEntity();
if (sourceEntity instanceof Player playerSource) { if (sourceEntity instanceof Player playerSource) {
@@ -120,7 +120,7 @@
} else { } else {
this.lastHurtByPlayer = null; this.lastHurtByPlayer = null;
this.lastHurtByPlayerMemoryTime = 0; this.lastHurtByPlayerMemoryTime = 0;
@@ -1746,6 +_,30 @@ @@ -1747,6 +_,18 @@
} }
} }
@@ -128,30 +128,18 @@
+ if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemStack == null || itemStack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) { + if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemStack == null || itemStack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) {
+ for (ItemStack item : player.getInventory().getNonEquipmentItems()) { + for (ItemStack item : player.getInventory().getNonEquipmentItems()) {
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) { + if (item.getItem() == Items.TOTEM_OF_UNDYING) {
+ itemInHand = item; + itemStack = item;
+ itemStack = item.copy(); + protectionItem = item.copy();
+ break; + break;
+ } + }
+ } + }
+ } + }
+ // Purpur end - Totems work in inventory + // Purpur end - Totems work in inventory
+ +
+ // Purpur start - Totems work in inventory final org.bukkit.inventory.EquipmentSlot handSlot = (usedHand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(usedHand) : null;
+ if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemStack == null || itemStack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) {
+ for (ItemStack item : player.getInventory().getNonEquipmentItems()) {
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
+ itemInHand = item;
+ itemStack = item.copy();
+ break;
+ }
+ }
+ }
+ // Purpur end - Totems work in inventory
+
final org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot); final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
event.setCancelled(protectionItem == null); event.setCancelled(protectionItem == null);
@@ -1920,6 +_,7 @@ @@ -1921,6 +_,7 @@
boolean playerKilled = this.lastHurtByPlayerMemoryTime > 0; boolean playerKilled = this.lastHurtByPlayerMemoryTime > 0;
this.dropEquipment(level); // CraftBukkit - from below this.dropEquipment(level); // CraftBukkit - from below
if (this.shouldDropLoot(level)) { if (this.shouldDropLoot(level)) {
@@ -159,7 +147,7 @@
this.dropFromLootTable(level, source, playerKilled); this.dropFromLootTable(level, source, playerKilled);
// Paper start // Paper start
final boolean prev = this.clearEquipmentSlots; final boolean prev = this.clearEquipmentSlots;
@@ -1928,6 +_,7 @@ @@ -1929,6 +_,7 @@
// Paper end // Paper end
this.dropCustomDeathLoot(level, source, playerKilled); this.dropCustomDeathLoot(level, source, playerKilled);
this.clearEquipmentSlots = prev; // Paper this.clearEquipmentSlots = prev; // Paper
@@ -175,7 +163,7 @@
this.hurt(this.damageSources().flyIntoWall(), dmg); this.hurt(this.damageSources().flyIntoWall(), dmg);
} }
} }
@@ -3852,7 +_,7 @@ @@ -3860,7 +_,7 @@
} }
} }
@@ -184,7 +172,7 @@
if (!this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) { if (!this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) {
for (EquipmentSlot slot : EquipmentSlot.VALUES) { for (EquipmentSlot slot : EquipmentSlot.VALUES) {
if (canGlideUsing(this.getItemBySlot(slot), slot)) { if (canGlideUsing(this.getItemBySlot(slot), slot)) {
@@ -4740,6 +_,12 @@ @@ -4748,6 +_,12 @@
? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND) ? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND)
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.typeHolder()); : slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.typeHolder());
} }

View File

@@ -8,7 +8,7 @@
protected Mob(final EntityType<? extends Mob> type, final Level level) { protected Mob(final EntityType<? extends Mob> type, final Level level) {
super(type, level); super(type, level);
@@ -285,6 +_,7 @@ @@ -298,6 +_,7 @@
target = null; target = null;
} }
} }
@@ -16,7 +16,7 @@
this.target = this.asValidTarget(target); this.target = this.asValidTarget(target);
return true; return true;
// CraftBukkit end // CraftBukkit end
@@ -328,7 +_,27 @@ @@ -341,7 +_,27 @@
} }
profiler.pop(); profiler.pop();
@@ -45,7 +45,7 @@
@Override @Override
protected void playHurtSound(final DamageSource source) { protected void playHurtSound(final DamageSource source) {
@@ -432,6 +_,7 @@ @@ -445,6 +_,7 @@
output.putString("Paper.DespawnInPeacefulOverride", this.despawnInPeacefulOverride.name()); output.putString("Paper.DespawnInPeacefulOverride", this.despawnInPeacefulOverride.name());
} }
// Paper end - allow changing despawnInPeaceful // Paper end - allow changing despawnInPeaceful
@@ -53,7 +53,7 @@
} }
@Override @Override
@@ -459,6 +_,7 @@ @@ -472,6 +_,7 @@
this.lootTableSeed = input.getLongOr("DeathLootTableSeed", 0L); this.lootTableSeed = input.getLongOr("DeathLootTableSeed", 0L);
this.setNoAi(input.getBooleanOr("NoAI", false)); this.setNoAi(input.getBooleanOr("NoAI", false));
this.aware = input.getBooleanOr("Bukkit.Aware", true); // CraftBukkit this.aware = input.getBooleanOr("Bukkit.Aware", true); // CraftBukkit
@@ -61,7 +61,7 @@
// Paper start - allow changing despawnInPeaceful // Paper start - allow changing despawnInPeaceful
this.despawnInPeacefulOverride = readDespawnInPeacefulOverride(input); this.despawnInPeacefulOverride = readDespawnInPeacefulOverride(input);
} }
@@ -1237,7 +_,7 @@ @@ -1250,7 +_,7 @@
); );
} }
@@ -70,7 +70,7 @@
return groupData; return groupData;
} }
@@ -1598,6 +_,7 @@ @@ -1607,6 +_,7 @@
} }
this.postPiercingAttack(); this.postPiercingAttack();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/ArmorStand.java --- a/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -92,10 +_,13 @@ @@ -94,10 +_,13 @@
public boolean canTickSetByAPI = false; public boolean canTickSetByAPI = false;
private boolean noTickEquipmentDirty = false; private boolean noTickEquipmentDirty = false;
// Paper end - Allow ArmorStands not to tick // Paper end - Allow ArmorStands not to tick
@@ -14,7 +14,7 @@
} }
public ArmorStand(final Level level, final double x, final double y, final double z) { public ArmorStand(final Level level, final double x, final double y, final double z) {
@@ -521,6 +_,7 @@ @@ -523,6 +_,7 @@
// Paper start - Allow ArmorStands not to tick // Paper start - Allow ArmorStands not to tick
@Override @Override
public void tick() { public void tick() {
@@ -22,7 +22,7 @@
if (!this.canTick) { if (!this.canTick) {
if (this.noTickEquipmentDirty) { if (this.noTickEquipmentDirty) {
this.noTickEquipmentDirty = false; this.noTickEquipmentDirty = false;
@@ -807,4 +_,18 @@ @@ -809,4 +_,18 @@
} }
} }
// Paper end // Paper end

View File

@@ -13,7 +13,7 @@
public ItemEntity(final EntityType<? extends ItemEntity> type, final Level level) { public ItemEntity(final EntityType<? extends ItemEntity> type, final Level level) {
super(type, level); super(type, level);
@@ -314,7 +_,16 @@ @@ -339,7 +_,16 @@
@Override @Override
public final boolean hurtServer(final ServerLevel level, final DamageSource source, final float damage) { public final boolean hurtServer(final ServerLevel level, final DamageSource source, final float damage) {
@@ -31,7 +31,7 @@
return false; return false;
} else if (!level.getGameRules().get(GameRules.MOB_GRIEFING) && source.getEntity() instanceof Mob) { } else if (!level.getGameRules().get(GameRules.MOB_GRIEFING) && source.getEntity() instanceof Mob) {
return false; return false;
@@ -492,6 +_,12 @@ @@ -517,6 +_,12 @@
public void setItem(final ItemStack itemStack) { public void setItem(final ItemStack itemStack) {
this.getEntityData().set(DATA_ITEM, itemStack); this.getEntityData().set(DATA_ITEM, itemStack);
this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(itemStack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(itemStack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java --- a/net/minecraft/world/entity/monster/zombie/Zombie.java
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java +++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
@@ -127,7 +_,19 @@ @@ -128,7 +_,19 @@
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0)); this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
@@ -21,7 +21,7 @@
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
} }
@@ -542,7 +_,7 @@ @@ -543,7 +_,7 @@
} }
} }

View File

@@ -67,11 +67,16 @@
@Override @Override
public Brain<Villager> getBrain() { public Brain<Villager> getBrain() {
return (Brain<Villager>) super.getBrain(); return (Brain<Villager>) super.getBrain();
@@ -248,7 +_,18 @@ @@ -268,11 +_,22 @@
protected void customServerAiStep(final ServerLevel level) { // Paper start - EAR 2
this.customServerAiStep(level, false);
}
- protected void customServerAiStep(ServerLevel level, final boolean inactive) {
+ protected void customServerAiStep(ServerLevel level, boolean inactive) { // Purpur - Lobotomize stuck villagers
// Paper end - EAR 2
ProfilerFiller profiler = Profiler.get(); ProfilerFiller profiler = Profiler.get();
profiler.push("villagerBrain"); profiler.push("villagerBrain");
- this.getBrain().tick(level, this); - if (!inactive) this.getBrain().tick(level, this); // Paper - EAR 2
+ // Purpur start - Lobotomize stuck villagers + // Purpur start - Lobotomize stuck villagers
+ if (this.level().purpurConfig.villagerLobotomizeEnabled) { + if (this.level().purpurConfig.villagerLobotomizeEnabled) {
+ // treat as inactive if lobotomized + // treat as inactive if lobotomized
@@ -87,7 +92,7 @@
profiler.pop(); profiler.pop();
if (this.assignProfessionWhenSpawned) { if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false; this.assignProfessionWhenSpawned = false;
@@ -319,6 +_,7 @@ @@ -344,6 +_,7 @@
return InteractionResult.CONSUME; return InteractionResult.CONSUME;
} }
@@ -95,7 +100,7 @@
this.startTrading(player); this.startTrading(player);
} }
@@ -460,7 +_,7 @@ @@ -485,7 +_,7 @@
public void updateDemand() { public void updateDemand() {
for (MerchantOffer offer : this.getOffers()) { for (MerchantOffer offer : this.getOffers()) {
@@ -104,7 +109,7 @@
} }
} }
@@ -660,7 +_,7 @@ @@ -685,7 +_,7 @@
@Override @Override
public boolean canBreed() { public boolean canBreed() {
@@ -113,7 +118,7 @@
} }
private boolean hungry() { private boolean hungry() {
@@ -867,6 +_,7 @@ @@ -892,6 +_,7 @@
} }
public void spawnGolemIfNeeded(final ServerLevel level, final long timestamp, final int villagersNeededToAgree) { public void spawnGolemIfNeeded(final ServerLevel level, final long timestamp, final int villagersNeededToAgree) {

View File

@@ -21,7 +21,7 @@
@Override @Override
public org.bukkit.craftbukkit.entity.CraftHumanEntity getBukkitEntity() { public org.bukkit.craftbukkit.entity.CraftHumanEntity getBukkitEntity() {
return (org.bukkit.craftbukkit.entity.CraftHumanEntity) super.getBukkitEntity(); return (org.bukkit.craftbukkit.entity.CraftHumanEntity) super.getBukkitEntity();
@@ -240,6 +_,12 @@ @@ -239,6 +_,12 @@
@Override @Override
public void tick() { public void tick() {
@@ -34,7 +34,7 @@
this.noPhysics = this.isSpectator(); this.noPhysics = this.isSpectator();
if (this.isSpectator() || this.isPassenger()) { if (this.isSpectator() || this.isPassenger()) {
this.setOnGround(false); this.setOnGround(false);
@@ -297,6 +_,17 @@ @@ -296,6 +_,17 @@
this.turtleHelmetTick(); this.turtleHelmetTick();
} }
@@ -52,7 +52,7 @@
this.cooldowns.tick(); this.cooldowns.tick();
this.updatePlayerPose(); this.updatePlayerPose();
} }
@@ -502,7 +_,7 @@ @@ -501,7 +_,7 @@
List<Entity> orbs = Lists.newArrayList(); List<Entity> orbs = Lists.newArrayList();
for (Entity entity : entities) { for (Entity entity : entities) {
@@ -61,7 +61,7 @@
orbs.add(entity); orbs.add(entity);
} else if (!entity.isRemoved()) { } else if (!entity.isRemoved()) {
this.touch(entity); this.touch(entity);
@@ -1045,7 +_,7 @@ @@ -1044,7 +_,7 @@
criticalAttack = criticalAttack && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits criticalAttack = criticalAttack && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
if (criticalAttack) { if (criticalAttack) {
damageSource = damageSource.critical(); // Paper - critical damage API damageSource = damageSource.critical(); // Paper - critical damage API
@@ -70,7 +70,7 @@
} }
float totalDamage = baseDamage + magicBoost; float totalDamage = baseDamage + magicBoost;
@@ -1519,7 +_,7 @@ @@ -1518,7 +_,7 @@
} }
@Override @Override
@@ -79,7 +79,7 @@
return !this.abilities.flying && super.canGlide(); return !this.abilities.flying && super.canGlide();
} }
@@ -1747,7 +_,23 @@ @@ -1746,7 +_,23 @@
@Override @Override
protected int getBaseExperienceReward(final ServerLevel level) { protected int getBaseExperienceReward(final ServerLevel level) {
@@ -104,7 +104,7 @@
} }
@Override @Override
@@ -1790,6 +_,13 @@ @@ -1789,6 +_,13 @@
public boolean addItem(final ItemStack itemStack) { public boolean addItem(final ItemStack itemStack) {
return this.inventory.add(itemStack); return this.inventory.add(itemStack);
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/BlockItem.java --- a/net/minecraft/world/item/BlockItem.java
+++ b/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java
@@ -139,7 +_,16 @@ @@ -138,7 +_,16 @@
protected boolean updateCustomBlockEntityTag( protected boolean updateCustomBlockEntityTag(
final BlockPos pos, final Level level, final @Nullable Player player, final ItemStack itemStack, final BlockState placedState final BlockPos pos, final Level level, final @Nullable Player player, final ItemStack itemStack, final BlockState placedState
) { ) {
@@ -18,7 +18,7 @@
} }
protected @Nullable BlockState getPlacementState(final BlockPlaceContext context) { protected @Nullable BlockState getPlacementState(final BlockPlaceContext context) {
@@ -201,6 +_,7 @@ @@ -200,6 +_,7 @@
} }
if (!type.onlyOpCanSetNbt() || player != null && (player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place")))) { // Spigot - add permission if (!type.onlyOpCanSetNbt() || player != null && (player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place")))) { // Spigot - add permission
@@ -26,7 +26,7 @@
return customData.loadInto(blockEntity, level.registryAccess()); return customData.loadInto(blockEntity, level.registryAccess());
} }
@@ -241,6 +_,7 @@ @@ -240,6 +_,7 @@
public void onDestroyed(final ItemEntity entity) { public void onDestroyed(final ItemEntity entity) {
ItemContainerContents container = entity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY); ItemContainerContents container = entity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY);
if (container != null) { if (container != null) {

View File

@@ -9,7 +9,7 @@
public static final Item CREAKING_HEART = registerBlock(Blocks.CREAKING_HEART); public static final Item CREAKING_HEART = registerBlock(Blocks.CREAKING_HEART);
public static final Item CHEST = registerBlock(Blocks.CHEST, p -> p.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); public static final Item CHEST = registerBlock(Blocks.CHEST, p -> p.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY));
public static final Item CRAFTING_TABLE = registerBlock(Blocks.CRAFTING_TABLE); public static final Item CRAFTING_TABLE = registerBlock(Blocks.CRAFTING_TABLE);
@@ -2077,7 +_,7 @@ @@ -2105,7 +_,7 @@
"sweet_berries", createBlockItemWithCustomItemName(Blocks.SWEET_BERRY_BUSH), new Item.Properties().food(Foods.SWEET_BERRIES) "sweet_berries", createBlockItemWithCustomItemName(Blocks.SWEET_BERRY_BUSH), new Item.Properties().food(Foods.SWEET_BERRIES)
); );
public static final Item GLOW_BERRIES = registerItem( public static final Item GLOW_BERRIES = registerItem(

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/SpawnEggItem.java --- a/net/minecraft/world/item/SpawnEggItem.java
+++ b/net/minecraft/world/item/SpawnEggItem.java +++ b/net/minecraft/world/item/SpawnEggItem.java
@@ -63,6 +_,23 @@ @@ -62,6 +_,23 @@
return InteractionResult.FAIL; return InteractionResult.FAIL;
} else { } else {
if (level.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper - Allow disabling mob spawner spawn egg transformation if (level.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper - Allow disabling mob spawner spawn egg transformation

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -162,10 +_,54 @@ @@ -168,10 +_,54 @@
} }
// Paper end - add paper world config // Paper end - add paper world config
@@ -55,7 +55,7 @@
public CraftWorld getWorld() { public CraftWorld getWorld() {
return this.world; return this.world;
} }
@@ -208,6 +_,8 @@ @@ -214,6 +_,8 @@
) { ) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
@@ -64,7 +64,7 @@
this.generator = generator; this.generator = generator;
this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment); this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment);
@@ -1472,4 +_,14 @@ @@ -1489,4 +_,14 @@
return ret; return ret;
} }
// Paper end - allow patching this logic // Paper end - allow patching this logic

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/Blocks.java --- a/net/minecraft/world/level/block/Blocks.java
+++ b/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java
@@ -6726,6 +_,7 @@ @@ -6727,6 +_,7 @@
BlockBehaviour.Properties.of() BlockBehaviour.Properties.of()
.mapColor(MapColor.PLANT) .mapColor(MapColor.PLANT)
.forceSolidOff() .forceSolidOff()
@@ -8,7 +8,7 @@
.instabreak() .instabreak()
.sound(SoundType.AZALEA) .sound(SoundType.AZALEA)
.noOcclusion() .noOcclusion()
@@ -6737,6 +_,7 @@ @@ -6738,6 +_,7 @@
BlockBehaviour.Properties.of() BlockBehaviour.Properties.of()
.mapColor(MapColor.PLANT) .mapColor(MapColor.PLANT)
.forceSolidOff() .forceSolidOff()

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/SignBlockEntity.java --- a/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -149,16 +_,32 @@ @@ -150,16 +_,32 @@
return this.setText(function.apply(text), isFrontText); return this.setText(function.apply(text), isFrontText);
} }
@@ -35,7 +35,7 @@
); );
} }
} }
@@ -308,6 +_,27 @@ @@ -309,6 +_,27 @@
commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, level, LevelBasedPermissionSet.GAMEMASTER, textName, displayName, level.getServer(), player // Paper - Fix commands from signs not firing command events commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, level, LevelBasedPermissionSet.GAMEMASTER, textName, displayName, level.getServer(), player // Paper - Fix commands from signs not firing command events
); );
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -88,7 +_,7 @@ @@ -87,7 +_,7 @@
Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP
}; };
public final boolean hasCollision; public final boolean hasCollision;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/phys/AABB.java --- a/net/minecraft/world/phys/AABB.java
+++ b/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java
@@ -476,4 +_,10 @@ @@ -485,5 +_,11 @@
return new AABB(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ); return new AABB(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ);
} }
} }
@@ -11,3 +11,4 @@
+ } + }
+ // Purpur end - Stop squids floating on top of water + // Purpur end - Stop squids floating on top of water
} }
}

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -584,10 +_,15 @@ @@ -586,10 +_,15 @@
@Override @Override
public void setPlayerListName(String name) { public void setPlayerListName(String name) {
@@ -17,7 +17,7 @@
if (this.getHandle().connection == null) return; // Paper - Updates are possible before the player has fully joined if (this.getHandle().connection == null) return; // Paper - Updates are possible before the player has fully joined
for (ServerPlayer player : this.server.getHandle().players) { for (ServerPlayer player : this.server.getHandle().players) {
if (player.getBukkitEntity().canSee(this)) { if (player.getBukkitEntity().canSee(this)) {
@@ -988,6 +_,80 @@ @@ -990,6 +_,80 @@
} }
} }
@@ -98,7 +98,7 @@
@Override @Override
public void sendBlockDamage(Location loc, float progress, org.bukkit.entity.Entity source) { public void sendBlockDamage(Location loc, float progress, org.bukkit.entity.Entity source) {
Preconditions.checkArgument(source != null, "source must not be null"); Preconditions.checkArgument(source != null, "source must not be null");
@@ -2495,6 +_,28 @@ @@ -2502,6 +_,28 @@
public float getWalkSpeed() { public float getWalkSpeed() {
return this.getHandle().getAbilities().walkingSpeed * 2f; return this.getHandle().getAbilities().walkingSpeed * 2f;
} }