mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-04-22 03:08:16 +02:00
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:
@@ -63,5 +63,5 @@
|
||||
+ 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
|
||||
|
||||
this.saveEverything(false, true, true);
|
||||
this.notificationManager().serverStarted();
|
||||
return true;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
private final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -377,8 +_,25 @@
|
||||
@@ -378,8 +_,25 @@
|
||||
// CraftBukkit end
|
||||
this.tickTime = tickTime;
|
||||
this.server = server;
|
||||
@@ -36,7 +36,7 @@
|
||||
ChunkGenerator generator = levelStem.generator();
|
||||
// CraftBukkit start
|
||||
this.serverLevelData.setWorld(this);
|
||||
@@ -463,6 +_,7 @@
|
||||
@@ -464,6 +_,7 @@
|
||||
this.environmentAttributes = EnvironmentAttributeSystem.builder().addDefaultLayers(this).build();
|
||||
this.updateSkyBrightness();
|
||||
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -519,7 +_,7 @@
|
||||
@@ -520,7 +_,7 @@
|
||||
}
|
||||
|
||||
int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
|
||||
@@ -53,7 +53,7 @@
|
||||
Optional<Holder<WorldClock>> defaultClock = this.dimensionType().defaultClock();
|
||||
org.bukkit.event.world.TimeSkipEvent event = null; // Paper - time skip event
|
||||
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.getBlockState(pos.below()).is(BlockTags.LIGHTNING_RODS);
|
||||
if (isTrap) {
|
||||
@@ -73,7 +73,7 @@
|
||||
horse.setAge(0);
|
||||
horse.setPos(pos.getX(), pos.getY(), pos.getZ());
|
||||
this.addFreshEntity(horse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
|
||||
@@ -762,9 +_,35 @@
|
||||
@@ -765,9 +_,35 @@
|
||||
if (state.is(Blocks.SNOW)) {
|
||||
int currentLayers = state.getValue(SnowLayerBlock.LAYERS);
|
||||
if (currentLayers < Math.min(maxHeight, 8)) {
|
||||
@@ -109,7 +109,7 @@
|
||||
}
|
||||
} else {
|
||||
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),
|
||||
lightningRodPos -> lightningRodPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, lightningRodPos.getX(), lightningRodPos.getZ()) - 1,
|
||||
center,
|
||||
@@ -118,7 +118,7 @@
|
||||
PoiManager.Occupancy.ANY
|
||||
);
|
||||
return nearbyLightningRod.map(blockPos -> blockPos.above(1));
|
||||
@@ -833,8 +_,26 @@
|
||||
@@ -836,8 +_,26 @@
|
||||
int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
|
||||
Component message;
|
||||
if (this.sleepStatus.areEnoughSleeping(percentage)) {
|
||||
@@ -145,7 +145,7 @@
|
||||
message = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(percentage));
|
||||
}
|
||||
|
||||
@@ -1000,6 +_,7 @@
|
||||
@@ -1003,6 +_,7 @@
|
||||
public void resetWeatherCycle() {
|
||||
WeatherData weatherData = this.getWeatherData();
|
||||
// CraftBukkit start
|
||||
@@ -153,7 +153,7 @@
|
||||
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.
|
||||
// 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);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -161,7 +161,7 @@
|
||||
weatherData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
|
||||
// CraftBukkit start
|
||||
// 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) {
|
||||
case NONE -> Explosion.BlockInteraction.KEEP;
|
||||
case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY);
|
||||
@@ -170,7 +170,7 @@
|
||||
? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY)
|
||||
: Explosion.BlockInteraction.KEEP;
|
||||
case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY);
|
||||
@@ -2539,7 +_,7 @@
|
||||
@@ -2561,7 +_,7 @@
|
||||
// Spigot start
|
||||
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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -447,6 +_,9 @@
|
||||
@@ -448,6 +_,9 @@
|
||||
public boolean isRealPlayer; // Paper
|
||||
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
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
public ServerPlayer(final MinecraftServer server, final ServerLevel level, final GameProfile gameProfile, final ClientInformation clientInformation) {
|
||||
super(level, gameProfile);
|
||||
@@ -490,6 +_,9 @@
|
||||
@@ -491,6 +_,9 @@
|
||||
this.respawnConfig = input.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null);
|
||||
this.spawnExtraParticlesOnFall = input.getBooleanOr("spawn_extra_particles_on_fall", false);
|
||||
this.raidOmenPosition = input.read("raid_omen_position", BlockPos.CODEC).orElse(null);
|
||||
@@ -20,7 +20,7 @@
|
||||
// Paper start - Expand PlayerGameModeChangeEvent
|
||||
this.loadGameTypes(input);
|
||||
}
|
||||
@@ -531,6 +_,9 @@
|
||||
@@ -532,6 +_,9 @@
|
||||
output.store("ShoulderEntityRight", CompoundTag.CODEC, this.getShoulderEntityRight());
|
||||
}
|
||||
this.getBukkitEntity().setExtraData(output); // CraftBukkit
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
private void saveParentVehicle(final ValueOutput playerOutput) {
|
||||
@@ -1166,6 +_,7 @@
|
||||
@@ -1167,6 +_,7 @@
|
||||
// Paper - moved up to sendClientboundPlayerCombatKillPacket()
|
||||
sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
|
||||
Team team = this.getTeam();
|
||||
@@ -38,7 +38,7 @@
|
||||
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
|
||||
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
|
||||
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
|
||||
@@ -1274,6 +_,13 @@
|
||||
@@ -1275,6 +_,13 @@
|
||||
if (this.isInvulnerableTo(level, source)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -52,7 +52,7 @@
|
||||
Entity entity = source.getEntity();
|
||||
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))
|
||||
@@ -1531,6 +_,7 @@
|
||||
@@ -1534,6 +_,7 @@
|
||||
|
||||
profiler.pop();
|
||||
profiler.push("placing");
|
||||
@@ -60,7 +60,7 @@
|
||||
this.setServerLevel(newLevel);
|
||||
this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit - use internal teleport without event
|
||||
this.connection.resetPosition();
|
||||
@@ -1647,7 +_,7 @@
|
||||
@@ -1650,7 +_,7 @@
|
||||
),
|
||||
monster -> monster.isPreventingPlayerRest(this.level(), this)
|
||||
);
|
||||
@@ -69,7 +69,7 @@
|
||||
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
|
||||
}
|
||||
}
|
||||
@@ -1687,8 +_,19 @@
|
||||
@@ -1690,8 +_,19 @@
|
||||
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
if (!this.level().canSleepThroughNights()) {
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
this.level().updateSleepingPlayerList();
|
||||
return result;
|
||||
@@ -1782,6 +_,7 @@
|
||||
@@ -1785,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
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 ClientboundOpenSignEditorPacket(sign.getBlockPos(), isFrontText));
|
||||
}
|
||||
@@ -2125,6 +_,26 @@
|
||||
@@ -2128,6 +_,26 @@
|
||||
this.lastSentExp = -1; // CraftBukkit - Added to reset
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
@Override
|
||||
public void completeUsingItem() {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
@@ -2364,6 +_,20 @@
|
||||
@@ -2367,6 +_,20 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
@Override
|
||||
public void sendSystemMessage(final Component message) {
|
||||
this.sendSystemMessage(message, false);
|
||||
@@ -2511,7 +_,67 @@
|
||||
@@ -2518,7 +_,67 @@
|
||||
|
||||
public void resetLastActionTime() {
|
||||
this.lastActionTime = Util.getMillis();
|
||||
@@ -215,7 +215,7 @@
|
||||
|
||||
public ServerStatsCounter getStats() {
|
||||
return this.stats;
|
||||
@@ -3136,4 +_,65 @@
|
||||
@@ -3143,4 +_,65 @@
|
||||
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -364,6 +_,7 @@
|
||||
@@ -370,6 +_,7 @@
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -494,6 +_,7 @@
|
||||
@@ -500,6 +_,7 @@
|
||||
public InteractionResult useItemOn(
|
||||
final ServerPlayer player, final Level level, final ItemStack itemStack, final InteractionHand hand, final BlockHitResult hitResult
|
||||
) {
|
||||
@@ -16,7 +16,7 @@
|
||||
BlockPos pos = hitResult.getBlockPos();
|
||||
BlockState state = level.getBlockState(pos);
|
||||
boolean cancelledBlock = false;
|
||||
@@ -542,7 +_,7 @@
|
||||
@@ -548,7 +_,7 @@
|
||||
boolean haveSomethingInOurHands = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
|
||||
boolean suppressUsingBlock = player.isSecondaryUseActive() && haveSomethingInOurHands;
|
||||
ItemStack usedItemStack = itemStack.copy();
|
||||
@@ -25,7 +25,7 @@
|
||||
InteractionResult itemUse = state.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult);
|
||||
if (itemUse.consumesAction()) {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, pos, usedItemStack);
|
||||
@@ -588,4 +_,18 @@
|
||||
@@ -594,4 +_,18 @@
|
||||
public void setLevel(final ServerLevel newLevel) {
|
||||
this.level = newLevel;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@
|
||||
private boolean shouldCheckPlayerMovement(final boolean isFallFlying) {
|
||||
if (this.isSingleplayerOwner()) {
|
||||
return false;
|
||||
@@ -2155,6 +_,7 @@
|
||||
@@ -2150,6 +_,7 @@
|
||||
|
||||
boolean cancelled;
|
||||
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);
|
||||
cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
} else {
|
||||
@@ -2800,6 +_,7 @@
|
||||
if (target != null && level.getWorldBorder().isWithinBounds(target.blockPosition())) {
|
||||
AABB targetBounds = target.getBoundingBox();
|
||||
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 (target instanceof net.minecraft.world.entity.Mob mob) mob.ticksSinceLastInteraction = 0; // Purpur - Entity lifespan
|
||||
if (!(target instanceof ItemEntity)
|
||||
&& !(target instanceof ExperienceOrb)
|
||||
&& (target != this.player || this.player.isSpectator()) // CraftBukkit
|
||||
@@ -3590,7 +_,7 @@
|
||||
@@ -2791,6 +_,7 @@
|
||||
ItemStack mainHandItem = this.player.getMainHandItem();
|
||||
if (this.player.isWithinAttackRange(mainHandItem, targetBounds, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience
|
||||
if (!mainHandItem.has(DataComponents.PIERCING_WEAPON)) {
|
||||
+ if (target instanceof net.minecraft.world.entity.Mob mob) mob.ticksSinceLastInteraction = 0; // Purpur - Entity lifespan
|
||||
if (target instanceof ItemEntity
|
||||
|| target instanceof ExperienceOrb
|
||||
|| target == this.player
|
||||
@@ -3572,7 +_,7 @@
|
||||
@Override
|
||||
public void handleChangeGameMode(final ServerboundChangeGameModePacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/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.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(name)); // Spigot
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user