Update to 1.21.11-pre4 (#13357)

This commit is contained in:
Jason Penilla 2025-12-01 10:24:41 -07:00 committed by GitHub
parent 6348ac89df
commit b786cbe83a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 90 additions and 28 deletions

View File

@ -1,6 +1,6 @@
group=io.papermc.paper
version=1.21.11-pre3-R0.1-SNAPSHOT
mcVersion=1.21.11-pre3
version=1.21.11-pre4-R0.1-SNAPSHOT
mcVersion=1.21.11-pre4
# This is the current API version for use in (paper-)plugin.yml files
# During snapshot cycles this should be the anticipated version of the release target
apiVersion=1.21.11

View File

@ -27,6 +27,12 @@ public interface AttackRange {
@Contract(pure = true)
@Range(from = 0, to = 64) float maxReach();
@Contract(pure = true)
@Range(from = 0, to = 64) float minCreativeReach();
@Contract(pure = true)
@Range(from = 0, to = 64) float maxCreativeReach();
@Contract(pure = true)
@Range(from = 0, to = 1) float hitboxMargin();
@ -46,6 +52,12 @@ public interface AttackRange {
@Contract(value = "_ -> this", mutates = "this")
Builder maxReach(@Range(from = 0, to = 64) float maxReach);
@Contract(value = "_ -> this", mutates = "this")
Builder minCreativeReach(@Range(from = 0, to = 64) float minCreativeReach);
@Contract(value = "_ -> this", mutates = "this")
Builder maxCreativeReach(@Range(from = 0, to = 64) float maxCreativeReach);
@Contract(value = "_ -> this", mutates = "this")
Builder hitboxMargin(@Range(from = 0, to = 1) float hitboxMargin);

View File

@ -14,7 +14,7 @@ plugins {
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
dependencies {
mache("io.papermc:mache:1.21.11-pre3+build.3")
mache("io.papermc:mache:1.21.11-pre4+build.1")
paperclip("io.papermc:paperclip:3.0.3")
}

View File

@ -1225,10 +1225,10 @@
}
@Override
@@ -1578,12 +_,12 @@
@@ -1578,18 +_,18 @@
this.onUpdateAbilities();
this.getAttributes().assignBaseValues(that.getAttributes());
if (keepEverything) {
this.getAttributes().assignBaseValues(that.getAttributes());
- this.getAttributes().assignPermanentModifiers(that.getAttributes());
+ // this.getAttributes().assignPermanentModifiers(that.getAttributes()); // CraftBukkit
this.setHealth(that.getHealth());
@ -1239,17 +1239,15 @@
+ // this.addEffect(new MobEffectInstance(mobEffectInstance)); // CraftBukkit
}
this.getInventory().replaceWith(that.getInventory());
@@ -1594,7 +_,7 @@
this.transferInventoryXpAndScore(that);
this.portalProcess = that.portalProcess;
} else {
this.getAttributes().assignBaseValues(that.getAttributes());
- this.setHealth(this.getMaxHealth());
+ // this.setHealth(this.getMaxHealth()); // CraftBukkit
if (this.level().getGameRules().get(GameRules.KEEP_INVENTORY) || that.isSpectator()) {
this.getInventory().replaceWith(that.getInventory());
this.experienceLevel = that.experienceLevel;
@@ -1610,7 +_,7 @@
this.transferInventoryXpAndScore(that);
}
@@ -1601,7 +_,7 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Animal.java
+++ b/net/minecraft/world/entity/animal/Animal.java
@@ -39,6 +_,7 @@
@@ -45,6 +_,7 @@
private static final int DEFAULT_IN_LOVE_TIME = 0;
public int inLove = 0;
public @Nullable EntityReference<ServerPlayer> loveCause;
@ -8,7 +8,7 @@
protected Animal(EntityType<? extends Animal> type, Level level) {
super(type, level);
@@ -78,9 +_,13 @@
@@ -84,9 +_,13 @@
}
@Override
@ -24,7 +24,7 @@
}
@Override
@@ -136,8 +_,9 @@
@@ -142,8 +_,9 @@
if (this.isFood(itemInHand)) {
int age = this.getAge();
if (player instanceof ServerPlayer serverPlayer && age == 0 && this.canFallInLove()) {
@ -35,7 +35,7 @@
this.playEatingSound();
return InteractionResult.SUCCESS_SERVER;
}
@@ -164,8 +_,23 @@
@@ -170,8 +_,23 @@
return this.inLove <= 0;
}
@ -60,7 +60,7 @@
if (player instanceof ServerPlayer serverPlayer) {
this.loveCause = EntityReference.of(serverPlayer);
}
@@ -202,23 +_,45 @@
@@ -208,23 +_,45 @@
if (breedOffspring != null) {
breedOffspring.setBaby(true);
breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/nautilus/AbstractNautilus.java
+++ b/net/minecraft/world/entity/animal/nautilus/AbstractNautilus.java
@@ -258,7 +_,7 @@
@@ -263,7 +_,7 @@
boolean hasEffect = player.hasEffect(MobEffects.BREATH_OF_THE_NAUTILUS);
boolean flag = level.getGameTime() % 40L == 0L;
if (!hasEffect || flag) {
@ -9,7 +9,7 @@
}
}
}
@@ -400,7 +_,7 @@
@@ -405,7 +_,7 @@
if (this.isFood(itemInHand) && this.getHealth() < this.getMaxHealth()) {
FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD);
@ -18,7 +18,7 @@
this.usePlayerItem(player, hand, itemInHand);
this.playEatingSound();
return InteractionResult.SUCCESS;
@@ -422,7 +_,7 @@
@@ -427,7 +_,7 @@
}
private void tryToTame(Player player) {
@ -27,7 +27,7 @@
this.tame(player);
this.navigation.stop();
this.level().broadcastEntityEvent(this, EntityEvent.TAMING_SUCCEEDED);
@@ -477,7 +_,7 @@
@@ -482,7 +_,7 @@
protected void createInventory() {
SimpleContainer simpleContainer = this.inventory;

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/pig/Pig.java
+++ b/net/minecraft/world/entity/animal/pig/Pig.java
@@ -212,7 +_,14 @@
@@ -178,7 +_,14 @@
ZombifiedPiglin zombifiedPiglin = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, ConversionParams.single(this, false, true), mob -> {
mob.populateDefaultEquipmentSlots(this.getRandom(), level.getCurrentDifficultyAt(this.blockPosition()));
mob.setPersistenceRequired();

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
+++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
@@ -167,12 +_,20 @@
@@ -189,12 +_,20 @@
}
public void startConverting(@Nullable UUID conversionStarter, int villagerConversionTime) {
@ -24,7 +24,7 @@
}
@Override
@@ -197,7 +_,7 @@
@@ -219,7 +_,7 @@
}
private void finishConversion(ServerLevel level) {
@ -33,7 +33,7 @@
EntityType.VILLAGER,
ConversionParams.single(this, false, false),
mob -> {
@@ -223,19 +_,24 @@
@@ -245,19 +_,24 @@
mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CONVERSION, null);
mob.refreshBrain(level);
if (this.conversionStarter != null) {

View File

@ -0,0 +1,24 @@
--- a/net/minecraft/world/item/component/AttackRange.java
+++ b/net/minecraft/world/item/component/AttackRange.java
@@ -25,14 +_,15 @@
import net.minecraft.world.phys.Vec3;
public record AttackRange(float minRange, float maxRange, float minCreativeRange, float maxCreativeRange, float hitboxMargin, float mobFactor) {
+ public static final AttackRange CODEC_DEFAULT = new AttackRange(0.0F, 3.0F, 0.0F, 5.0F, 0.3F, 1.0F); // Paper - add back defaults instance
public static final Codec<AttackRange> CODEC = RecordCodecBuilder.create(
instance -> instance.group(
- ExtraCodecs.floatRange(0.0F, 64.0F).optionalFieldOf("min_reach", 0.0F).forGetter(AttackRange::minRange),
- ExtraCodecs.floatRange(0.0F, 64.0F).optionalFieldOf("max_reach", 3.0F).forGetter(AttackRange::maxRange),
- ExtraCodecs.floatRange(0.0F, 64.0F).optionalFieldOf("min_creative_reach", 0.0F).forGetter(AttackRange::minCreativeRange),
- ExtraCodecs.floatRange(0.0F, 64.0F).optionalFieldOf("max_creative_reach", 5.0F).forGetter(AttackRange::maxCreativeRange),
- ExtraCodecs.floatRange(0.0F, 1.0F).optionalFieldOf("hitbox_margin", 0.3F).forGetter(AttackRange::hitboxMargin),
- Codec.floatRange(0.0F, 2.0F).optionalFieldOf("mob_factor", 1.0F).forGetter(AttackRange::mobFactor)
+ ExtraCodecs.floatRange(0.0F, 64.0F).optionalFieldOf("min_reach", 0.0F).forGetter(AttackRange::minRange), // Paper - diff on change: used in CODEC_DEFAULT above
+ ExtraCodecs.floatRange(0.0F, 64.0F).optionalFieldOf("max_reach", 3.0F).forGetter(AttackRange::maxRange), // Paper - diff on change: used in CODEC_DEFAULT above
+ ExtraCodecs.floatRange(0.0F, 64.0F).optionalFieldOf("min_creative_reach", 0.0F).forGetter(AttackRange::minCreativeRange), // Paper - diff on change: used in CODEC_DEFAULT above
+ ExtraCodecs.floatRange(0.0F, 64.0F).optionalFieldOf("max_creative_reach", 5.0F).forGetter(AttackRange::maxCreativeRange), // Paper - diff on change: used in CODEC_DEFAULT above
+ ExtraCodecs.floatRange(0.0F, 1.0F).optionalFieldOf("hitbox_margin", 0.3F).forGetter(AttackRange::hitboxMargin), // Paper - diff on change: used in CODEC_DEFAULT above
+ Codec.floatRange(0.0F, 2.0F).optionalFieldOf("mob_factor", 1.0F).forGetter(AttackRange::mobFactor) // Paper - diff on change: used in CODEC_DEFAULT above
)
.apply(instance, AttackRange::new)
);

View File

@ -22,6 +22,16 @@ public record PaperAttackRange(
return this.impl.maxRange();
}
@Override
public float minCreativeReach() {
return this.impl.minCreativeRange();
}
@Override
public float maxCreativeReach() {
return this.impl.maxCreativeRange();
}
@Override
public float hitboxMargin() {
return this.impl.hitboxMargin();
@ -34,10 +44,12 @@ public record PaperAttackRange(
static final class BuilderImpl implements AttackRange.Builder {
private float minReach = net.minecraft.world.item.component.AttackRange.DEFAULT.minRange();
private float maxReach = net.minecraft.world.item.component.AttackRange.DEFAULT.maxRange();
private float hitboxMargin = net.minecraft.world.item.component.AttackRange.DEFAULT.hitboxMargin();
private float mobFactor = net.minecraft.world.item.component.AttackRange.DEFAULT.mobFactor();
private float minReach = net.minecraft.world.item.component.AttackRange.CODEC_DEFAULT.minRange();
private float maxReach = net.minecraft.world.item.component.AttackRange.CODEC_DEFAULT.maxRange();
private float minCreativeReach = net.minecraft.world.item.component.AttackRange.CODEC_DEFAULT.minCreativeRange();
private float maxCreativeReach = net.minecraft.world.item.component.AttackRange.CODEC_DEFAULT.maxCreativeRange();
private float hitboxMargin = net.minecraft.world.item.component.AttackRange.CODEC_DEFAULT.hitboxMargin();
private float mobFactor = net.minecraft.world.item.component.AttackRange.CODEC_DEFAULT.mobFactor();
@Override
public AttackRange.Builder minReach(final float minReach) {
@ -53,6 +65,20 @@ public record PaperAttackRange(
return this;
}
@Override
public AttackRange.Builder minCreativeReach(final float minCreativeReach) {
Preconditions.checkArgument(minCreativeReach >= 0.0F && minCreativeReach <= 64.0F, "minCreativeReach must be in range [0,64] was %s", minCreativeReach);
this.minCreativeReach = minCreativeReach;
return this;
}
@Override
public AttackRange.Builder maxCreativeReach(final float maxCreativeReach) {
Preconditions.checkArgument(maxCreativeReach >= 0.0F && maxCreativeReach <= 64.0F, "maxCreativeReach must be in range [0,64] was %s", maxCreativeReach);
this.maxCreativeReach = maxCreativeReach;
return this;
}
@Override
public AttackRange.Builder hitboxMargin(final float hitboxMargin) {
Preconditions.checkArgument(hitboxMargin >= 0.0F && hitboxMargin <= 1.0F, "hitboxMargin must be in range [0,1] was %s", hitboxMargin);
@ -73,6 +99,8 @@ public record PaperAttackRange(
new net.minecraft.world.item.component.AttackRange(
this.minReach,
this.maxReach,
this.minCreativeReach,
this.maxCreativeReach,
this.hitboxMargin,
this.mobFactor
)