Upstream Paper's upgrade to vineflower 12.0.0 (#1782)

This commit is contained in:
granny
2026-05-31 16:42:41 -07:00
committed by GitHub
parent dc4a255969
commit 3fe5edd4b5
116 changed files with 1321 additions and 1333 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -454,6 +_,9 @@
@@ -435,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 @@
// Paper start - rewrite chunk system
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
@@ -527,6 +_,9 @@
@@ -508,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);
}
@@ -568,6 +_,9 @@
@@ -549,6 +_,9 @@
output.store("ShoulderEntityRight", CompoundTag.CODEC, this.getShoulderEntityRight());
}
this.getBukkitEntity().setExtraData(output); // CraftBukkit
@@ -30,7 +30,7 @@
}
private void saveParentVehicle(final ValueOutput playerOutput) {
@@ -1203,6 +_,7 @@
@@ -1179,6 +_,7 @@
// Paper - moved up to sendClientboundPlayerCombatKillPacket()
sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
Team team = this.getTeam();
@@ -38,59 +38,66 @@
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
@@ -1311,6 +_,13 @@
if (this.isInvulnerableTo(level, source)) {
@@ -1288,6 +_,13 @@
return false;
} else {
+ // Purpur start - Add boat fall damage config
+ if (source.is(net.minecraft.tags.DamageTypeTags.IS_FALL)) {
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.boat.Boat && !level().purpurConfig.boatsDoFallDamage) {
+ return false;
+ }
}
+ // Purpur start - Add boat fall damage config
+ if (source.is(net.minecraft.tags.DamageTypeTags.IS_FALL)) {
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.boat.Boat && !level().purpurConfig.boatsDoFallDamage) {
+ return false;
+ }
+ // Purpur end - Add boat fall damage config
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))
@@ -1570,6 +_,7 @@
+ }
+ // Purpur end - Add boat fall damage config
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 player && !this.canHarmPlayer(player))
@@ -1529,7 +_,7 @@
}
profiler.pop();
profiler.push("placing");
+ this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPos(exit); // Purpur - Fix stuck in portals
this.setServerLevel(newLevel);
this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
@@ -1686,7 +_,7 @@
),
monster -> monster.isPreventingPlayerRest(this.level(), this)
);
- if (!monsters.isEmpty()) {
+ if (!this.level().purpurConfig.playerSleepNearMonsters && !monsters.isEmpty()) { // Purpur - Config to ignore nearby mobs when sleeping
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -1726,8 +_,19 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
});
if (!this.level().canSleepThroughNights()) {
- this.sendOverlayMessage(Component.translatable("sleep.not_possible"));
+ // Purpur start - Customizable sleeping actionbar messages
+ Component clientMessage;
+ if (org.purpurmc.purpur.PurpurConfig.sleepNotPossible.isBlank()) {
+ clientMessage = null;
+ } else if (!org.purpurmc.purpur.PurpurConfig.sleepNotPossible.equalsIgnoreCase("default")) {
+ clientMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepNotPossible));
+ } else {
+ clientMessage = Component.translatable("sleep.not_possible");
}
+ if (clientMessage != null) {
+ this.sendOverlayMessage(clientMessage);
+ }// Purpur end - Customizable sleeping actionbar messages
+ }
if (newLevel.dimension() == lastDimension) {
- this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit
+ this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit
this.connection.resetPosition();
transition.postTeleportTransition().onTransition(this);
return this;
@@ -1552,6 +_,7 @@
this.level().updateSleepingPlayerList();
return result;
@@ -1821,6 +_,7 @@
profiler.pop();
profiler.push("placing");
+ this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPos(exit); // Purpur - Fix stuck in portals
this.setServerLevel(newLevel);
this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
@@ -1664,7 +_,7 @@
new AABB(bedCenter.x() - 8.0, bedCenter.y() - 5.0, bedCenter.z() - 8.0, bedCenter.x() + 8.0, bedCenter.y() + 5.0, bedCenter.z() + 8.0),
monster -> monster.isPreventingPlayerRest(this.level(), this)
);
- if (!monsters.isEmpty()) {
+ if (!this.level().purpurConfig.playerSleepNearMonsters && !monsters.isEmpty()) { // Purpur - Config to ignore nearby mobs when sleeping
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -1700,7 +_,17 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
});
if (!this.level().canSleepThroughNights()) {
- this.sendOverlayMessage(Component.translatable("sleep.not_possible"));
+ // Purpur start - Customizable sleeping actionbar messages
+ Component clientMessage;
+ if (org.purpurmc.purpur.PurpurConfig.sleepNotPossible.isBlank()) {
+ clientMessage = null;
+ } else if (!org.purpurmc.purpur.PurpurConfig.sleepNotPossible.equalsIgnoreCase("default")) {
+ clientMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepNotPossible));
+ } else {
+ clientMessage = Component.translatable("sleep.not_possible");
+ } if (clientMessage != null) {
+ this.sendOverlayMessage(clientMessage);
+ }// Purpur end - Customizable sleeping actionbar messages
}
this.level().updateSleepingPlayerList();
@@ -1794,6 +_,7 @@
@Override
public void openTextEdit(final SignBlockEntity sign, final boolean isFrontText) {
@@ -98,7 +105,7 @@
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), sign.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), isFrontText));
}
@@ -2164,6 +_,26 @@
@@ -2138,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -125,7 +132,7 @@
@Override
public void completeUsingItem() {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
@@ -2403,6 +_,20 @@
@@ -2373,6 +_,20 @@
);
}
@@ -146,7 +153,7 @@
@Override
public void sendSystemMessage(final Component message) {
this.sendSystemMessage(message, false);
@@ -2554,7 +_,67 @@
@@ -2524,7 +_,67 @@
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
@@ -215,7 +222,7 @@
public ServerStatsCounter getStats() {
return this.stats;
@@ -3179,4 +_,65 @@
@@ -3149,4 +_,65 @@
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end