Jump to content

Recommended Posts

Posted

Since the big update to 1.3.2 I have some problems setting the fire/lava immunity status of an entity from the outside. To be exact, I would like to have a player riding a certain mob in my mod gain fire/lava immunity. Thus I have to set the player entity to immune-to-fire from the mounted entity... Does anybody have any idea how to do this?

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

  • 2 weeks later...
Posted

yes, very simple, if one would not have organised ones classes in structured packets, but shoved them all into the net.minecraft.src packet. If not one has the problem of the EntityPlayer.isImmuneToFire beeing protected and only available for classes in the above mentioned packet (or classed derived from EntityPlayer). Both options are imho not very attractive. Installing a class in the net.minecraft.src packet only to gain access to the protected fields would be something on my wish-list for the used API and deriving a class from EntityPlayer proprietary only to a specific mod is again imho also not very advisable. The only option left would be reflections, but using that I always feel like a bank robber opening a save with high explosives ...

 

So I guess, my question has been asked slightly wrong. No, not the question, but the explanatory statement before. My problems do not derive from the 1.3.2 update, but from the fact that I have started to organise my code better in structured packets different to the main minecraft src packet. My question stays the same ... is there a way in forge to access this particular field (EntityPlayer.isImmuneToFire)? If not could it go into the planing to incorporate a respective access to these fields from the outside. I would like to follow a policy to not put any of my code into the minecraft core packets, but only access what is visible from the outside or through Forge. If that's not possible, I do have to fall back to the EntityPlayer derived proprietary class in my mod only to access the protected fields ...

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Posted

EntityDamageEvent, and if the conditions are right (it's a player, etc), cancel it.

Protip: try and find answers yourself before asking on the forum.

It's pretty likely that there is an answer.

 

Was I helpful? Give me a thank you!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Posted

You can check to see if the ev.source is the right DamageSource. Then cancel it if it is.

Protip: try and find answers yourself before asking on the forum.

It's pretty likely that there is an answer.

 

Was I helpful? Give me a thank you!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Posted

You can check to see if the ev.source is the right DamageSource. Then cancel it if it is.

 

Oh yes, I wasn't disagreeing, I was adding more info, by 'can', I mean it is possible.

 

Also I want to point out that, atleast a few forge versions ago, EntityDamageEvent returned the final damage BEFORE armor absorption would take place, before the damage actually occurs(obviously since you can cancel it). So the damage sent is not the true damage if the mob has armor.

 

Not that this would matter in this guys use, just some information to others who read this.

Posted

in my event handler I've done the following

 

@ForgeSubscribe
public void onBurnDamage(LivingAttackEvent event)
{
    if(event.entity instanceof EntityPlayer)
    {
        EntityPlayer player = (EntityPlayer)event.entity;
    	if(event.source.equals(DamageSource.lava) 
    	    || event.source.equals(DamageSource.inFire) 
    	    || event.source.equals(DamageSource.onFire))
    	    {
                 if(player.ridingEntity instanceof EntityChocoboPurple)
    		{
    		    event.setCanceled(true);
    		}
    	    }
       }
   }
}

 

which works fine. riding one of my mobs the player can walk through lava, without he'll get his but burned :)

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

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.