Backport some stuff from the generators branch (#10365)

This commit is contained in:
Lulu13022002 2024-04-06 23:51:47 +02:00 committed by GitHub
parent 182e79bce1
commit acf838f535
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 80 additions and 30 deletions

View file

@ -964,6 +964,23 @@ index f101ffde9e7b3f6c3ab6f1cffb8d6f4e720634b2..8abc129f5953807e7a451166dabcf3e1
+ // @Deprecated // Paper - is stable API
void setBackgroundColor(@Nullable Color color);
/**
diff --git a/src/main/java/org/bukkit/entity/memory/MemoryKey.java b/src/main/java/org/bukkit/entity/memory/MemoryKey.java
index 8f601e85df580ef8106eaff8b9eafb5691a4874b..d615c006c9153fb65024241604b744fbfc383efc 100644
--- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java
+++ b/src/main/java/org/bukkit/entity/memory/MemoryKey.java
@@ -69,6 +69,12 @@ public final class MemoryKey<T> implements Keyed {
public static final MemoryKey<Location> LIKED_NOTEBLOCK_POSITION = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock"), Location.class);
public static final MemoryKey<Integer> LIKED_NOTEBLOCK_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock_cooldown_ticks"), Integer.class);
public static final MemoryKey<Integer> ITEM_PICKUP_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("item_pickup_cooldown_ticks"), Integer.class);
+ /**
+ * @deprecated this constant uses the wrong generic type, the sniffer now stores different positions
+ * from possibly different worlds. Use the relevant methods in {@link org.bukkit.entity.Sniffer} directly
+ * for now.
+ */
+ @Deprecated // Paper
public static final MemoryKey<Location> SNIFFER_EXPLORED_POSITIONS = new MemoryKey<>(NamespacedKey.minecraft("sniffer_explored_positions"), Location.class);
/**
diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
index e9a6e5be5f33a342f7e5c496f0f1c64b2f302ace..f0db59a556deaefefbdaca121585c0fd199c13c2 100644

View file

@ -65,3 +65,23 @@ index 3ea21dfad26222ee70fbc627595f54de1a28aa96..cd013a7c42648d819d1e91c7cf9f97a8
+ int getMinimumDistance();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/block/data/type/PinkPetals.java b/src/main/java/org/bukkit/block/data/type/PinkPetals.java
index a84b36f7587eb2ed9e9177973b3166dc94cdf3df..eae9c9cdd0f47a7480ee23ac7b655692f5ee9c1e 100644
--- a/src/main/java/org/bukkit/block/data/type/PinkPetals.java
+++ b/src/main/java/org/bukkit/block/data/type/PinkPetals.java
@@ -21,6 +21,15 @@ public interface PinkPetals extends Directional {
*/
void setFlowerAmount(int flower_amount);
+ // Paper start
+ /**
+ * Gets the minimum allowed value of the 'flower_amount' property.
+ *
+ * @return the minimum 'flower_amount' value
+ */
+ int getMinimumFlowerAmount();
+ // Paper end
+
/**
* Gets the maximum allowed value of the 'flower_amount' property.
*

View file

@ -28,7 +28,7 @@ index 5269df59f0e8099a72c6b628ac1b8c84a0d1a5d5..775fda4b299e1d6dba9b293b2f98505e
public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21"));
}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 9f86ad25a57b3f6e6bda1ce657833837cb3b2292..f9af60356da4668cec8b24e73f5747ab82e35a91 100644
index 9f86ad25a57b3f6e6bda1ce657833837cb3b2292..ec117c47401ea1a04beb0e5ee9d4d394db7c5c4e 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -144,54 +144,67 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@ -233,7 +233,16 @@ index 9f86ad25a57b3f6e6bda1ce657833837cb3b2292..f9af60356da4668cec8b24e73f5747ab
WAXED_OXIDIZED_COPPER_TRAPDOOR(21450, TrapDoor.class),
/**
* BlockData: {@link Gate}
@@ -2628,6 +2665,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -2522,6 +2559,8 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
EGG(21603, 16),
COMPASS(24139),
RECOVERY_COMPASS(12710),
+ @MinecraftExperimental // Paper - add missing annotation
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
BUNDLE(16835, 1),
FISHING_ROD(4167, 1, 64),
CLOCK(14980),
@@ -2628,6 +2667,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
* BlockData: {@link Crafter}
*/
@MinecraftExperimental
@ -241,7 +250,7 @@ index 9f86ad25a57b3f6e6bda1ce657833837cb3b2292..f9af60356da4668cec8b24e73f5747ab
CRAFTER(25243, Crafter.class),
FILLED_MAP(23504),
SHEARS(27971, 1, 238),
@@ -2667,6 +2705,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -2667,6 +2707,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
BEE_SPAWN_EGG(22924),
BLAZE_SPAWN_EGG(4759),
@MinecraftExperimental
@ -249,7 +258,7 @@ index 9f86ad25a57b3f6e6bda1ce657833837cb3b2292..f9af60356da4668cec8b24e73f5747ab
BREEZE_SPAWN_EGG(7580),
CAT_SPAWN_EGG(29583),
CAMEL_SPAWN_EGG(14760),
@@ -3162,88 +3201,106 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -3162,88 +3203,106 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
* BlockData: {@link Waterlogged}
*/
@MinecraftExperimental

View file

@ -15,12 +15,13 @@ Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
diff --git a/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..c8446678e39e777bd2c9992d5c577f4c7606ce15
index 0000000000000000000000000000000000000000..6a96e339ff1466df5743b5d42a31ce6a67e48f16
--- /dev/null
+++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java
@@ -0,0 +1,37 @@
@@ -0,0 +1,38 @@
+package io.papermc.paper.potion;
+
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
@ -31,24 +32,24 @@ index 0000000000000000000000000000000000000000..c8446678e39e777bd2c9992d5c577f4c
+public sealed interface SuspiciousEffectEntry permits SuspiciousEffectEntryImpl {
+
+ /**
+ * Gets the effect type.
+ * Gets the effect type.
+ *
+ * @return type
+ */
+ * @return effect type
+ */
+ @NotNull PotionEffectType effect();
+
+ /**
+ * Gets the duration for this effect instance.
+ *
+ * @return duration (in ticks)
+ */
+ * Gets the duration for this effect instance.
+ *
+ * @return duration (in ticks) or {@link PotionEffect#INFINITE_DURATION}
+ */
+ int duration();
+
+ /**
+ * Creates a new instance of SuspiciousEffectEntry.
+ *
+ * @param effectType effect type
+ * @param duration duration (in ticks)
+ * @param duration duration (in ticks) or {@link PotionEffect#INFINITE_DURATION}
+ * @return new instance of an entry
+ */
+ @Contract(value = "_, _ -> new", pure = true)