9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Updated Upstream (Paper/Purpur)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@4d854e66 Disable MC-163962 fix by default

Purpur Changes:
PurpurMC/Purpur@04a9045d Fix phantom high speed by modifying the speed: Part 2 (#1682)
PurpurMC/Purpur@175bb181 [ci/skip] micro opt when applying block friction on flying ridable mobs
PurpurMC/Purpur@d0b705e4 Updated Upstream (Paper)
PurpurMC/Purpur@3658291d Fix llama not moving when ridden, Fixes #1507 (#1684)
PurpurMC/Purpur@051566db check for purpur.debug.f3n on new serverbound change gamemode packet, closes #1683
PurpurMC/Purpur@a112b6ac Final 1.21.6 Upstream (Paper)
This commit is contained in:
Dreeam
2025-07-01 14:17:26 +08:00
parent 4a02cf7cbc
commit c72f7dab2d
7 changed files with 72 additions and 35 deletions

View File

@@ -2,7 +2,7 @@ group=cn.dreeam.leaf
mcVersion=1.21.6
version=1.21.6-R0.1-SNAPSHOT
paperCommit=57c202e01516b653aea9c7e050eaded1448863e5
paperCommit=4d854e66b80dad9898d71a0f0b1f83cd39b97119
org.gradle.configuration-cache=true
org.gradle.caching=true

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] Purpur API Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
Commit: dfd8a7ad14f436ea9c4704a758305e7145923c2d
Commit: a112b6aca718e4500a6d48ca9d7158faf0f4adf9
Patches listed below are removed in this patch, They exists in Gale or Leaf:
* "co/aikar/timings/TimedEventExecutor.java.patch"

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] Purpur Server Minecraft Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
Commit: dfd8a7ad14f436ea9c4704a758305e7145923c2d
Commit: a112b6aca718e4500a6d48ca9d7158faf0f4adf9
Patches listed below are removed in this patch, They exists in Gale or Leaf:
* "net/minecraft/CrashReport.java.patch"
@@ -38,8 +38,6 @@ Patches listed below are removed in this patch, They exists in Gale or Leaf:
- MC-238526 - Fix spawner not spawning water animals correctly
* "net/minecraft/world/entity/projectile/AbstractArrow.java.patch"
- Arrows should not reset despawn counter
* "net/minecraft/world/inventory/AbstractContainerMenu.java.patch"
- PaperPR#12654
* "net/minecraft/world/level/chunk/storage/RegionFileStorage.java.patch"
- Rebrand
@@ -1299,7 +1297,7 @@ index ddc89e8960f7dc2f75f0e03ccbe6eda96a0499e2..8a4c8e2fb86274b5bf95bda510029f4c
this.player.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.wrappedBuffer(data)).readUtf(256);
}
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a07310aebd8406af27864358e15715fcc7694329..72292ee9620ee369ccee00dd0280bf6041d3afca 100644
index a07310aebd8406af27864358e15715fcc7694329..acb1eda4a4b10006e1dd641ee41ee77ebf11d142 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -324,6 +324,20 @@ public class ServerGamePacketListenerImpl
@@ -1533,6 +1531,15 @@ index a07310aebd8406af27864358e15715fcc7694329..72292ee9620ee369ccee00dd0280bf60
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
if ((target instanceof net.minecraft.world.entity.animal.Bucketable && target instanceof LivingEntity && origItem != null && origItem == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelectedItem().isEmpty() || !ServerGamePacketListenerImpl.this.player.getInventory().getSelectedItem().is(origItem))) {
target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it
@@ -3543,7 +3627,7 @@ public class ServerGamePacketListenerImpl
@Override
public void handleChangeGameMode(ServerboundChangeGameModePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
- if (!this.player.hasPermissions(2)) {
+ if (!this.player.hasPermissions(2) && !player.getBukkitEntity().hasPermission("purpur.debug.f3n")) { // Purpur - Add permission for F3+N debug
LOGGER.warn(
"Player {} tried to change game mode to {} without required permissions",
this.player.getGameProfile().getName(),
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index dc225eaa0daf238e091a0cf63a42158a30ecb7f0..c61a94a08486cdeba84ccfbc58ef3cabd4a461d8 100644
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -2304,7 +2311,7 @@ index aab9adb8313c4b18279c7fd7500ef04bda09c6c1..86a694b94045b47f6e98c480645f7573
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 5025e1eb7be566c21b6228038fd6596f4ac53e9a..d7d6e0543dc26694891e4a9049b8162caadbf5e6 100644
index fd775ce9a6ca84ce348d929f75f019581a437ea4..dd5343287503e2818e083696a17362091d94e652 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -236,9 +236,9 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -2523,7 +2530,29 @@ index 5025e1eb7be566c21b6228038fd6596f4ac53e9a..d7d6e0543dc26694891e4a9049b8162c
}
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
@@ -3153,6 +3214,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3013,6 +3074,21 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.5));
} else {
+ // Purpur start - Ridables
+ if (this.getRider() != null && this.isControllable()) {
+ float friction = 0.91F;
+ if (this.onGround()) {
+ friction = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.91F;
+ }
+
+ float frictionCompensation = 0.16277137F / (friction * friction * friction);
+ this.moveRelative(this.onGround() ? 0.1F * frictionCompensation : 0.02F, relative);
+ this.move(MoverType.SELF, this.getDeltaMovement());
+ this.setDeltaMovement(this.getDeltaMovement().scale(friction));
+ return;
+ }
+ // Purpur end - Ridables
+
this.moveRelative(amount, relative);
this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.91F));
@@ -3153,6 +3229,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
float f = (float)(d * 10.0 - 3.0);
if (f > 0.0F) {
this.playSound(this.getFallDamageSound((int)f), 1.0F, 1.0F);
@@ -2531,7 +2560,7 @@ index 5025e1eb7be566c21b6228038fd6596f4ac53e9a..d7d6e0543dc26694891e4a9049b8162c
this.hurt(this.damageSources().flyIntoWall(), f);
}
}
@@ -3596,8 +3658,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3596,8 +3673,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.pushEntities();
// Paper start - Add EntityMoveEvent
@@ -2544,7 +2573,7 @@ index 5025e1eb7be566c21b6228038fd6596f4ac53e9a..d7d6e0543dc26694891e4a9049b8162c
Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
@@ -3607,11 +3671,52 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3607,11 +3686,52 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.absSnapTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
}
}
@@ -2597,7 +2626,7 @@ index 5025e1eb7be566c21b6228038fd6596f4ac53e9a..d7d6e0543dc26694891e4a9049b8162c
}
protected void applyInput() {
@@ -3645,7 +3750,18 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3645,7 +3765,18 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
.filter(equipmentSlot1 -> canGlideUsing(this.getItemBySlot(equipmentSlot1), equipmentSlot1))
.toList();
EquipmentSlot equipmentSlot = Util.getRandom(list, this.random);
@@ -2617,7 +2646,7 @@ index 5025e1eb7be566c21b6228038fd6596f4ac53e9a..d7d6e0543dc26694891e4a9049b8162c
}
this.gameEvent(GameEvent.ELYTRA_GLIDE);
@@ -4533,6 +4649,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -4533,6 +4664,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType());
}
@@ -6788,10 +6817,10 @@ index 2a1d720557c0bd4895a32723e34512c0a557e4f2..f1080a40f759b30b921b88b4f6edd35f
protected void randomizeAttributes(RandomSource random) {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(generateMaxHealth(random::nextInt));
diff --git a/net/minecraft/world/entity/animal/horse/Llama.java b/net/minecraft/world/entity/animal/horse/Llama.java
index 1e2b629641e5fa1040307461dbbf03ad2d75ba00..1bef43f42aee02a0a00556318607072ce9814860 100644
index 1e2b629641e5fa1040307461dbbf03ad2d75ba00..455a84ffa16152137409777e1fddbab5a21bd57d 100644
--- a/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/net/minecraft/world/entity/animal/horse/Llama.java
@@ -78,12 +78,95 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
@@ -78,12 +78,102 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
private Llama caravanHead;
@Nullable
public Llama caravanTail; // Paper
@@ -6843,7 +6872,14 @@ index 1e2b629641e5fa1040307461dbbf03ad2d75ba00..1bef43f42aee02a0a00556318607072c
+
+ @Override
+ public boolean isSaddled() {
+ return super.isSaddled() || (isTamed());
+ return super.isWearingBodyArmor() || this.isTamed();
+ }
+
+ @Nullable
+ @Override
+ public LivingEntity getControllingPassenger() {
+ Entity firstPassenger = this.getFirstPassenger();
+ return !this.isNoAi() && firstPassenger instanceof net.minecraft.world.entity.Mob mob && firstPassenger.canControlVehicle() ? mob : null;
+ }
+ // Purpur end - Ridables
+
@@ -6887,7 +6923,7 @@ index 1e2b629641e5fa1040307461dbbf03ad2d75ba00..1bef43f42aee02a0a00556318607072c
public boolean isTraderLlama() {
return false;
@@ -112,6 +195,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
@@ -112,6 +202,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
super.addAdditionalSaveData(output);
output.store("Variant", Llama.Variant.LEGACY_CODEC, this.getVariant());
output.putInt("Strength", this.getStrength());
@@ -6895,7 +6931,7 @@ index 1e2b629641e5fa1040307461dbbf03ad2d75ba00..1bef43f42aee02a0a00556318607072c
}
@Override
@@ -119,11 +203,13 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
@@ -119,11 +210,13 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
this.setStrength(input.getIntOr("Strength", 0));
super.readAdditionalSaveData(input);
this.setVariant(input.read("Variant", Llama.Variant.LEGACY_CODEC).orElse(Llama.Variant.DEFAULT));
@@ -6909,7 +6945,7 @@ index 1e2b629641e5fa1040307461dbbf03ad2d75ba00..1bef43f42aee02a0a00556318607072c
this.goalSelector.addGoal(1, new RunAroundLikeCrazyGoal(this, 1.2));
this.goalSelector.addGoal(2, new LlamaFollowCaravanGoal(this, 2.1F));
this.goalSelector.addGoal(3, new RangedAttackGoal(this, 1.25, 40, 20.0F));
@@ -134,6 +220,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
@@ -134,6 +227,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 0.7));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(9, new RandomLookAroundGoal(this));
@@ -6917,7 +6953,7 @@ index 1e2b629641e5fa1040307461dbbf03ad2d75ba00..1bef43f42aee02a0a00556318607072c
this.targetSelector.addGoal(1, new Llama.LlamaHurtByTargetGoal(this));
this.targetSelector.addGoal(2, new Llama.LlamaAttackWolfGoal(this));
}
@@ -400,6 +487,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
@@ -400,6 +494,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
public void leaveCaravan() {
if (this.caravanHead != null) {
@@ -6925,7 +6961,7 @@ index 1e2b629641e5fa1040307461dbbf03ad2d75ba00..1bef43f42aee02a0a00556318607072c
this.caravanHead.caravanTail = null;
}
@@ -407,6 +495,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
@@ -407,6 +502,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
}
public void joinCaravan(Llama caravanHead) {
@@ -9846,7 +9882,7 @@ index 5ef9566b16a4d0300ee45a993c46e734db156416..04d5910d736dee2a88a2602f4a984954
return false;
} else {
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
index ffcfdbc80df2a9e6c546348b86e7615e6109eb49..d25392babee8cb8eea9f5d6fef4529a952644e52 100644
index ffcfdbc80df2a9e6c546348b86e7615e6109eb49..3b812e0860e37d30d5d12f97410ed5fd2babadf6 100644
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -49,19 +49,111 @@ public class Phantom extends Mob implements Enemy {
@@ -10041,7 +10077,7 @@ index ffcfdbc80df2a9e6c546348b86e7615e6109eb49..d25392babee8cb8eea9f5d6fef4529a9
+ this.setSpeed(speed);
+ Vec3 mot = this.getDeltaMovement();
+ this.move(net.minecraft.world.entity.MoverType.SELF, mot.multiply(speed, speed, speed));
+ this.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO);
+ this.setDeltaMovement(mot.scale(0.9D));
+ }
+ // Purpur end - Ridables
}
@@ -14540,20 +14576,21 @@ index 6040b73a5351c3eb166250566b5c2385cee39ee0..29619b87fe19c66934fe5aaee8a96419
}
diff --git a/net/minecraft/world/item/trading/MerchantOffer.java b/net/minecraft/world/item/trading/MerchantOffer.java
index 9333c63f217e1207eced37c5be150e192f2fcc3e..156cee58134ada34d249aab948c02adac4f6745a 100644
index 64c99df8ff305fa28c75dc03fc5ef8c61634ad84..e1452d0694cad3db1800f8610fc095bf98f5f15f 100644
--- a/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/net/minecraft/world/item/trading/MerchantOffer.java
@@ -143,7 +143,12 @@ public class MerchantOffer {
@@ -143,8 +143,13 @@ public class MerchantOffer {
}
public void updateDemand() {
- this.demand = Math.max(0, this.demand + this.uses - (this.maxUses - this.uses)); // Paper - Fix MC-163962
+ // Purpur start - Configurable minimum demand for trades
+ this.updateDemand(0);
+ }
+ public void updateDemand(int minimumDemand) {
+ this.demand = Math.max(minimumDemand, this.demand + this.uses - (this.maxUses - this.uses)); // Paper - Fix MC-163962
+ // Purpur end - Configurable minimum demand for trades
this.demand = this.demand + this.uses - (this.maxUses - this.uses);
- if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.preventNegativeVillagerDemand) this.demand = Math.max(0, this.demand); // Paper - Fix MC-163962
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.preventNegativeVillagerDemand) this.demand = Math.max(minimumDemand, this.demand); // Paper - Fix MC-163962 // Purpur - Configurable minimum demand for trades
}
public ItemStack assemble() {

View File

@@ -12,7 +12,7 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 19881624b91f44c9332ad4ba147a66837864da06..4a06812757ab46a975f182d8ada03e19802e7e5f 100644
index 78c212fb8a8a8ffefe6fc860f1e06d16ba09bb40..ca167a295f15ccde2d02cf83fe83aa445483a10b 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2828,6 +2828,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -23,7 +23,7 @@ index 19881624b91f44c9332ad4ba147a66837864da06..4a06812757ab46a975f182d8ada03e19
int currentSwingDuration = this.getCurrentSwingDuration();
if (this.swinging) {
this.swingTime++;
@@ -3760,6 +3761,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3775,6 +3776,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
protected void updateFallFlying() {
this.checkFallDistanceAccumulation();
if (!this.level().isClientSide) {

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Only player pushable
Useful for extreme cases like massive entities collide together in a small area
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 4a06812757ab46a975f182d8ada03e19802e7e5f..e04a84d7fd2185013695e66647ec6faab35423af 100644
index ca167a295f15ccde2d02cf83fe83aa445483a10b..1d78cacbf2c63f35fdf0552d50834385ab51aaf0 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3682,7 +3682,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3697,7 +3697,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.checkAutoSpinAttack(boundingBox, this.getBoundingBox());
}
@@ -18,7 +18,7 @@ index 4a06812757ab46a975f182d8ada03e19802e7e5f..e04a84d7fd2185013695e66647ec6faa
// Paper start - Add EntityMoveEvent
// Purpur start - Ridables
if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
@@ -3829,7 +3829,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3844,7 +3844,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
return;
}
// Paper end - don't run getEntities if we're not going to use its result
@@ -32,7 +32,7 @@ index 4a06812757ab46a975f182d8ada03e19802e7e5f..e04a84d7fd2185013695e66647ec6faa
if (!pushableEntities.isEmpty()) {
if (this.level() instanceof ServerLevel serverLevel) {
// Paper - don't run getEntities if we're not going to use its result; moved up
@@ -3863,6 +3868,44 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3878,6 +3883,44 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
}

View File

@@ -18,10 +18,10 @@ index 6d8c500839062ca0cad2ffc58dad0de1626c0eb9..cc015575efcb0c3d56d33510a1f43f40
}
}
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index e04a84d7fd2185013695e66647ec6faab35423af..f95792b8642dc86a4d88e1d756de65d6cae2fa98 100644
index 1d78cacbf2c63f35fdf0552d50834385ab51aaf0..f1975e5ab19da6dd1d8b94503924471e3efab921 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -4139,9 +4139,9 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -4154,9 +4154,9 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
if (randomizeMotion) {

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] Purpur Server Paper Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
Commit: dfd8a7ad14f436ea9c4704a758305e7145923c2d
Commit: a112b6aca718e4500a6d48ca9d7158faf0f4adf9
Patches listed below are removed in this patch, They exists in Gale or Leaf:
* "Rebrand.patch"