diff options
author | Noah van der Aa <[email protected]> | 2022-05-05 00:29:15 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2022-05-04 23:29:15 +0100 |
commit | 2ab0258b5ab985da6d8fe3728c994b325c08ada0 (patch) | |
tree | 42f4bd8aeac80f99ff6fa25ce277162bd60b01db /patches/server/0715-Add-ItemFactory-getMonsterEgg-API.patch | |
parent | e5da93a6083218421bd4e4c6e9bf7a2492bd70ff (diff) | |
download | Paper-2ab0258b5ab985da6d8fe3728c994b325c08ada0.tar.gz Paper-2ab0258b5ab985da6d8fe3728c994b325c08ada0.zip |
Use mojang item ids for alternative item despawn rate (#6997)
Diffstat (limited to 'patches/server/0715-Add-ItemFactory-getMonsterEgg-API.patch')
-rw-r--r-- | patches/server/0715-Add-ItemFactory-getMonsterEgg-API.patch | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/patches/server/0715-Add-ItemFactory-getMonsterEgg-API.patch b/patches/server/0715-Add-ItemFactory-getMonsterEgg-API.patch new file mode 100644 index 0000000000..a39b8f22f5 --- /dev/null +++ b/patches/server/0715-Add-ItemFactory-getMonsterEgg-API.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath <[email protected]> +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 e8ed3017e2d1ac55f79c85be1860aae84db96edc..697d6d8387d1451ac3158d35bbaa00229dcfcbc6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +@@ -434,5 +434,17 @@ public final class CraftItemFactory implements ItemFactory { + entity.getUniqueId().toString(), + new net.md_5.bungee.api.chat.TextComponent(customName)); + } ++ ++ @Override ++ public ItemStack getSpawnEgg(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 + } |