Jump to content

Recommended Posts

Posted

EntityLivingBase#addPotionEffect. You can't add a PotionEffect to an Entity since Entity objects can't have them in the first place. Only the descendants of EntityLivingBase may have potion effects.

Posted
2 minutes ago, V0idWa1k3r said:

EntityLivingBase#addPotionEffect. You can't add a PotionEffect to an Entity since Entity objects can't have them in the first place. Only the descendants of EntityLivingBase may have potion effects.

I dont get the difference between the 2?

Posted (edited)
30 minutes ago, V0idWa1k3r said:

They are different classes. An EntityPig is a descendant of EntityLivingBase, but EntityItem or EntityArrow isn't.

That's peculier then because i am trying to add a effect to a creeper, which should be possible then right?

 

I have a creeper stored into a entity object, can i convert it to entitylivingbase somehow?

Edited by Robin Withes
sdf asdf sadf sad f
Posted
30 minutes ago, Robin Withes said:

I have a creeper stored into a entity object, can i convert it to entitylivingbase somehow?

Casting.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
4 minutes ago, V0idWa1k3r said:

Yes it is.

Well but i cant,

	@SubscribeEvent
	public void entitySpawned(EntityJoinWorldEvent event) {
		Entity entity = event.getEntity();
		if (MonsterConfig.isEnhancedMob(entity.getDisplayName().getUnformattedText()) && !entity.isDead)
		{
			//Add potion effect to entity here
		}
	}

 

This is my event currently, i have no idea how to convert the entity to a entitylivingbase.

3 minutes ago, Draco18s said:

Casting.

No idea what that means, i already tried this:

EntityLivingBase entityLivingBase = (Entity) entity;

 

Edited by Robin Withes
more clarifi
Posted
21 minutes ago, Robin Withes said:

EntityLivingBase entityLivingBase = EntityLivingBase.class.cast(entity);

 

This is still not the right way to cast things.

21 minutes ago, Robin Withes said:

Hope your ego trip was fun

This is not about mine or anyoneelses ego. This is about you and your coding. If you don't know the language you are using you won't be able to do much. You will encounter issues you won't be able to solve because you don't know how, like right now. And you will come to this forum again asking a question that can be solved just by knowing the language. And we will have to tell you the same thing I am telling you right now - learn java before starting to mod. You WILL have issues.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.