Help me with summoning an Enderman please!

Started by Mr_Alpha on

Topic category: Help with Minecraft modding (Java Edition)

Active 3 years ago
Joined Jul 2015
Points:
878

User statistics:

  • Modifications: 6
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 133
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!

Active 1 year ago
Joined Sep 2015
Points:
758

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 55
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();}
}

Active 3 years ago
Joined Jul 2015
Points:
878

User statistics:

  • Modifications: 6
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 133
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?

Active 1 year ago
Joined Sep 2015
Points:
758

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 55
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();}
}

Active 3 years ago
Joined Jul 2015
Points:
878

User statistics:

  • Modifications: 6
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 133
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?

Active 12 months ago
Joined Aug 2013
Points:
1162

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
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?

Active 3 years ago
Joined Jul 2015
Points:
878

User statistics:

  • Modifications: 6
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 133
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?

Active 12 months ago
Joined Aug 2013
Points:
1162

User statistics:

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

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

Active 3 years ago
Joined Jul 2015
Points:
878

User statistics:

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

@#2 Thanks, I'll try it.

Active 3 years ago
Joined Jul 2015
Points:
878

User statistics:

  • Modifications: 6
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 133
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?"