MC Modding
Please register and join the community!

Immune to Fire

Go down

Immune to Fire Empty Immune to Fire

Post by Bearslove on Thu Nov 10, 2011 6:34 am

Hey everyone! It's nice to be here. Smile I wanted to say hi in an official place, but I guess there is no section for hello's. Oh well. I have recently started modding, and these tutorials have helped so much! Especially the armor one. I have a question about armor abilities, I want to make the player immune to fire when he wears the chest piece, and it works great in single player, but when I turn it into a server mod, it doesn't work. My code is as follows:



package net.minecraft.src;

import java.util.Random;
import net.minecraft.client.Minecraft;

public class mod_FireProofChest extends BaseMod
   public String Version()
      return "Mod";
   public mod_FireProofChest()
        ModLoader.SetInGameHook(this, true, false);
    public boolean OnTickInGame(Minecraft minecraft)
    minecraft.thePlayer.isImmuneToFire = false;
           ItemStack chest = null;
    chest = minecraft.thePlayer.inventory.armorInventory[2];

           if(chest == null)
     return true;
           if(chest.itemID == mod_Mod.Chest.shiftedIndex)
               minecraft.thePlayer.isImmuneToFire = true;
    return true;

Also, in this manner, the person is no longer immune to fire when he takes off the chest, unlike in the original tutorial I saw on here where the player would remain on fire even after removing everything. The problem is of course that it doesn't transfer to multiplayer, like the rest of my armor pieces. I was wondering if anyone could help me out with that. I would greatly appreciate it! Smile


Posts : 4
Join date : 2011-11-10

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum