Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-14 20:10:05 +01:00
use correct types for preloading CraftRegistry
also add a check in CraftRegistryEntry constructor to make sure preload class isn't in net.minecraft package
Dieser Commit ist enthalten in:
Ursprung
1bc02e6b23
Commit
20ec62255d
@ -12,7 +12,7 @@ public net.minecraft.server.RegistryLayer STATIC_ACCESS
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c92ce42398a9bfd00eb4e05972289c521ee255cf
|
||||
index 0000000000000000000000000000000000000000..633b01431750d4b40159a57bf25fb35c6670ff1b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
|
||||
@@ -0,0 +1,146 @@
|
||||
@ -28,8 +28,6 @@ index 0000000000000000000000000000000000000000..c92ce42398a9bfd00eb4e05972289c52
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import net.minecraft.world.item.enchantment.Enchantment;
|
||||
+import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
+import org.bukkit.GameEvent;
|
||||
+import org.bukkit.JukeboxSong;
|
||||
+import org.bukkit.Keyed;
|
||||
@ -58,11 +56,13 @@ index 0000000000000000000000000000000000000000..c92ce42398a9bfd00eb4e05972289c52
|
||||
+import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.damage.DamageType;
|
||||
+import org.bukkit.enchantments.Enchantment;
|
||||
+import org.bukkit.entity.Cat;
|
||||
+import org.bukkit.entity.Frog;
|
||||
+import org.bukkit.entity.Villager;
|
||||
+import org.bukkit.entity.Wolf;
|
||||
+import org.bukkit.entity.memory.MemoryKey;
|
||||
+import org.bukkit.generator.structure.Structure;
|
||||
+import org.bukkit.generator.structure.StructureType;
|
||||
+import org.bukkit.inventory.ItemType;
|
||||
+import org.bukkit.inventory.MenuType;
|
||||
@ -416,12 +416,13 @@ index 0000000000000000000000000000000000000000..ceb217dbbb84e8bd51365dd47bf91971
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..568984894a5463ccfa68bb6944b409ab0a2d7ad7
|
||||
index 0000000000000000000000000000000000000000..9bb4aa926978f117901c9f99c45a6862a1d5ce30
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java
|
||||
@@ -0,0 +1,49 @@
|
||||
@@ -0,0 +1,51 @@
|
||||
+package io.papermc.paper.registry.entry;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import io.papermc.paper.registry.RegistryHolder;
|
||||
+import io.papermc.paper.registry.RegistryKey;
|
||||
+import java.util.function.BiFunction;
|
||||
@ -450,6 +451,7 @@ index 0000000000000000000000000000000000000000..568984894a5463ccfa68bb6944b409ab
|
||||
+ final BiFunction<NamespacedKey, M, B> minecraftToBukkit
|
||||
+ ) {
|
||||
+ super(mcKey, apiKey);
|
||||
+ Preconditions.checkArgument(!classToPreload.getPackageName().startsWith("net.minecraft"), classToPreload + " should not be in the net.minecraft package as the class-to-preload");
|
||||
+ this.classToPreload = classToPreload;
|
||||
+ this.minecraftToBukkit = minecraftToBukkit;
|
||||
+ }
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren