Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API
48c0c547 PR-786: Add methods to get sounds from entities

CraftBukkit Changes:
5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event
4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation
4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API
e5d6a9bbf PR-1100: Add methods to get sounds from entities
b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta

Spigot Changes:
4c157bb4 Rebuild patches
This commit is contained in:
Nassim Jahnke 2022-09-12 13:31:45 +02:00
parent d1129b0ded
commit 39ae9b75e9
16 changed files with 75 additions and 79 deletions

View file

@ -20,9 +20,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public java.util.UUID getSpawningEntity();
+ /**
+ * If this firework is boosting an entity, return it
+ * @deprecated use {@link #getAttachedTo()}
+ * @see #setAttachedTo(LivingEntity)
+ * @return The entity being boosted
+ */
+ @org.jetbrains.annotations.Nullable
+ public LivingEntity getBoostedEntity();
+ @Deprecated
+ default LivingEntity getBoostedEntity() {
+ return getAttachedTo();
+ }
+ // Paper end
}

View file

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/Mob.java
+++ b/src/main/java/org/bukkit/entity/Mob.java
@@ -0,0 +0,0 @@ public interface Mob extends LivingEntity, Lootable {
* @return whether the mob is aware
*/
public boolean isAware();
@Nullable
public Sound getAmbientSound();
+
+ // Paper start
+ /**

View file

@ -424,9 +424,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/Raider.java
+++ b/src/main/java/org/bukkit/entity/Raider.java
@@ -0,0 +0,0 @@ public interface Raider extends Monster {
* @param join CanJoinRaid status
*/
void setCanJoinRaid(boolean join);
@NotNull
Sound getCelebrationSound();
+
+ // Paper start
+ /**

View file

@ -233,9 +233,9 @@ diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Mob.java
+++ b/src/main/java/org/bukkit/entity/Mob.java
@@ -0,0 +0,0 @@
package org.bukkit.entity;
@@ -0,0 +0,0 @@ package org.bukkit.entity;
import org.bukkit.Sound;
import org.bukkit.loot.Lootable;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View file

@ -19,8 +19,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @param meta The FireworkMeta to apply
*/
@@ -0,0 +0,0 @@ public interface Firework extends Projectile {
@org.jetbrains.annotations.Nullable
public LivingEntity getBoostedEntity();
* {@link #getMaxLife()}, the firework will detonate.
*
* @param ticks the ticks to set. Must be greater than or equal to 0
+ * @deprecated use {@link #setTicksFlown(int)}
* @return true if the life was set, false if this firework has already detonated
*/
+ @Deprecated(forRemoval = true) // Paper
boolean setLife(int ticks);
/**
* Get the ticks that this firework has been alive. When this value reaches
* {@link #getMaxLife()}, the firework will detonate.
*
+ * @deprecated use {@link #getTicksFlown()}
* @return the life ticks
*/
+ @Deprecated(forRemoval = true) // Paper
int getLife();
/**
* Set the time in ticks this firework will exist until it is detonated.
*
* @param ticks the ticks to set. Must be greater than 0
+ * @deprecated use {@link #setTicksToDetonate(int)}
* @return true if the time was set, false if this firework has already detonated
*/
+ @Deprecated(forRemoval = true) // Paper
boolean setMaxLife(int ticks);
/**
* Get the time in ticks this firework will exist until it is detonated.
*
+ * @deprecated use {@link #getTicksToDetonate()}
* @return the maximum life in ticks
*/
+ @Deprecated(forRemoval = true) // Paper
int getMaxLife();
/**
@@ -0,0 +0,0 @@ public interface Firework extends Projectile {
return getAttachedTo();
}
// Paper end
+
+ // Paper start - Firework API

View file

@ -16,8 +16,8 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
@@ -0,0 +0,0 @@ import org.bukkit.configuration.serialization.DelegateDeserialization;
import org.bukkit.craftbukkit.inventory.CraftMetaItem.ItemMetaKey;
@@ -0,0 +0,0 @@ import org.bukkit.Material;
import org.bukkit.configuration.serialization.DelegateDeserialization;
@DelegateDeserialization(CraftMetaItem.SerializableMeta.class)
-public class CraftMetaArmorStand extends CraftMetaItem {

View file

@ -42,16 +42,16 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
@@ -0,0 +0,0 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
case ZOMBIE_SPAWN_EGG:
case ZOMBIE_VILLAGER_SPAWN_EGG:
case ZOMBIFIED_PIGLIN_SPAWN_EGG:
@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData;
public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
private static final Set<Material> SPAWN_EGG_MATERIALS = Sets.newHashSet(
+ // Paper start
+ case ALLAY_SPAWN_EGG:
+ case FROG_SPAWN_EGG:
+ case TADPOLE_SPAWN_EGG:
+ case WARDEN_SPAWN_EGG:
+ Material. ALLAY_SPAWN_EGG,
+ Material. FROG_SPAWN_EGG,
+ Material. TADPOLE_SPAWN_EGG,
+ Material. WARDEN_SPAWN_EGG,
+ // Paper end
return true;
default:
return false;
Material.AXOLOTL_SPAWN_EGG,
Material.BAT_SPAWN_EGG,
Material.BEE_SPAWN_EGG,

View file

@ -3848,18 +3848,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.inventory.meta.BookMeta.Generation;
+import org.checkerframework.checker.nullness.qual.NonNull;
// Spigot start
import static org.spigotmc.ValidateUtils.*;
+
import java.util.AbstractList;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.chat.ComponentSerializer;
@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
this.generation = (generation == null) ? null : generation.ordinal();
}

View file

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
public int lifetime;
@Nullable
public LivingEntity attachedToEntity;
public LivingEntity attachedToEntity; // PAIL private -> public
+ public java.util.UUID spawningEntity; // Paper
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) {
@ -87,11 +87,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public java.util.UUID getSpawningEntity() {
+ return getHandle().spawningEntity;
+ }
+
+ @Override
+ public org.bukkit.entity.LivingEntity getBoostedEntity() {
+ net.minecraft.world.entity.LivingEntity boostedEntity = getHandle().attachedToEntity;
+ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null;
+ }
+ // Paper end
}

View file

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lukasz Derlatka <toranktto@gmail.com>
Date: Mon, 11 Nov 2019 16:08:13 +0100
Subject: [PATCH] Fix AssertionError when player hand set to empty type
Fixes an AssertionError when setting the player's item in hand to null or a new ItemStack of Air in PlayerInteractEvent
Fixes GH-2718
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
return;
}
+ // Paper start
+ itemstack = this.player.getItemInHand(enumhand);
+ if (itemstack.isEmpty()) return;
+ // Paper end
InteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.shouldSwing()) {

View file

@ -8,14 +8,6 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -0,0 +0,0 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
+import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffect;
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().lastHurtByPlayer == null ? null : (Player) this.getHandle().lastHurtByPlayer.getBukkitEntity();
}
@ -23,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public void setKiller(Player killer) {
+ ServerPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
+ net.minecraft.server.level.ServerPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
+ getHandle().lastHurtByPlayer = entityPlayer;
+ getHandle().lastHurtByMob = entityPlayer;
+ getHandle().lastHurtByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity

View file

@ -451,8 +451,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
@@ -0,0 +0,0 @@ public abstract class CraftRaider extends CraftMonster implements Raider {
public void setCanJoinRaid(boolean join) {
this.getHandle().setCanJoinRaid(join);
public Sound getCelebrationSound() {
return CraftSound.getBukkit(this.getHandle().getCelebrateSound());
}
+
+ // Paper start

View file

@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Copied from EntityFireworks constructor, update firework lifetime/power
this.getHandle().lifetime = 10 * (1 + meta.getPower()) + this.random.nextInt(6) + this.random.nextInt(7);
@@ -0,0 +0,0 @@ public class CraftFirework extends CraftProjectile implements Firework {
return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null;
return getHandle().spawningEntity;
}
// Paper end
+ // Paper start - Expose firework item directly + manually setting flight

@ -1 +1 @@
Subproject commit 2683d766020628844637e800d4ec12fd19cc674a
Subproject commit 9ae3f10f8fa50a825af823131c468c36da3be880

@ -1 +1 @@
Subproject commit 5901d580a4902919b10fc23a07d40eda50497634
Subproject commit 5cc9c022a0bd297f348d3c7e24e06227dca40c23

@ -1 +1 @@
Subproject commit e53686f7e0406156c8fa91a6e7748fbfed19c3a4
Subproject commit 4c157bb49aa5705967b066e9c2dec5520f720b22