Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

how to set player immune to fire/lava?


Torojima
 Share

Recommended Posts

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]

Link to comment
Share on other sites

  • 2 weeks later...

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]

Link to comment
Share on other sites

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!)

Link to comment
Share on other sites

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!)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • hi i made the accesstransformer.cfg file with the text it needs for what im doing, but i dont know how to refresh the gradle project, in eclipse you right click in the project, gradle and refresh gradle project but im using intellij and all the tutorials for accesstransformers are made for eclipse #AbstractClientPlayerEntity public net.minecraft.client.entity.player.AbstractClientPlayerEntity field_175157_a # playerInfo #NetworkPlayerInfo public net.minecraft.client.network.play.NetworkPlayerInfo field_187107_a # playerTextures public net.minecraft.client.network.play.NetworkPlayerInfo field_178864_d # playerTexturesLoaded public net.minecraft.client.network.play.NetworkPlayerInfo func_178841_j()V # loadPlayerTextures public net.minecraft.client.network.play.NetworkPlayerInfo field_178867_a # gameProfile  
    • i wrote the accessmodifier thing, refreshed the build.gradle file and even restarted my idle but it didnt worked, i checked the location of where the .cfg file should be but there is nothing(src/main/resources/META-INF/accesstransformer.cfg), there is only the mods.toml
    • Did you had a look at the link to the Forge doc I attached?
    • I have a server on Forge, no mods installed, version 1.16.5.  If I try to do any update on a new release the placed block values randomize.  Basically, the grass turns to rail road tracks, horses are dolphins grazing grass, chickens are fish sliding around on the grass, and the ender dragon is raining fire and hell down on the world.  It's a interesting take on the game.  However, you can't play this scrambled mess.  The block will look correct in your hand, but once place it's anyone's guess what it becomes. There is literally zombie army's marching single file LOL...So the server is currently stuck on 1.16.5 and I can't update it basically.  If I reload my backup to the version 1.16.5 all order is restored.   I have updated my account, java, and reinstalled Minecraft.  Single player works fine on new world creations....it's just this server and trying to update.  It has been updated many times in the past, as it's a couple years old...any suggestions?
    • I know this is basic java knowledge but PLEASE tell me a solution, i already learned java but i never imagined how i can use public, private and protected(obviusly i use them but i dont know how to connect private fieds so my class) im BEGGING YOU tell me how, i tried some tutorials of how to access to private fields but it wasnt helpful
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.