Build error : cannot find symbol on World.spawnEntityInWorld

Started by Riuuflix on Sat, 08/31/2019 - 18:29

Topic category: Bugs and solutions

Last seen on 18:29, 14. Sep 2019
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
Build error : cannot find symbol on World.spawnEntityInWorld
Sat, 08/31/2019 - 18:29

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 ?

Last seen on 17:40, 25. Jun 2020
Joined Mar 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.

Last seen on 17:40, 25. Jun 2020
Joined Mar 2019
User points:

User statistics:

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

and if still not try use 

world.spawnEntity(fireball);
Last seen on 18:29, 14. Sep 2019
Joined Aug 2019
User points:

User statistics:

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

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

Last seen on 17:40, 25. Jun 2020
Joined Mar 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.