Posted March 22, 20187 yr Hi, I have a set of container slots that only allow spawn eggs to be placed in them (by overriding isItemValid), I want to get entity information from the spawn eggs placed in the slots, but I am not sure how to achieve this. Ideally I'd like an Entity object that I could user later in my code. Does anyone know the basic steps to go from spawn egg in container slot -> spawn egg's entity?
March 22, 20187 yr Have a look at ItemMonsterPlacer::spawnCreature. That is the code that the spawn-eggs use to create & spawn an entity in the world. Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
March 22, 20187 yr Author Thanks, I figured it out: try { entity = (EntityLivingBase) ForgeRegistries.ENTITIES.getValue((ItemMonsterPlacer.getNamedIdFrom(stack))).newInstance(worldIn); } catch (NullPointerException e) { System.out.println(e); }
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.