patch batch

This commit is contained in:
Noah van der Aa
2025-05-28 15:08:46 +02:00
parent 40c8d4f900
commit 8fee18401c
11 changed files with 162 additions and 254 deletions

View File

@@ -1,61 +0,0 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/item/FireworkRocketItem.java b/net/minecraft/world/item/FireworkRocketItem.java
index 2b1198f45b79261c2e3997b3674a94e61768a644..18d63d2da49451a2d5e1da7bf0c00e05e2f192bc 100644
--- a/net/minecraft/world/item/FireworkRocketItem.java
+++ b/net/minecraft/world/item/FireworkRocketItem.java
@@ -29,7 +29,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
ItemStack itemInHand = context.getItemInHand();
Vec3 clickLocation = context.getClickLocation();
Direction clickedFace = context.getClickedFace();
- Projectile.spawnProjectile(
+ final Projectile.Delayed<FireworkRocketEntity> fireworkRocketEntity = Projectile.spawnProjectileDelayed( // Paper - PlayerLaunchProjectileEvent
new FireworkRocketEntity(
level,
context.getPlayer(),
@@ -39,9 +39,14 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
itemInHand
),
serverLevel,
- itemInHand
+ itemInHand, f -> f.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID() // Paper - firework api - assign spawning entity uuid
);
- itemInHand.shrink(1);
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) context.getPlayer().getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) fireworkRocketEntity.projectile().getBukkitEntity());
+ if (!event.callEvent() || !fireworkRocketEntity.attemptSpawn()) return InteractionResult.PASS;
+ if (event.shouldConsume() && !context.getPlayer().hasInfiniteMaterials()) itemInHand.shrink(1);
+ else context.getPlayer().containerMenu.sendAllDataToRemote();
+ // Paper end - PlayerLaunchProjectileEvent
}
return InteractionResult.SUCCESS;
@@ -52,9 +57,21 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
if (player.isFallFlying()) {
ItemStack itemInHand = player.getItemInHand(hand);
if (level instanceof ServerLevel serverLevel) {
- Projectile.spawnProjectile(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand);
- itemInHand.consume(1, player);
- player.awardStat(Stats.ITEM_USED.get(this));
+ // Paper start - PlayerElytraBoostEvent
+ final Projectile.Delayed<FireworkRocketEntity> delayed = Projectile.spawnProjectileDelayed(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand, f -> f.spawningEntity = player.getUUID()); // Paper - firework api - assign spawning entity uuid
+ com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) delayed.projectile().getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand));
+ if (event.callEvent() && delayed.attemptSpawn()) {
+ player.awardStat(Stats.ITEM_USED.get(this)); // Moved up from below
+ if (event.shouldConsume() && !player.hasInfiniteMaterials()) {
+ itemInHand.shrink(1); // Moved up from below
+ } else {
+ player.containerMenu.sendAllDataToRemote();
+ }
+ } else {
+ player.containerMenu.sendAllDataToRemote();
+ }
+ // Moved up consume and changed consume to shrink
+ // Paper end - PlayerElytraBoostEvent
}
return InteractionResult.SUCCESS;

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/RandomizableContainer.java b/net/minecraft/world/RandomizableContainer.java
index 4cb1c2d6bc64bf65a553a08d1d259e202456b2b3..c97dffd9cf9bdf70f2bb3d94cc5054ad02d038e1 100644
--- a/net/minecraft/world/RandomizableContainer.java
+++ b/net/minecraft/world/RandomizableContainer.java
@@ -26,7 +26,7 @@ public interface RandomizableContainer extends Container {
@@ -27,7 +_,7 @@
void setLootTable(@Nullable ResourceKey<LootTable> lootTable);
@@ -17,25 +9,25 @@ index 4cb1c2d6bc64bf65a553a08d1d259e202456b2b3..c97dffd9cf9bdf70f2bb3d94cc5054ad
this.setLootTable(lootTable);
this.setLootTableSeed(seed);
}
@@ -49,8 +49,9 @@ public interface RandomizableContainer extends Container {
default boolean tryLoadLootTable(CompoundTag tag) {
ResourceKey<LootTable> resourceKey = tag.read("LootTable", LootTable.KEY_CODEC).orElse(null);
@@ -50,8 +_,9 @@
default boolean tryLoadLootTable(ValueInput input) {
ResourceKey<LootTable> resourceKey = input.read("LootTable", LootTable.KEY_CODEC).orElse(null);
this.setLootTable(resourceKey);
+ if (this.lootableData() != null && resourceKey != null) this.lootableData().loadNbt(tag); // Paper - LootTable API
this.setLootTableSeed(tag.getLongOr("LootTableSeed", 0L));
+ if (this.lootableData() != null && resourceKey != null) this.lootableData().loadNbt(input); // Paper - LootTable API
this.setLootTableSeed(input.getLongOr("LootTableSeed", 0L));
- return resourceKey != null;
+ return resourceKey != null && this.lootableData() == null; // Paper - only track the loot table if there is chance for replenish
}
default boolean trySaveLootTable(CompoundTag tag) {
@@ -59,26 +60,42 @@ public interface RandomizableContainer extends Container {
default boolean trySaveLootTable(ValueOutput output) {
@@ -60,26 +_,42 @@
return false;
} else {
tag.store("LootTable", LootTable.KEY_CODEC, lootTable);
+ if (this.lootableData() != null) this.lootableData().saveNbt(tag); // Paper - LootTable API
output.store("LootTable", LootTable.KEY_CODEC, lootTable);
+ if (this.lootableData() != null) this.lootableData().saveNbt(output); // Paper - LootTable API
long lootTableSeed = this.getLootTableSeed();
if (lootTableSeed != 0L) {
tag.putLong("LootTableSeed", lootTableSeed);
output.putLong("LootTableSeed", lootTableSeed);
}
- return true;
@@ -73,7 +65,7 @@ index 4cb1c2d6bc64bf65a553a08d1d259e202456b2b3..c97dffd9cf9bdf70f2bb3d94cc5054ad
LootParams.Builder builder = new LootParams.Builder((ServerLevel)level).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockPos));
if (player != null) {
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player);
@@ -87,4 +104,17 @@ public interface RandomizableContainer extends Container {
@@ -88,4 +_,17 @@
lootTable1.fill(this, builder.create(LootContextParamSets.CHEST), this.getLootTableSeed());
}
}

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
index 2d2a9fcadfc3f1c3817dcb071be346810d0dd982..eaa1745d34323cd684782a7fb2e153851a736471 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -116,6 +116,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -113,6 +_,7 @@
private float dancingAnimationTicks;
private float spinningAnimationTicks;
private float spinningAnimationTicks0;
@@ -16,7 +8,7 @@ index 2d2a9fcadfc3f1c3817dcb071be346810d0dd982..eaa1745d34323cd684782a7fb2e15385
public Allay(EntityType<? extends Allay> entityType, Level level) {
super(entityType, level);
@@ -129,6 +130,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -126,6 +_,12 @@
);
}
@@ -29,7 +21,7 @@ index 2d2a9fcadfc3f1c3817dcb071be346810d0dd982..eaa1745d34323cd684782a7fb2e15385
@Override
protected Brain.Provider<Allay> brainProvider() {
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
@@ -248,7 +255,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -233,7 +_,7 @@
public void aiStep() {
super.aiStep();
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
@@ -38,7 +30,7 @@ index 2d2a9fcadfc3f1c3817dcb071be346810d0dd982..eaa1745d34323cd684782a7fb2e15385
}
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -316,7 +323,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -301,7 +_,12 @@
ItemStack itemInHand = player.getItemInHand(hand);
ItemStack itemInHand1 = this.getItemInHand(InteractionHand.MAIN_HAND);
if (this.isDancing() && itemInHand.is(ItemTags.DUPLICATES_ALLAYS) && this.canDuplicate()) {
@@ -52,7 +44,7 @@ index 2d2a9fcadfc3f1c3817dcb071be346810d0dd982..eaa1745d34323cd684782a7fb2e15385
this.level().broadcastEntityEvent(this, (byte)18);
this.level().playSound(player, this, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.NEUTRAL, 2.0F, 1.0F);
this.removeInteractionItem(player, itemInHand);
@@ -421,6 +433,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -406,6 +_,7 @@
}
private boolean shouldStopDancing() {
@@ -60,16 +52,16 @@ index 2d2a9fcadfc3f1c3817dcb071be346810d0dd982..eaa1745d34323cd684782a7fb2e15385
return this.jukeboxPos == null
|| !this.jukeboxPos.closerToCenterThan(this.position(), GameEvent.JUKEBOX_PLAY.value().notificationRadius())
|| !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
@@ -475,7 +488,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
this.readInventoryFromTag(compound, this.registryAccess());
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.vibrationData = compound.read("listener", VibrationSystem.Data.CODEC, registryOps).orElseGet(VibrationSystem.Data::new);
- this.setDuplicationCooldown(compound.getIntOr("DuplicationCooldown", 0));
+ this.setDuplicationCooldown(compound.getLongOr("DuplicationCooldown", 0)); // Paper - Load as long
@@ -458,7 +_,7 @@
super.readAdditionalSaveData(input);
this.readInventoryFromTag(input);
this.vibrationData = input.read("listener", VibrationSystem.Data.CODEC).orElseGet(VibrationSystem.Data::new);
- this.setDuplicationCooldown(input.getIntOr("DuplicationCooldown", 0));
+ this.setDuplicationCooldown(input.getLongOr("DuplicationCooldown", 0)); // Paper - Load as long
}
@Override
@@ -494,15 +507,17 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -477,15 +_,17 @@
this.entityData.set(DATA_CAN_DUPLICATE, duplicationCooldown == 0L);
}

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index 81a56d7a8939dd3edb03de23a214e6f26275d7e1..d813427cf20117014bc42af0eb7cdee037fbcd9c 100644
--- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -25,6 +25,7 @@ public class EndCrystal extends Entity {
@@ -26,6 +_,7 @@
private static final EntityDataAccessor<Boolean> DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN);
private static final boolean DEFAULT_SHOW_BOTTOM = true;
public int time;
@@ -16,15 +8,17 @@ index 81a56d7a8939dd3edb03de23a214e6f26275d7e1..d813427cf20117014bc42af0eb7cdee0
public EndCrystal(EntityType<? extends EndCrystal> entityType, Level level) {
super(entityType, level);
@@ -56,21 +57,37 @@ public class EndCrystal extends Entity {
@@ -57,21 +_,37 @@
if (this.level() instanceof ServerLevel) {
BlockPos blockPos = this.blockPosition();
if (((ServerLevel)this.level()).getDragonFight() != null && this.level().getBlockState(blockPos).isAir()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockPos, this).isCancelled()) { // Paper
this.level().setBlockAndUpdate(blockPos, BaseFireBlock.getState(this.level(), blockPos));
- }
- }
+ } // Paper
}
}
+ }
+ }
+
+ // Paper start - Fix invulnerable end crystals
+ if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
@@ -40,21 +34,21 @@ index 81a56d7a8939dd3edb03de23a214e6f26275d7e1..d813427cf20117014bc42af0eb7cdee0
}
@Override
protected void addAdditionalSaveData(CompoundTag compound) {
compound.storeNullable("beam_target", BlockPos.CODEC, this.getBeamTarget());
compound.putBoolean("ShowBottom", this.showsBottom());
+ compound.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals
protected void addAdditionalSaveData(ValueOutput output) {
output.storeNullable("beam_target", BlockPos.CODEC, this.getBeamTarget());
output.putBoolean("ShowBottom", this.showsBottom());
+ output.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals
}
@Override
protected void readAdditionalSaveData(CompoundTag compound) {
this.setBeamTarget(compound.read("beam_target", BlockPos.CODEC).orElse(null));
this.setShowBottom(compound.getBooleanOr("ShowBottom", true));
+ this.generatedByDragonFight = compound.getBooleanOr("Paper.GeneratedByDragonFight", false); // Paper - Fix invulnerable end crystals
protected void readAdditionalSaveData(ValueInput input) {
this.setBeamTarget(input.read("beam_target", BlockPos.CODEC).orElse(null));
this.setShowBottom(input.getBooleanOr("ShowBottom", true));
+ this.generatedByDragonFight = input.getBooleanOr("Paper.GeneratedByDragonFight", false); // Paper - Fix invulnerable end crystals
}
@Override
@@ -91,10 +108,24 @@ public class EndCrystal extends Entity {
@@ -92,10 +_,24 @@
return false;
} else {
if (!this.isRemoved()) {

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a531482bc1f3d 100644
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -87,6 +87,10 @@ public class EnderDragon extends Mob implements Enemy {
@@ -88,6 +_,10 @@
private final Node[] nodes = new Node[24];
private final int[] nodeAdjacency = new int[24];
private final BinaryHeap openSet = new BinaryHeap();
@@ -19,7 +11,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
public EnderDragon(EntityType<? extends EnderDragon> entityType, Level level) {
super(EntityType.ENDER_DRAGON, level);
@@ -102,6 +106,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -103,6 +_,7 @@
this.setHealth(this.getMaxHealth());
this.noPhysics = true;
this.phaseManager = new EnderDragonPhaseManager(this);
@@ -27,8 +19,8 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
}
public void setDragonFight(EndDragonFight dragonFight) {
@@ -120,6 +125,19 @@ public class EnderDragon extends Mob implements Enemy {
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 200.0);
@@ -121,6 +_,19 @@
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 200.0).add(Attributes.CAMERA_DISTANCE, 16.0);
}
+ // Paper start - Allow changing the EnderDragon podium
@@ -47,7 +39,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
@Override
public boolean isFlapping() {
float cos = Mth.cos(this.flapTime * (float) (Math.PI * 2));
@@ -211,7 +229,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -212,7 +_,7 @@
}
Vec3 flyTargetLocation = currentPhase.getFlyTargetLocation();
@@ -56,7 +48,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
double d = flyTargetLocation.x - this.getX();
double d1 = flyTargetLocation.y - this.getY();
double d2 = flyTargetLocation.z - this.getZ();
@@ -366,7 +384,12 @@ public class EnderDragon extends Mob implements Enemy {
@@ -367,7 +_,12 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -70,7 +62,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
}
}
@@ -396,7 +419,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -397,7 +_,7 @@
double d2 = entity.getX() - d;
double d3 = entity.getZ() - d1;
double max = Math.max(d2 * d2 + d3 * d3, 0.1);
@@ -79,7 +71,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
if (!this.phaseManager.getCurrentPhase().isSitting() && livingEntity.getLastHurtByMobTimestamp() < entity.tickCount - 2) {
DamageSource damageSource = this.damageSources().mobAttack(this);
entity.hurtServer(level, damageSource, 5.0F);
@@ -429,6 +452,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -430,6 +_,7 @@
int floor5 = Mth.floor(box.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -87,7 +79,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
for (int i = floor; i <= floor3; i++) {
for (int i1 = floor1; i1 <= floor4; i1++) {
@@ -437,7 +461,11 @@ public class EnderDragon extends Mob implements Enemy {
@@ -438,7 +_,11 @@
BlockState blockState = level.getBlockState(blockPos);
if (!blockState.isAir() && !blockState.is(BlockTags.DRAGON_TRANSPARENT)) {
if (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) {
@@ -100,7 +92,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
} else {
flag = true;
}
@@ -446,6 +474,58 @@ public class EnderDragon extends Mob implements Enemy {
@@ -447,6 +_,58 @@
}
}
@@ -159,7 +151,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
if (flag1) {
BlockPos blockPos1 = new BlockPos(
floor + this.random.nextInt(floor3 - floor + 1),
@@ -503,7 +583,15 @@ public class EnderDragon extends Mob implements Enemy {
@@ -504,7 +_,15 @@
@Override
public void kill(ServerLevel level) {
@@ -176,7 +168,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
this.gameEvent(GameEvent.ENTITY_DIE);
if (this.dragonFight != null) {
this.dragonFight.updateDragon(this);
@@ -525,18 +613,41 @@ public class EnderDragon extends Mob implements Enemy {
@@ -526,18 +_,41 @@
this.level().addParticle(ParticleTypes.EXPLOSION_EMITTER, this.getX() + f, this.getY() + 2.0 + f1, this.getZ() + f2, 0.0, 0.0, 0.0);
}
@@ -221,7 +213,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
}
}
@@ -549,15 +660,15 @@ public class EnderDragon extends Mob implements Enemy {
@@ -550,15 +_,15 @@
}
if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel serverLevel1) {
@@ -240,23 +232,23 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
this.gameEvent(GameEvent.ENTITY_DIE);
}
}
@@ -739,6 +850,7 @@ public class EnderDragon extends Mob implements Enemy {
super.addAdditionalSaveData(compound);
compound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
compound.putInt("DragonDeathTime", this.dragonDeathTime);
+ compound.putInt("Bukkit.expToDrop", this.expToDrop); // CraftBukkit - SPIGOT-2420: The ender dragon drops xp over time which can also happen between server starts
@@ -740,6 +_,7 @@
super.addAdditionalSaveData(output);
output.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
output.putInt("DragonDeathTime", this.dragonDeathTime);
+ output.putInt("Bukkit.expToDrop", this.expToDrop); // CraftBukkit - SPIGOT-2420: The ender dragon drops xp over time which can also happen between server starts
}
@Override
@@ -746,6 +858,7 @@ public class EnderDragon extends Mob implements Enemy {
super.readAdditionalSaveData(compound);
compound.getInt("DragonPhase").ifPresent(integer -> this.phaseManager.setPhase(EnderDragonPhase.getById(integer)));
this.dragonDeathTime = compound.getIntOr("DragonDeathTime", 0);
+ this.expToDrop = compound.getIntOr("Bukkit.expToDrop", 0); // CraftBukkit - SPIGOT-2420: The ender dragon drops xp over time which can also happen between server starts
@@ -747,6 +_,7 @@
super.readAdditionalSaveData(input);
input.getInt("DragonPhase").ifPresent(integer -> this.phaseManager.setPhase(EnderDragonPhase.getById(integer)));
this.dragonDeathTime = input.getIntOr("DragonDeathTime", 0);
+ this.expToDrop = input.getIntOr("Bukkit.expToDrop", 0); // CraftBukkit - SPIGOT-2420: The ender dragon drops xp over time which can also happen between server starts
}
@Override
@@ -786,7 +899,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -787,7 +_,7 @@
EnderDragonPhase<? extends DragonPhaseInstance> phase = currentPhase.getPhase();
Vec3 viewVector;
if (phase == EnderDragonPhase.LANDING || phase == EnderDragonPhase.TAKEOFF) {
@@ -265,7 +257,7 @@ index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a5314
float max = Math.max((float)Math.sqrt(heightmapPos.distToCenterSqr(this.position())) / 4.0F, 1.0F);
float f = 6.0F / max;
float xRot = this.getXRot();
@@ -874,4 +987,19 @@ public class EnderDragon extends Mob implements Enemy {
@@ -875,4 +_,19 @@
protected float sanitizeScale(float scale) {
return 1.0F;
}

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
index 059020829324915e15d6240920e61db9688e724e..e200e974e46de6166d56e051806c00a69aefc9bb 100644
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -124,6 +124,12 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@@ -125,6 +_,12 @@
MemoryModuleType.ATE_RECENTLY,
MemoryModuleType.NEAREST_REPELLENT
);
@@ -21,29 +13,29 @@ index 059020829324915e15d6240920e61db9688e724e..e200e974e46de6166d56e051806c00a6
public Piglin(EntityType<? extends AbstractPiglin> entityType, Level level) {
super(entityType, level);
@@ -136,6 +142,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
compound.putBoolean("IsBaby", this.isBaby());
compound.putBoolean("CannotHunt", this.cannotHunt);
this.writeInventoryToTag(compound, this.registryAccess());
@@ -137,6 +_,10 @@
output.putBoolean("IsBaby", this.isBaby());
output.putBoolean("CannotHunt", this.cannotHunt);
this.writeInventoryToTag(output);
+ // CraftBukkit start
+ compound.store("Bukkit.BarterList", ITEM_SET_CODEC, this.allowedBarterItems);
+ compound.store("Bukkit.InterestList", ITEM_SET_CODEC, this.interestItems);
+ output.store("Bukkit.BarterList", ITEM_SET_CODEC, this.allowedBarterItems);
+ output.store("Bukkit.InterestList", ITEM_SET_CODEC, this.interestItems);
+ // CraftBukkit end
}
@Override
@@ -144,6 +154,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
this.setBaby(compound.getBooleanOr("IsBaby", false));
this.setCannotHunt(compound.getBooleanOr("CannotHunt", false));
this.readInventoryFromTag(compound, this.registryAccess());
@@ -145,6 +_,10 @@
this.setBaby(input.getBooleanOr("IsBaby", false));
this.setCannotHunt(input.getBooleanOr("CannotHunt", false));
this.readInventoryFromTag(input);
+ // CraftBukkit start
+ this.allowedBarterItems = compound.read("Bukkit.BarterList", ITEM_SET_CODEC).orElseGet(java.util.HashSet::new);
+ this.interestItems = compound.read("Bukkit.InterestList", ITEM_SET_CODEC).orElseGet(java.util.HashSet::new);
+ this.allowedBarterItems = input.read("Bukkit.BarterList", ITEM_SET_CODEC).orElseGet(java.util.HashSet::new);
+ this.interestItems = input.read("Bukkit.InterestList", ITEM_SET_CODEC).orElseGet(java.util.HashSet::new);
+ // CraftBukkit end
}
@VisibleForDebug
@@ -321,7 +335,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@@ -322,7 +_,9 @@
@Override
protected void finishConversion(ServerLevel serverLevel) {
PiglinAi.cancelAdmiring(serverLevel, this);
@@ -53,7 +45,7 @@ index 059020829324915e15d6240920e61db9688e724e..e200e974e46de6166d56e051806c00a6
super.finishConversion(serverLevel);
}
@@ -397,7 +413,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@@ -398,7 +_,7 @@
}
protected void holdInOffHand(ItemStack stack) {
@@ -62,7 +54,7 @@ index 059020829324915e15d6240920e61db9688e724e..e200e974e46de6166d56e051806c00a6
this.setItemSlot(EquipmentSlot.OFFHAND, stack);
this.setGuaranteedDrop(EquipmentSlot.OFFHAND);
} else {
@@ -422,15 +438,15 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@@ -423,15 +_,15 @@
return false;
} else {
TagKey<Item> preferredWeaponType = this.getPreferredWeaponType();

View File

@@ -0,0 +1,59 @@
--- a/net/minecraft/world/item/FireworkRocketItem.java
+++ b/net/minecraft/world/item/FireworkRocketItem.java
@@ -35,7 +_,7 @@
ItemStack itemInHand = context.getItemInHand();
Vec3 clickLocation = context.getClickLocation();
Direction clickedFace = context.getClickedFace();
- Projectile.spawnProjectile(
+ final Projectile.Delayed<FireworkRocketEntity> fireworkRocketEntity = Projectile.spawnProjectileDelayed( // Paper - PlayerLaunchProjectileEvent
new FireworkRocketEntity(
level,
context.getPlayer(),
@@ -45,9 +_,14 @@
itemInHand
),
serverLevel,
- itemInHand
+ itemInHand, f -> f.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID() // Paper - firework api - assign spawning entity uuid
);
- itemInHand.shrink(1);
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) context.getPlayer().getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) fireworkRocketEntity.projectile().getBukkitEntity());
+ if (!event.callEvent() || !fireworkRocketEntity.attemptSpawn()) return InteractionResult.PASS;
+ if (event.shouldConsume() && !context.getPlayer().hasInfiniteMaterials()) itemInHand.shrink(1);
+ else context.getPlayer().containerMenu.sendAllDataToRemote();
+ // Paper end - PlayerLaunchProjectileEvent
}
return InteractionResult.SUCCESS;
@@ -59,13 +_,24 @@
if (player.isFallFlying()) {
ItemStack itemInHand = player.getItemInHand(hand);
if (level instanceof ServerLevel serverLevel) {
- if (player.dropAllLeashConnections(null)) {
- level.playSound(null, player, SoundEvents.LEAD_BREAK, SoundSource.NEUTRAL, 1.0F, 1.0F);
+ // Paper start - PlayerElytraBoostEvent
+ final Projectile.Delayed<FireworkRocketEntity> delayed = Projectile.spawnProjectileDelayed(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand, f -> f.spawningEntity = player.getUUID()); // Paper - firework api - assign spawning entity uuid
+ com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) delayed.projectile().getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand));
+ if (event.callEvent() && delayed.attemptSpawn()) {
+ player.awardStat(Stats.ITEM_USED.get(this)); // Moved up from below
+ if (player.dropAllLeashConnections(null)) {
+ level.playSound(null, player, SoundEvents.LEAD_BREAK, SoundSource.NEUTRAL, 1.0F, 1.0F);
+ }
+ if (event.shouldConsume() && !player.hasInfiniteMaterials()) {
+ itemInHand.shrink(1); // Moved up from below
+ } else {
+ player.containerMenu.sendAllDataToRemote();
+ }
+ } else {
+ player.containerMenu.sendAllDataToRemote();
}
-
- Projectile.spawnProjectile(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand);
- itemInHand.consume(1, player);
- player.awardStat(Stats.ITEM_USED.get(this));
+ // Moved up consume and changed consume to shrink
+ // Paper end - PlayerElytraBoostEvent
}
return InteractionResult.SUCCESS;

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/item/LeadItem.java b/net/minecraft/world/item/LeadItem.java
index de70db3b8c8f862dabde9be736f3a64955488c14..8c13ae2da3cf2b0979b501be5e3829da44fea45e 100644
--- a/net/minecraft/world/item/LeadItem.java
+++ b/net/minecraft/world/item/LeadItem.java
@@ -28,23 +28,43 @@ public class LeadItem extends Item {
@@ -26,24 +_,43 @@
if (blockState.is(BlockTags.FENCES)) {
Player player = context.getPlayer();
if (!level.isClientSide && player != null) {
@@ -23,7 +15,8 @@ index de70db3b8c8f862dabde9be736f3a64955488c14..8c13ae2da3cf2b0979b501be5e3829da
- public static InteractionResult bindPlayerMobs(Player player, Level level, BlockPos pos) {
+ public static InteractionResult bindPlayerMobs(Player player, Level level, BlockPos pos, net.minecraft.world.InteractionHand interactionHand) { // CraftBukkit - Add InteractionHand
LeashFenceKnotEntity leashFenceKnotEntity = null;
List<Leashable> list = leashableInArea(level, pos, leashable1 -> leashable1.getLeashHolder() == player);
List<Leashable> list = Leashable.leashableInArea(level, Vec3.atCenterOf(pos), leashable1 -> leashable1.getLeashHolder() == player);
boolean flag = false;
- for (Leashable leashable : list) {
+ for (java.util.Iterator<Leashable> iterator = list.iterator(); iterator.hasNext();) { // Paper - use iterator to remove
@@ -44,18 +37,17 @@ index de70db3b8c8f862dabde9be736f3a64955488c14..8c13ae2da3cf2b0979b501be5e3829da
}
+ // CraftBukkit start
+ if (leashable instanceof Entity leashed) {
+ if (leashable instanceof net.minecraft.world.entity.Entity leashed) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLeashEntityEvent(leashed, leashFenceKnotEntity, player, interactionHand).isCancelled()) {
+ iterator.remove();
+ continue;
+ }
+ }
+ // CraftBukkit end
+
leashable.setLeashedTo(leashFenceKnotEntity, true);
}
@@ -52,10 +72,21 @@ public class LeadItem extends Item {
if (leashable.canHaveALeashAttachedTo(leashFenceKnotEntity)) {
leashable.setLeashedTo(leashFenceKnotEntity, true);
flag = true;
@@ -54,7 +_,18 @@
level.gameEvent(GameEvent.BLOCK_ATTACH, pos, GameEvent.Context.of(player));
return InteractionResult.SUCCESS_SERVER;
} else {
@@ -67,13 +59,10 @@ index de70db3b8c8f862dabde9be736f3a64955488c14..8c13ae2da3cf2b0979b501be5e3829da
return InteractionResult.PASS;
}
}
+
+ // CraftBukkit start
+ public static InteractionResult bindPlayerMobs(Player player, Level world, BlockPos pos) {
+ return LeadItem.bindPlayerMobs(player, world, pos, net.minecraft.world.InteractionHand.MAIN_HAND);
+ }
+ // CraftBukkit end
+
public static List<Leashable> leashableInArea(Level level, BlockPos pos, Predicate<Leashable> predicate) {
double d = 7.0;
int x = pos.getX();
}

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java
index 84c4322168fda64109d421e2daf6e80c39f8876d..b857e811b4b7a25eaec6dceaae5528d2ec0a1c45 100644
--- a/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/net/minecraft/world/item/crafting/RecipeManager.java
@@ -87,7 +87,26 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
@@ -87,7 +_,26 @@
LOGGER.info("Loaded {} recipes", object.values().size());
}
@@ -35,7 +27,7 @@ index 84c4322168fda64109d421e2daf6e80c39f8876d..b857e811b4b7a25eaec6dceaae5528d2
List<SelectableRecipe.SingleInputEntry<StonecutterRecipe>> list = new ArrayList<>();
List<RecipeManager.IngredientCollector> list1 = RECIPE_PROPERTY_SETS.entrySet()
.stream()
@@ -147,7 +166,10 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
@@ -147,7 +_,10 @@
}
public <I extends RecipeInput, T extends Recipe<I>> Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> recipeType, I input, Level level) {
@@ -47,18 +39,11 @@ index 84c4322168fda64109d421e2daf6e80c39f8876d..b857e811b4b7a25eaec6dceaae5528d2
}
public Optional<RecipeHolder<?>> byKey(ResourceKey<Recipe<?>> key) {
@@ -184,6 +206,7 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
@Nullable
public RecipeManager.ServerDisplayInfo getRecipeFromDisplay(RecipeDisplayId display) {
+ if (display.index() < 0 || display.index() >= this.allDisplays.size()) return null; // Paper
return this.allDisplays.get(display.index());
}
@@ -200,6 +223,22 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
@@ -200,6 +_,22 @@
Recipe<?> recipe1 = Recipe.CODEC.parse(registries.createSerializationContext(JsonOps.INSTANCE), json).getOrThrow(JsonParseException::new);
return new RecipeHolder<>(recipe, recipe1);
}
+
+ // CraftBukkit start
+ public boolean removeRecipe(ResourceKey<Recipe<?>> mcKey) {
+ boolean removed = this.recipes.removeRecipe((ResourceKey<Recipe<RecipeInput>>) (ResourceKey) mcKey); // Paper - generic fix
@@ -74,7 +59,6 @@ index 84c4322168fda64109d421e2daf6e80c39f8876d..b857e811b4b7a25eaec6dceaae5528d2
+ this.finalizeRecipeLoading();
+ }
+ // CraftBukkit end
+
public static <I extends RecipeInput, T extends Recipe<I>> RecipeManager.CachedCheck<I, T> createCheck(final RecipeType<T> recipeType) {
return new RecipeManager.CachedCheck<I, T>() {
@Nullable

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/portal/TeleportTransition.java b/net/minecraft/world/level/portal/TeleportTransition.java
index d86dfd1b12d9b0fb816834934108ceba2da8e951..de028b984d737bf8ca2f235887c8cd053cd44241 100644
--- a/net/minecraft/world/level/portal/TeleportTransition.java
+++ b/net/minecraft/world/level/portal/TeleportTransition.java
@@ -19,15 +19,34 @@ public record TeleportTransition(
@@ -19,15 +_,34 @@
boolean asPassenger,
Set<Relative> relatives,
TeleportTransition.PostTeleportTransition postTeleportTransition
@@ -44,7 +36,7 @@ index d86dfd1b12d9b0fb816834934108ceba2da8e951..de028b984d737bf8ca2f235887c8cd05
}
public TeleportTransition(
@@ -39,11 +58,30 @@ public record TeleportTransition(
@@ -39,11 +_,30 @@
Set<Relative> relatives,
TeleportTransition.PostTeleportTransition postTeleportTransition
) {
@@ -67,22 +59,13 @@ index d86dfd1b12d9b0fb816834934108ceba2da8e951..de028b984d737bf8ca2f235887c8cd05
}
public TeleportTransition(ServerLevel level, Entity entity, TeleportTransition.PostTeleportTransition postTeleportTransition) {
- this(level, findAdjustedSharedSpawnPos(level, entity), Vec3.ZERO, 0.0F, 0.0F, false, false, Set.of(), postTeleportTransition);
- this(level, findAdjustedSharedSpawnPos(level, entity), Vec3.ZERO, level.getSharedSpawnAngle(), 0.0F, false, false, Set.of(), postTeleportTransition);
+ // CraftBukkit start
+ this(level, entity, postTeleportTransition, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.UNKNOWN);
+ }
+ public TeleportTransition(ServerLevel level, Entity entity, TeleportTransition.PostTeleportTransition postTeleportTransition, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) {
+ this(level, findAdjustedSharedSpawnPos(level, entity), Vec3.ZERO, level.getSharedSpawnAngle(), 0.0F, false, false, Set.of(), postTeleportTransition, cause); // Paper - MC-200092 - fix first spawn pos yaw being ignored
+ this(level, findAdjustedSharedSpawnPos(level, entity), Vec3.ZERO, level.getSharedSpawnAngle(), 0.0F, false, false, Set.of(), postTeleportTransition, cause);
+ // CraftBukkit end
}
private static void playPortalSound(Entity entity) {
@@ -57,7 +95,7 @@ public record TeleportTransition(
}
public static TeleportTransition missingRespawnBlock(ServerLevel level, Entity entity, TeleportTransition.PostTeleportTransition postTeleportTransition) {
- return new TeleportTransition(level, findAdjustedSharedSpawnPos(level, entity), Vec3.ZERO, 0.0F, 0.0F, true, false, Set.of(), postTeleportTransition);
+ return new TeleportTransition(level, findAdjustedSharedSpawnPos(level, entity), Vec3.ZERO, level.getSharedSpawnAngle(), 0.0F, true, false, Set.of(), postTeleportTransition); // Paper - MC-200092 - fix spawn pos yaw being ignored
}
private static Vec3 findAdjustedSharedSpawnPos(ServerLevel level, Entity entity) {

View File

@@ -1,24 +1,16 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/storage/loot/LootDataType.java b/net/minecraft/world/level/storage/loot/LootDataType.java
index 066354a668f8b4741db9290662d9639b18552ea3..51a1a82f6ce68c56c7437fae40172e65cb517d0d 100644
--- a/net/minecraft/world/level/storage/loot/LootDataType.java
+++ b/net/minecraft/world/level/storage/loot/LootDataType.java
@@ -31,9 +31,14 @@ public record LootDataType<T>(ResourceKey<Registry<T>> registryKey, Codec<T> cod
@@ -32,9 +_,14 @@
}
private static LootDataType.Validator<LootTable> createLootTableValidator() {
- return (context, key, value) -> value.validate(
- context.setContextKeySet(value.getParamSet()).enterElement("{" + key.registry() + "/" + key.location() + "}", key)
- context.setContextKeySet(value.getParamSet()).enterElement(new ProblemReporter.RootElementPathElement(key), key)
- );
+ // CraftBukkit start
+ return (context, key, value) -> {
+ value.validate(
+ context.setContextKeySet(value.getParamSet()).enterElement("{" + key.registry() + "/" + key.location() + "}", key)
+ context.setContextKeySet(value.getParamSet()).enterElement(new ProblemReporter.RootElementPathElement(key), key)
+ );
+ value.craftLootTable = new org.bukkit.craftbukkit.CraftLootTable(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location()), value);
+ // CraftBukkit end