Build error : cannot find symbol on World.spawnEntityInWorld

Started by Riuuflix on

Topic category: Troubleshooting, bugs, and solutions

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Build error : cannot find symbol on World.spawnEntityInWorld

Hello,

I'm trying to make an item that shoots blaze fireballs, here's the code :

@Override
			public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer entity, EnumHand hand) {
				ActionResult<ItemStack> retval = super.onItemRightClick(world, entity, hand);
				if(world.isRemote)
					return retval;
				ItemStack itemstack = retval.getResult();
				Vec3d looking = entity.getLookVec();
				EntitySmallFireball fireball = new EntitySmallFireball(world, (EntityLivingBase) entity,
					looking.x * 0.4, looking.y * 0.4, looking.z * 0.4);
				world.spawnEntityInWorld((Entity) fireball);
				return retval;
			}

And here's the error :

error: cannot find symbol
            world.spawnEntityInWorld((Entity) fireball);
                 ^
  symbol:   method spawnEntityInWorld(Entity)
  location: variable world of type World

I searched a lot but found nothing, any idea ?

Joined Mar 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey Riuuflix, Can you please…
Thu, 09/12/2019 - 17:36

Hey Riuuflix, Can you please use pastebin or something so it more readable?

Also its because it cannot find the import that in the current version of MCreator does not do automatically most of the times.

Joined Mar 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and if still not try use  …
Thu, 09/12/2019 - 17:41

and if still not try use 

world.spawnEntity(fireball);
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The new method "world…
Sat, 09/14/2019 - 18:31

The new method "world.spawnEntity(fireball)" works ! Thanks !

Joined Mar 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
No problem. Please make this…
Mon, 09/16/2019 - 15:55

No problem. Please make this side "[Fixed]" so others can see how to fix their problem if they ever incounter this.