Minecraft Blogs / Tutorial

MCreator: Entty spawned from block bug Fix

  • 1,605 views, 3 today
  • 4
  • 1
  • 1
Blacklight-Modding's Avatar Blacklight-Modding
Level 4 : Apprentice Crafter
1
So I don't know how many people use MCreator, but for modding it's a good start!

So I've started to completely re-do a mod I worked on using MCreator called Elemental Knights, and I've had this bug:
Whenever I right click on the tomb block that I made which SHOULD spawn the mob I made, it spawns 2, one fully normal mob with ai and the full package, and another 'ghost' mob, fully inactive and un-interactive.

So, how do we fix this??
On MCreator, click on the block that will spawn the mob and click on the 'edit code' feature.
Scroll aaaaaaaaaalllllllllllllllllllllll the way down until you see this line of code:
Spoiler - click to reveal
if(true){
Entity sentity = EntityList.createEntityByName("knight001", world);if (sentity != null){sentity.setLocationAndAngles(i, j, k, world.rand.nextFloat() * 360F, 0.0F);world.spawnEntityInWorld(sentity);((EntityLiving)sentity).playLivingSound();}
}
Here is an image of the line of code

Make sure it has the mob name you're trying to spawn somewhere on that line. It will look a little different to mine, but it should be, basically, at the bottom of the script.

There should also be a gap just above this line. In that gap, type this in:
Spoiler - click to reveal
if(!world.isRemote)
You do this because it is checking to make sure you are playing, or something. I don't really know, it works though.

So, overall you should have something like this:
Spoiler - click to reveal
if(!world.isRemote)
if(true){
Entity sentity = EntityList.createEntityByName("knight001", world);if (sentity != null){sentity.setLocationAndAngles(i, j, k, world.rand.nextFloat() * 360F, 0.0F);world.spawnEntityInWorld(sentity);((EntityLiving)sentity).playLivingSound();}
}

Save and recompile the mod, run the client test environment and check to see if the 'ghost' is still being spawned.
Tags

Create an account or sign in to comment.

1
05/02/2018 11:20 am
Level 1 : New Miner
pandamanpan
pandamanpan's Avatar
thanks!
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome