Help me with summoning an Enderman please!

Started by Mr_Alpha on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help me with summoning an Enderman please!

I set an item to summon entity with ID 58 (Enderman) one block above the block you right click on. It spawns, but gravity doesn't affect it, it doesn't move and won't attack you. It stays in an infinite loop of its standing animation and you can't hit it. I tried execute command on rightclick on block and put "summon Enderman ~ ~1 ~" (because it says command without the /) and it says you do not have permissions. I turned on cheats via hosting the world on LAN and it still didn't work. Then, I typed /summon Enderman in the chat and an Enderman appeared and worked completely. If you help me in a reply and it works, you'll get a dedication on the mod page! Thanks!

Joined Sep 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It is the "ghost mob" bug.
Wed, 04/13/2016 - 05:37

It is the "ghost mob" bug. The real enderman spawned but probably instantly tped away. The ghost enderman would disappear after relogging.

To fix this bug, add if(!world.isRemote){ before the spawning code and close with the bracket }

so it should look like: 

Entity sentity = EntityList.createEntityByName("name", world);if (sentity != null){sentity.setLocationAndAngles(i, j, k, world.rand.nextFloat() * 360F, 0.0F);if(!world.isRemote){world.spawnEntityInWorld(sentity);}((EntityLiving)sentity).playLivingSound();}
}

Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:It is the "ghost mob" bug.
Wed, 04/13/2016 - 13:08

@#1 Thanks! Do you know what line of code that will be on? Or at least a general area?

Joined Sep 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:It is the "ghost mob" bug.
Wed, 04/13/2016 - 17:13

@#1.1 see my example

Entity sentity = EntityList.createEntityByName("name", world);if (sentity != null){sentity.setLocationAndAngles(i, j, k, world.rand.nextFloat() * 360F, 0.0F);if(!world.isRemote){world.spawnEntityInWorld(sentity);}((EntityLiving)sentity).playLivingSound();}
}

Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:It is the "ghost mob" bug.
Wed, 04/13/2016 - 19:53

@#1.1.1 Ok, I found the spot. Thanks a lot. :) Let's hope this works...

 

UPDATE: OK, I got the semicolon placing wrong. Rewriting and retrying...

 

UPDATE 2: It still doesn't work. The enderman spawns in like before and jsut stands there. This time I shot it with a bow and it disappeared, but there was no enderman in sight within 100 blocks radius. The code did literally nothing, sorry. Any other suggestions?

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:RE:It is the "ghost mob" bug.
Wed, 04/13/2016 - 20:00

@#1.1.1.1 Can you show the code?

Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:RE:RE:It is the "ghost mob" bug.
Wed, 04/13/2016 - 20:04

@#1.1.1.1.1 I think I'm just going to have it give you an enderman spawn egg. But... You can only spawn a generic spawn egg. Do you know how to select a spawn egg of a specific mob?

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
 Maybe: new ItemStack(Item
Wed, 04/13/2016 - 20:13

 Maybe: new ItemStack(Item.getItemById(383),1,58);

Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE: Maybe: new ItemStack(Item
Wed, 04/13/2016 - 20:31

@#2 Thanks, I'll try it.

Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE: Maybe: new ItemStack(Item
Thu, 04/14/2016 - 17:20

@#2 Okay, so it worked and it didn't work. It gave me the egg, but then I tried to use it and all of the multiple eggs in my inventory disappeared and it didn't spawn an enderman on rightclick. Do you have any ideas on how to just summon it in without the "Ghost Mob Bug?"