diff options
author | Matthew <stteg@hotmail.com> | 2016-12-06 21:15:10 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-12-06 21:15:34 +1100 |
commit | 04202c0ace026b51160ea18dec5434a3263c936d (patch) | |
tree | dee96ec01cae992ce2b255fe4a3fbecb07771e7e /src/test | |
parent | 9dee10873da43e15d870a3d3d621c0e04d205f4c (diff) | |
download | craftbukkit-04202c0ace026b51160ea18dec5434a3263c936d.tar craftbukkit-04202c0ace026b51160ea18dec5434a3263c936d.tar.gz craftbukkit-04202c0ace026b51160ea18dec5434a3263c936d.tar.lz craftbukkit-04202c0ace026b51160ea18dec5434a3263c936d.tar.xz craftbukkit-04202c0ace026b51160ea18dec5434a3263c936d.zip |
SPIGOT-1592: Implement ItemMeta for Spawn Eggs
The Minecraft implementation of spawn eggs is able to construct an entity using all data that is present in the save format, however since the Bukkit API has no such way to construct an entity unattached to a world, and it appears creating such a way is a very challenging task, the decision was instead made to add this API now that 1.11 has entities which may not be represented by data values.
In the future it may be possible to implement a more expanded API cognate with this one.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java index 8c479a68..69c21f28 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -24,6 +24,7 @@ import org.bukkit.craftbukkit.inventory.ItemStackTest.StackWrapper; import org.bukkit.craftbukkit.inventory.ItemStackTest.BukkitWrapper; import org.bukkit.craftbukkit.inventory.ItemStackTest.CraftWrapper; import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.BlockStateMeta; @@ -35,6 +36,7 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.MapMeta; import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.inventory.meta.SpawnEggMeta; import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionType; @@ -255,6 +257,14 @@ public class ItemMetaTest extends AbstractTestingBase { cleanStack.setItemMeta(meta); return cleanStack; } + }, + new StackProvider(Material.MONSTER_EGG) { + @Override ItemStack operate(ItemStack cleanStack) { + final SpawnEggMeta meta = (SpawnEggMeta) cleanStack.getItemMeta(); + meta.setSpawnedType(EntityType.ZOMBIE); + cleanStack.setItemMeta(meta); + return cleanStack; + } } ); |