mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 19:40:37 +01:00
Updated Upstream (Bukkit/CraftBukkit) (#11543)
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: 97c59261 PR-1073: Make Biome an interface a38581aa Fix further javadoc errors 8271c490 Fix javadoc error 8a9ecf29 PR-1072: Fix bad naming for Vault State methods 6dd58108 PR-1071: Make Fluid an interface and add missing entry ed2cdfc3 PR-1070: Make Attribute an interface and align names with the new minecraft ones 63472efb PR-1069: Add missing winter drop experimental annotation to pale boats CraftBukkit Changes: 7235ad7b0 PR-1501: Make Biome an interface 602904003 PR-1500: Rename implementation for Vault State methods 75f26f79f PR-1499: Make Fluid an interface and add missing entry 4cfd87adc PR-1498: Make Attribute an interface and align names with the new minecraft ones 6bb0db5cb SPIGOT-7928: ExactChoice acts as MaterialChoice 3eaf3a13c SPIGOT-7929: Error when setting EquippableComponent abbf57bac SPIGOT-7930: Fix spawning entities with SummonEntityEffect 92d6ab6cf PR-1497: Move boat field rename entries to below key renaming, so that keys are also renamed abfe292aa PR-1496: Use correct Fluid class on Tags type check c7aab7fa7 SPIGOT-7923: Fix Dispenser logic to avoid firing empty projectiles
This commit is contained in:
parent
5af7b3afbb
commit
29b207245f
25 changed files with 116 additions and 136 deletions
patches
api
Add-FeatureFlag-API.patchAdd-NamespacedKey-biome-methods.patchAdd-RegistryAccess-for-managing-registries.patchAdd-methods-to-get-translation-keys.patchAdd-missing-Fluid-type.patchFix-custom-statistic-criteria-creation.patchFix-upstream-javadocs.patchImprove-death-events.patchPaper-Plugins.patch
server
Add-FeatureFlag-API.patchAdd-NamespacedKey-biome-methods.patchAdd-RegistryAccess-for-managing-Registries.patchAdd-methods-to-get-translation-keys.patchAdd-registry-entry-and-builders.patchCB-fixes.patchCache-resource-keys-and-optimize-reference-Holder-ta.patchExpose-server-build-information.patchFix-custom-statistic-criteria-creation.patchFixup-NamespacedKey-handling.patchGeneral-ItemMeta-fixes.patchGet-entity-default-attributes.patchImprove-death-events.patchProperly-track-the-changed-item-from-dispense-events.patch
work
|
@ -251,7 +251,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||
|
||||
@Deprecated(since = "1.21.3", forRemoval = true)
|
||||
String getTranslationKey(Attribute attribute);
|
||||
|
||||
- @Nullable
|
||||
|
|
|
@ -22,9 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @param x X-coordinate of the block
|
||||
+ * @param y Y-coordinate of the block
|
||||
+ * @param z Z-coordinate of the block
|
||||
+ * @deprecated custom biomes are properly supported in API now
|
||||
+ * @return the biome's {@link NamespacedKey}
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ @Deprecated(since = "1.21.3", forRemoval = true)
|
||||
+ NamespacedKey getBiomeKey(RegionAccessor accessor, int x, int y, int z);
|
||||
+
|
||||
+ /**
|
||||
|
@ -38,8 +40,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @param y Y-coordinate of the block
|
||||
+ * @param z Z-coordinate of the block
|
||||
+ * @param biomeKey Biome key
|
||||
+ * @deprecated custom biomes are properly supported in API now
|
||||
+ * @throws IllegalStateException if no biome by the given key is registered.
|
||||
+ */
|
||||
+ @Deprecated(since = "1.21.3", forRemoval = true)
|
||||
+ void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
||||
+ // Paper end - namespaced key biome methods
|
||||
}
|
||||
|
|
|
@ -211,6 +211,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/Registry.java
|
||||
+++ b/src/main/java/org/bukkit/Registry.java
|
||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
* Attribute.
|
||||
*
|
||||
* @see Attribute
|
||||
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#ATTRIBUTE}
|
||||
*/
|
||||
- Registry<Attribute> ATTRIBUTE = Objects.requireNonNull(Bukkit.getRegistry(Attribute.class), "No registry present for Attribute. This is a bug.");
|
||||
+ @Deprecated(since = "1.21.3") // Paper
|
||||
+ Registry<Attribute> ATTRIBUTE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Attribute.class), "No registry present for Attribute. This is a bug.");
|
||||
/**
|
||||
* Server banner patterns.
|
||||
*
|
||||
* @see PatternType
|
||||
|
@ -222,6 +231,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
/**
|
||||
* Server biomes.
|
||||
*
|
||||
* @see Biome
|
||||
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#BIOME}
|
||||
*/
|
||||
- Registry<Biome> BIOME = Objects.requireNonNull(Bukkit.getRegistry(Biome.class), "No registry present for Biome. This is a bug.");
|
||||
+ @Deprecated(since = "1.21.3") // Paper
|
||||
+ Registry<Biome> BIOME = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Biome.class), "No registry present for Biome. This is a bug.");
|
||||
/**
|
||||
* Server block types.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
* @apiNote BlockType is not ready for public usage yet
|
||||
*/
|
||||
|
@ -358,6 +376,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
* Memory Keys.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
* Server fluids.
|
||||
*
|
||||
* @see Fluid
|
||||
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#FLUID}
|
||||
*/
|
||||
- Registry<Fluid> FLUID = Objects.requireNonNull(Bukkit.getRegistry(Fluid.class), "No registry present for Fluid. This is a bug.");
|
||||
+ @Deprecated(since = "1.21.3")
|
||||
+ Registry<Fluid> FLUID = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Fluid.class), "No registry present for Fluid. This is a bug.");
|
||||
/**
|
||||
* Frog variants.
|
||||
*
|
||||
* @see Frog.Variant
|
||||
*/
|
||||
|
|
|
@ -242,46 +242,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
/**
|
||||
* Types of attributes which may be present on an {@link Attributable}.
|
||||
*/
|
||||
-public enum Attribute implements Keyed, Translatable {
|
||||
+public enum Attribute implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||
-public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable {
|
||||
+public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||
|
||||
/**
|
||||
* Maximum health of an Entity.
|
||||
@@ -0,0 +0,0 @@ public enum Attribute implements Keyed, Translatable {
|
||||
public String getTranslationKey() {
|
||||
return Bukkit.getUnsafe().getTranslationKey(this);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ @Override
|
||||
+ public @NotNull String translationKey() {
|
||||
+ return Bukkit.getUnsafe().getTranslationKey(this);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/Biome.java
|
||||
+++ b/src/main/java/org/bukkit/block/Biome.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Holds all accepted Biomes in the default server
|
||||
* There may be additional biomes present in the server, for example from a {@link DataPack}
|
||||
* which can be accessed via {@link Registry#BIOME}.
|
||||
*/
|
||||
-public enum Biome implements Keyed {
|
||||
+public enum Biome implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
|
||||
OCEAN,
|
||||
PLAINS,
|
||||
DESERT,
|
||||
@@ -0,0 +0,0 @@ public enum Biome implements Keyed {
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
-public interface Biome extends OldEnum<Biome>, Keyed {
|
||||
+public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||
|
||||
Biome OCEAN = getBiome("ocean");
|
||||
Biome PLAINS = getBiome("plains");
|
||||
@@ -0,0 +0,0 @@ public interface Biome extends OldEnum<Biome>, Keyed {
|
||||
static Biome[] values() {
|
||||
return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public @NotNull String translationKey() {
|
||||
+ return "biome.minecraft." + this.key.getKey();
|
||||
+ default @NotNull String translationKey() {
|
||||
+ return "biome.minecraft." + this.getKey().getKey();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 4 Dec 2022 10:07:16 -0800
|
||||
Subject: [PATCH] Add missing Fluid type
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Fluid.java
|
||||
+++ b/src/main/java/org/bukkit/Fluid.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public enum Fluid implements Keyed {
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * No fluid.
|
||||
+ */
|
||||
+ EMPTY,
|
||||
+ // Paper end
|
||||
/**
|
||||
* Stationary water.
|
||||
*/
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||
*/
|
||||
@Deprecated(since = "1.21.3", forRemoval = true)
|
||||
void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
||||
// Paper end - namespaced key biome methods
|
||||
+
|
||||
|
|
|
@ -600,9 +600,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * Setting the size of the slime (regardless of previous size)
|
||||
+ * will set the following attributes:
|
||||
+ * <ul>
|
||||
+ * <li>{@link org.bukkit.attribute.Attribute#GENERIC_MAX_HEALTH}</li>
|
||||
+ * <li>{@link org.bukkit.attribute.Attribute#GENERIC_MOVEMENT_SPEED}</li>
|
||||
+ * <li>{@link org.bukkit.attribute.Attribute#GENERIC_ATTACK_DAMAGE}</li>
|
||||
+ * <li>{@link org.bukkit.attribute.Attribute#MAX_HEALTH}</li>
|
||||
+ * <li>{@link org.bukkit.attribute.Attribute#MOVEMENT_SPEED}</li>
|
||||
+ * <li>{@link org.bukkit.attribute.Attribute#ATTACK_DAMAGE}</li>
|
||||
+ * </ul>
|
||||
+ * to their per-size defaults and heal the
|
||||
+ * slime to its max health (assuming it's alive).
|
||||
|
|
|
@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @throws IllegalArgumentException Thrown if the health is {@literal <= 0 or >} max health
|
||||
+ */
|
||||
+ public void setReviveHealth(double reviveHealth) throws IllegalArgumentException {
|
||||
+ double maxHealth = ((LivingEntity) entity).getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue();
|
||||
+ double maxHealth = ((LivingEntity) entity).getAttribute(org.bukkit.attribute.Attribute.MAX_HEALTH).getValue();
|
||||
+ if ((maxHealth != 0 && reviveHealth <= 0) || (reviveHealth > maxHealth)) {
|
||||
+ throw new IllegalArgumentException("Health must be between 0 (exclusive) and " + maxHealth + " (inclusive), but was " + reviveHealth);
|
||||
+ }
|
||||
|
|
|
@ -1331,7 +1331,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||
|
||||
@ApiStatus.Internal
|
||||
<B extends Keyed> B get(Registry<B> registry, NamespacedKey key);
|
||||
Biome getCustomBiome();
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Deprecated(forRemoval = true)
|
||||
|
|
|
@ -287,17 +287,17 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.advancement.Advancement;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
-import org.bukkit.craftbukkit.CraftFeatureFlag;
|
||||
+// import org.bukkit.craftbukkit.CraftFeatureFlag; // Paper
|
||||
import org.bukkit.craftbukkit.CraftRegistry;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.attribute.CraftAttribute;
|
||||
import org.bukkit.craftbukkit.block.CraftBiome;
|
||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return CraftAttribute.bukkitToMinecraft(attribute).getDescriptionId();
|
||||
return attribute.getTranslationKey();
|
||||
}
|
||||
|
||||
- @Override
|
||||
|
|
|
@ -16,15 +16,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) {
|
||||
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
|
||||
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value()));
|
||||
+ return accessor.getBiome(x, y, z).getKey();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) {
|
||||
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
|
||||
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
||||
+ cra.setBiome(x, y, z, biomeBase);
|
||||
+ accessor.setBiome(x, y, z, org.bukkit.Registry.BIOME.getOrThrow(biomeKey));
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
|
|
|
@ -28,15 +28,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import org.bukkit.Fluid;
|
||||
+import org.bukkit.GameEvent;
|
||||
+import org.bukkit.JukeboxSong;
|
||||
+import org.bukkit.Keyed;
|
||||
+import org.bukkit.MusicInstrument;
|
||||
+import org.bukkit.attribute.Attribute;
|
||||
+import org.bukkit.block.Biome;
|
||||
+import org.bukkit.block.BlockType;
|
||||
+import org.bukkit.block.banner.PatternType;
|
||||
+import org.bukkit.craftbukkit.CraftFluid;
|
||||
+import org.bukkit.craftbukkit.CraftGameEvent;
|
||||
+import org.bukkit.craftbukkit.CraftJukeboxSong;
|
||||
+import org.bukkit.craftbukkit.CraftMusicInstrument;
|
||||
+import org.bukkit.craftbukkit.attribute.CraftAttribute;
|
||||
+import org.bukkit.craftbukkit.block.CraftBiome;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlockType;
|
||||
+import org.bukkit.craftbukkit.block.banner.CraftPatternType;
|
||||
+import org.bukkit.craftbukkit.damage.CraftDamageType;
|
||||
|
@ -98,6 +104,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ entry(Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, Villager.Type.class, CraftVillager.CraftType::new),
|
||||
+ entry(Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, MapCursor.Type.class, CraftMapCursor.CraftType::new),
|
||||
+ entry(Registries.MENU, RegistryKey.MENU, MenuType.class, CraftMenuType::new),
|
||||
+ entry(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, Attribute.class, CraftAttribute::new),
|
||||
+ entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new),
|
||||
+
|
||||
+ // data-drivens
|
||||
+ entry(Registries.STRUCTURE, RegistryKey.STRUCTURE, Structure.class, CraftStructure::new).delayed(),
|
||||
|
@ -108,17 +116,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ entry(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(),
|
||||
+ entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(),
|
||||
+ entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(),
|
||||
+ entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(),
|
||||
+
|
||||
+ // api-only
|
||||
+ apiOnly(Registries.BIOME, RegistryKey.BIOME, () -> org.bukkit.Registry.BIOME),
|
||||
+ apiOnly(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, () -> org.bukkit.Registry.ART),
|
||||
+ apiOnly(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, () -> org.bukkit.Registry.ATTRIBUTE),
|
||||
+ apiOnly(Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE, () -> org.bukkit.Registry.ENTITY_TYPE),
|
||||
+ apiOnly(Registries.PARTICLE_TYPE, RegistryKey.PARTICLE_TYPE, () -> org.bukkit.Registry.PARTICLE_TYPE),
|
||||
+ apiOnly(Registries.POTION, RegistryKey.POTION, () -> org.bukkit.Registry.POTION),
|
||||
+ apiOnly(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, () -> org.bukkit.Registry.SOUNDS),
|
||||
+ apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> (org.bukkit.Registry<MemoryKey<?>>) (org.bukkit.Registry) org.bukkit.Registry.MEMORY_MODULE_TYPE),
|
||||
+ apiOnly(Registries.FLUID, RegistryKey.FLUID, () -> org.bukkit.Registry.FLUID)
|
||||
+ apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> (org.bukkit.Registry<MemoryKey<?>>) (org.bukkit.Registry) org.bukkit.Registry.MEMORY_MODULE_TYPE)
|
||||
+ );
|
||||
+ final Map<RegistryKey<?>, RegistryEntry<?, ?>> byRegistryKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size());
|
||||
+ final Map<ResourceKey<?>, RegistryEntry<?, ?>> byResourceKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size());
|
||||
|
@ -758,9 +764,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- * @return the bukkit registry of the provided class
|
||||
- */
|
||||
- public static <B extends Keyed> Registry<?> createRegistry(Class<? super B> bukkitClass, RegistryAccess registryHolder) {
|
||||
- if (bukkitClass == Attribute.class) {
|
||||
- return new CraftRegistry<>(Attribute.class, registryHolder.lookupOrThrow(Registries.ATTRIBUTE), CraftAttribute::new, FieldRename.ATTRIBUTE_RENAME);
|
||||
- }
|
||||
- if (bukkitClass == Biome.class) {
|
||||
- return new CraftRegistry<>(Biome.class, registryHolder.lookupOrThrow(Registries.BIOME), CraftBiome::new, FieldRename.BIOME_RENAME);
|
||||
- }
|
||||
- if (bukkitClass == Enchantment.class) {
|
||||
- return new CraftRegistry<>(Enchantment.class, registryHolder.lookupOrThrow(Registries.ENCHANTMENT), CraftEnchantment::new, FieldRename.ENCHANTMENT_RENAME);
|
||||
- }
|
||||
- if (bukkitClass == Fluid.class) {
|
||||
- return new CraftRegistry<>(Fluid.class, registryHolder.lookupOrThrow(Registries.FLUID), CraftFluid::new, FieldRename.NONE);
|
||||
- }
|
||||
- if (bukkitClass == GameEvent.class) {
|
||||
- return new CraftRegistry<>(GameEvent.class, registryHolder.lookupOrThrow(Registries.GAME_EVENT), CraftGameEvent::new, FieldRename.NONE);
|
||||
- }
|
||||
|
@ -1260,7 +1275,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
static {
|
||||
- // Order: Bukkit class, Minecraft Registry key, CraftBukkit class, Minecraft class
|
||||
- register(Attribute.class, Registries.ATTRIBUTE, CraftAttribute.class, net.minecraft.world.entity.ai.attributes.Attribute.class);
|
||||
- register(Biome.class, Registries.BIOME, CraftBiome.class, net.minecraft.world.level.biome.Biome.class);
|
||||
- register(Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class);
|
||||
- register(Fluid.class, Registries.FLUID, CraftFluid.class, net.minecraft.world.level.material.Fluid.class);
|
||||
- register(GameEvent.class, Registries.GAME_EVENT, CraftGameEvent.class, net.minecraft.world.level.gameevent.GameEvent.class);
|
||||
- register(MusicInstrument.class, Registries.INSTRUMENT, CraftMusicInstrument.class, Instrument.class);
|
||||
- register(MenuType.class, Registries.MENU, CraftMenuType.class, net.minecraft.world.inventory.MenuType.class);
|
||||
|
@ -1282,7 +1300,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- register(PatternType.class, Registries.BANNER_PATTERN, CraftPatternType.class, BannerPattern.class);
|
||||
-
|
||||
+ // Order: RegistryKey, Bukkit class, Minecraft Registry key, CraftBukkit class, Minecraft class
|
||||
+ register(RegistryKey.ATTRIBUTE, Attribute.class, Registries.ATTRIBUTE, CraftAttribute.class, net.minecraft.world.entity.ai.attributes.Attribute.class);
|
||||
+ register(RegistryKey.BIOME, Biome.class, Registries.BIOME, CraftBiome.class, net.minecraft.world.level.biome.Biome.class);
|
||||
+ register(RegistryKey.ENCHANTMENT, Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class);
|
||||
+ register(RegistryKey.FLUID, Fluid.class, Registries.FLUID, CraftFluid.class, net.minecraft.world.level.material.Fluid.class);
|
||||
+ register(RegistryKey.GAME_EVENT, GameEvent.class, Registries.GAME_EVENT, CraftGameEvent.class, net.minecraft.world.level.gameevent.GameEvent.class);
|
||||
+ register(RegistryKey.INSTRUMENT, MusicInstrument.class, Registries.INSTRUMENT, CraftMusicInstrument.class, Instrument.class);
|
||||
+ register(RegistryKey.MOB_EFFECT, PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class);
|
||||
|
|
|
@ -10,6 +10,22 @@ public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/Fir
|
|||
|
||||
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java
|
||||
@@ -0,0 +0,0 @@ public class CraftAttribute implements Attribute, Handleable<net.minecraft.world
|
||||
return this.attributeBase.getDescriptionId();
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public @NotNull String translationKey() {
|
||||
+ return this.attributeBase.getDescriptionId();
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public int compareTo(@NotNull Attribute attribute) {
|
||||
return this.ordinal - attribute.ordinal();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
|
|
|
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ writable(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new, PaperEnchantmentRegistryEntry.PaperBuilder::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(),
|
||||
entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(),
|
||||
entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(),
|
||||
|
||||
entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(),
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
|
|
@ -31,19 +31,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), this.structureCheck); // CraftBukkit
|
||||
if ((this.dimension() == Level.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) || env == org.bukkit.World.Environment.THE_END) { // CraftBukkit - Allow to create EnderDragonBattle in default and custom END
|
||||
this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenOptions().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java b/src/main/java/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java
|
||||
@@ -0,0 +0,0 @@ public record SummonEntityEffect(HolderSet<EntityType<?>> entityTypes, boolean j
|
||||
// CraftBukkit start
|
||||
world.strikeLightning(entity1, (context.itemStack().getItem() == Items.TRIDENT) ? LightningStrikeEvent.Cause.TRIDENT : LightningStrikeEvent.Cause.ENCHANTMENT);
|
||||
} else {
|
||||
- world.addFreshEntityWithPassengers(user, CreatureSpawnEvent.SpawnReason.ENCHANTMENT);
|
||||
+ world.addFreshEntityWithPassengers(entity1, CreatureSpawnEvent.SpawnReason.ENCHANTMENT); // Paper - Fix typo when adding summoned entity
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
|
||||
|
|
|
@ -18,34 +18,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBiome.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBiome.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBiome.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBiome.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.block;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.craftbukkit.CraftRegistry;
|
||||
@@ -0,0 +0,0 @@ public class CraftBiome {
|
||||
return CraftBiome.minecraftToBukkit(minecraft.value());
|
||||
}
|
||||
|
||||
+ private static final java.util.Map<org.bukkit.block.Biome, ResourceKey<net.minecraft.world.level.biome.Biome>> BIOME_KEY_CACHE = java.util.Collections.synchronizedMap(new java.util.EnumMap<>(Biome.class)); // Paper
|
||||
public static net.minecraft.world.level.biome.Biome bukkitToMinecraft(Biome bukkit) {
|
||||
if (bukkit == null || bukkit == Biome.CUSTOM) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return CraftRegistry.getMinecraftRegistry(Registries.BIOME)
|
||||
- .getOptional(CraftNamespacedKey.toMinecraft(bukkit.getKey())).orElseThrow();
|
||||
+ .getOptional(BIOME_KEY_CACHE.computeIfAbsent(bukkit, b -> ResourceKey.create(Registries.BIOME, CraftNamespacedKey.toMinecraft(b.getKey())))).orElseThrow();
|
||||
}
|
||||
|
||||
public static Holder<net.minecraft.world.level.biome.Biome> bukkitToMinecraftHolder(Biome bukkit) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
|
||||
|
|
|
@ -696,7 +696,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT);
|
||||
return this.customBiome;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
||||
cra.setBiome(x, y, z, biomeBase);
|
||||
public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) {
|
||||
accessor.setBiome(x, y, z, org.bukkit.Registry.BIOME.getOrThrow(biomeKey));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
|
|
|
@ -42,7 +42,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java
|
||||
@@ -0,0 +0,0 @@ public class CraftAttribute {
|
||||
@@ -0,0 +0,0 @@ public class CraftAttribute implements Attribute, Handleable<net.minecraft.world
|
||||
string = FieldRename.convertAttributeName(ApiVersion.CURRENT, string);
|
||||
string = string.toLowerCase(Locale.ROOT);
|
||||
NamespacedKey key = NamespacedKey.fromString(string);
|
||||
|
|
|
@ -1193,15 +1193,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return (this.hasUseCooldown()) ? new CraftUseCooldownComponent(this.useCooldown) : new CraftUseCooldownComponent(new UseCooldown(1.0F)); // Paper - Create a valid use_cooldown component
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
@Override
|
||||
public void setEquippable(EquippableComponent equippable) {
|
||||
- this.equippable = (equippable == null) ? null : new CraftEquippableComponent((CraftEquippableComponent) this.equippable);
|
||||
+ this.equippable = (equippable == null) ? null : new CraftEquippableComponent((CraftEquippableComponent) equippable); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
|
|
|
@ -142,8 +142,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Test
|
||||
+ public void testUnmodifiabilityOfAttributable() {
|
||||
+ Attributable attributable = EntityType.ZOMBIE.getDefaultAttributes();
|
||||
+ assertThrows(UnsupportedOperationException.class, () -> attributable.registerAttribute(Attribute.GENERIC_ATTACK_DAMAGE));
|
||||
+ AttributeInstance instance = attributable.getAttribute(Attribute.GENERIC_FOLLOW_RANGE);
|
||||
+ assertThrows(UnsupportedOperationException.class, () -> attributable.registerAttribute(Attribute.ATTACK_DAMAGE));
|
||||
+ AttributeInstance instance = attributable.getAttribute(Attribute.FOLLOW_RANGE);
|
||||
+ assertNotNull(instance);
|
||||
+ assertThrows(UnsupportedOperationException.class, () -> instance.addModifier(new AttributeModifier("test", 3, AttributeModifier.Operation.ADD_NUMBER)));
|
||||
+ assertThrows(UnsupportedOperationException.class, () -> instance.setBaseValue(3.2));
|
||||
|
|
|
@ -481,7 +481,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - helper methods for making death event cancellable
|
||||
+ // Add information to death event
|
||||
+ private static void populateFields(net.minecraft.world.entity.LivingEntity victim, EntityDeathEvent event) {
|
||||
+ event.setReviveHealth(event.getEntity().getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||
+ event.setReviveHealth(event.getEntity().getAttribute(org.bukkit.attribute.Attribute.MAX_HEALTH).getValue());
|
||||
+ event.setShouldPlayDeathSound(!victim.silentDeath && !victim.isSilent());
|
||||
+ net.minecraft.sounds.SoundEvent soundEffect = victim.getDeathSound();
|
||||
+ event.setDeathSound(soundEffect != null ? org.bukkit.craftbukkit.CraftSound.minecraftToBukkit(soundEffect) : null);
|
||||
|
|
|
@ -76,14 +76,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java
|
||||
@@ -0,0 +0,0 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior {
|
||||
}
|
||||
}
|
||||
|
||||
- Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(worldserver, iposition, stack, enumdirection), worldserver, stack, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty());
|
||||
+ Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(worldserver, iposition, CraftItemStack.unwrap(event.getItem()), enumdirection), worldserver, stack, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); // Paper - track changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies
|
||||
((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity());
|
||||
// SPIGOT-7923: Avoid create projectiles with empty item
|
||||
if (!itemstack1.isEmpty()) {
|
||||
- Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(worldserver, iposition, itemstack1, enumdirection), worldserver, itemstack1, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty());
|
||||
+ Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(worldserver, iposition, CraftItemStack.unwrap(event.getItem()), enumdirection), worldserver, itemstack1, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); // Paper - track changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies
|
||||
iprojectile.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity());
|
||||
}
|
||||
// itemstack.shrink(1); // CraftBukkit - Handled during event processing
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 553558256cab26217919a0809cc26f7aad22995d
|
||||
Subproject commit 97c5926140420c7b9e8a06b2b8348b1816f2a6bd
|
|
@ -1 +1 @@
|
|||
Subproject commit 18b8ae18390763d48ea292435b75c1eabf5dbff7
|
||||
Subproject commit 7235ad7b04542ce214869eb1ec1966bb392aedc7
|
Loading…
Add table
Reference in a new issue