Posted September 17, 20178 yr I am searching now for ages, how to get a specified spawn egg. What ever i try, i only get a white spawn egg, that can't spawn anything. Here's what i've tried at last. Spoiler public static Item spawnEgg = getSpawnEgg(); public static Item getSpawnEgg() { ItemStack stack = new ItemStack(Items.SPAWN_EGG, 1); ItemMonsterPlacer.applyEntityIdToItemStack(stack, "thewizardmod.MiniZombie"); return stack.getItem(); }
September 17, 20178 yr An Item instance only represents an item type, in this case the spawn egg. To store any more data (e.g. the entity spawned by the egg), you need the metadata/NBT of an ItemStack. You create an ItemStack with the NBT data required to spawn a "thewizardmod.MiniZombie" entity but then immediately discard it by returning the Item from the method rather than the ItemStack. Which version of Minecraft are you using? If you're using 1.9-1.11.2, ItemMonsterPlacer.applyEntityIdToItemStack is a client-only method that can't be used from common code. If you're using 1.11+, "thewizardmod.MiniZombie" is in the wrong format for a mod entity's registry name; it's a ResourceLocation so it should be lowercase and in the format "modid:entity_name". Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
September 17, 20178 yr Author It's MC 1.10.2 I don't need the ItemStack. I need the Item it self. What else to do, then stack,getItem() to get it?
September 17, 20178 yr 8 minutes ago, Dustpuppy said: It's MC 1.10.2 I don't need the ItemStack. I need the Item it self. What else to do, then stack,getItem() to get it? The Item is just "Spawn Egg". If you want "Spawn Egg of Mini Zombie", you need an ItemStack. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
September 17, 20178 yr Author Shit. Then i have to find another way to give player an item he can use to spawn the entity. Don't want to rewrite the whole crafting code, i have.
September 17, 20178 yr Author Is there a way to make an item from an entity? Then i could give the player this to spawn the entity.
September 17, 20178 yr Just now, Dustpuppy said: Is there a way to make an item from an entity? Then i could give the player this to spawn the entity. You'd have to make your own Item like the spawn egg that only spawns one entity type rather than whatever's specified in the NBT. I'd recommend reworking your code to use an ItemStack rather than just an Item. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
September 17, 20178 yr Yes, it's an ItemStack(SpawnEgg) with NBT data indicating what entity to spawn. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
September 17, 20178 yr You could try either making your own spawn egg and look at my code. if you copy and paste give me credit. https://github.com/jredfox/silkspawners/tree/master/src/main/java/com/EvilNotch/silkspawners Or you could download silk spawners mod which already adds in eggs to the creative tab for missing eggs your choice. Note it might add eggs for 1.9+ that are not there as it's not fully tested with the new egg system but, still should work. https://minecraft.curseforge.com/projects/silk-spawners-forge-edition Edited September 17, 20178 yr by jredfox adding text
September 17, 20178 yr Author Too late. Have made an item, that can be crafted on the altar and used to spawn the zombie. This little zombies are like golems. They can do stupid work, but have no brain for more. Like politics
September 17, 20178 yr Why does its inventory icon look rotated? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
September 17, 20178 yr Completely breaks the minecraft aesthetic. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.