Backport some stuff from the generators branch (#10365)

This commit is contained in:
Lulu13022002 2024-04-06 23:51:47 +02:00
parent 613a19f70d
commit d06c0b4571
7 changed files with 74 additions and 24 deletions

View file

@ -232,6 +232,7 @@ public class MobGoalNames {
bukkitMap.put(net.minecraft.world.entity.monster.warden.Warden.class, org.bukkit.entity.Warden.class);
bukkitMap.put(net.minecraft.world.entity.animal.allay.Allay.class, org.bukkit.entity.Allay.class);
bukkitMap.put(net.minecraft.world.entity.animal.sniffer.Sniffer.class, org.bukkit.entity.Sniffer.class);
bukkitMap.put(net.minecraft.world.entity.monster.breeze.Breeze.class, org.bukkit.entity.Breeze.class);
//</editor-fold>
}

View file

@ -65,3 +65,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/block/data/type/PinkPetals.java
+++ b/src/main/java/org/bukkit/block/data/type/PinkPetals.java
@@ -0,0 +0,0 @@ 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

@ -964,6 +964,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java
+++ b/src/main/java/org/bukkit/entity/memory/MemoryKey.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -21,6 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+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;
@ -33,14 +34,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Gets the effect type.
+ *
+ * @return type
+ * @return effect type
+ */
+ @NotNull PotionEffectType effect();
+
+ /**
+ * Gets the duration for this effect instance.
+ *
+ * @return duration (in ticks)
+ * @return duration (in ticks) or {@link PotionEffect#INFINITE_DURATION}
+ */
+ int duration();
+
@ -48,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * 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)

View file

@ -233,6 +233,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
WAXED_OXIDIZED_COPPER_TRAPDOOR(21450, TrapDoor.class),
/**
* BlockData: {@link Gate}
@@ -0,0 +0,0 @@ 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),
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
* BlockData: {@link Crafter}
*/

View file

@ -150,3 +150,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPinkPetals.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPinkPetals.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPinkPetals.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPinkPetals.java
@@ -0,0 +0,0 @@ public final class CraftPinkPetals extends org.bukkit.craftbukkit.block.data.Cra
this.set(CraftPinkPetals.FLOWER_AMOUNT, flower_amount);
}
+ // Paper start
+ @Override
+ public int getMinimumFlowerAmount() {
+ return getMin(CraftPinkPetals.FLOWER_AMOUNT);
+ }
+ // Paper end
+
@Override
public int getMaximumFlowerAmount() {
return getMax(CraftPinkPetals.FLOWER_AMOUNT);

View file

@ -4,22 +4,6 @@ Date: Wed, 12 Oct 2022 00:36:55 +0300
Subject: [PATCH] Allow changing bed's 'occupied' property
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java
@@ -0,0 +0,0 @@ public abstract class CraftBed extends CraftBlockData implements Bed {
public boolean isOccupied() {
return this.get(CraftBed.OCCUPIED);
}
+
+ // Paper start
+ @Override
+ public void setOccupied(boolean occupied) {
+ set(CraftBed.OCCUPIED, occupied);
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBed.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBed.java