Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 02:50:09 +01:00
Add ItemFactory#getMonsterEgg API (#6772)
Dieser Commit ist enthalten in:
Ursprung
40ee63496c
Commit
9d570042ed
@ -250,3 +250,6 @@ public net.minecraft.world.level.block.entity.BlockEntityType validBlocks
|
||||
|
||||
# Default entity attributes
|
||||
public net.minecraft.world.entity.ai.attributes.AttributeSupplier instances
|
||||
|
||||
# Add ItemFactory#getMonsterEgg API
|
||||
public net.minecraft.world.item.SpawnEggItem BY_ID
|
||||
|
25
patches/api/0341-Add-ItemFactory-getMonsterEgg-API.patch
Normale Datei
25
patches/api/0341-Add-ItemFactory-getMonsterEgg-API.patch
Normale Datei
@ -0,0 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 12:09:28 -0500
|
||||
Subject: [PATCH] Add ItemFactory#getMonsterEgg API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
index 0a4466c6ca519c3a5da76ff870fb2a4e3a06effd..d87ec9754f8327ad163c91f0941e195cc970c1ed 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
@@ -241,5 +241,14 @@ public interface ItemFactory {
|
||||
@NotNull
|
||||
@Deprecated
|
||||
net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName);
|
||||
+
|
||||
+ /**
|
||||
+ * Get a monster egg ItemStack from an EntityType
|
||||
+ *
|
||||
+ * @param type EntityType
|
||||
+ * @return ItemStack spawner egg
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ ItemStack getMonsterEgg(@Nullable org.bukkit.entity.EntityType type);
|
||||
// Paper end
|
||||
}
|
28
patches/server/0831-Add-ItemFactory-getMonsterEgg-API.patch
Normale Datei
28
patches/server/0831-Add-ItemFactory-getMonsterEgg-API.patch
Normale Datei
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 12:09:39 -0500
|
||||
Subject: [PATCH] Add ItemFactory#getMonsterEgg API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
index aa7fd5c80712fecca1110341a234f60e8607b809..1e80d3e6778850e859e2f9c0c2fecb0d6ff1a8bb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
@@ -409,5 +409,17 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
entity.getUniqueId().toString(),
|
||||
new net.md_5.bungee.api.chat.TextComponent(customName));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack getMonsterEgg(org.bukkit.entity.EntityType type) {
|
||||
+ if (type == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ String typeId = type.getKey().toString();
|
||||
+ net.minecraft.resources.ResourceLocation typeKey = new net.minecraft.resources.ResourceLocation(typeId);
|
||||
+ net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.core.Registry.ENTITY_TYPE.get(typeKey);
|
||||
+ net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.BY_ID.get(nmsType);
|
||||
+ return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren