MC Modding
Please register and join the community!

[1.8.1] Adding a new gamemode

View previous topic View next topic Go down

[1.8.1] Adding a new gamemode

Post by maciejkiller on Fri Nov 18, 2011 12:56 am

Decompiling minecraft.jar
Spoiler:
Download ModLoader and GameMode API (get GameMode APIhere)
and download it as you normally would download ModLoader (drag and drop)
Run decompile.bat

Making a new gamemode
Spoiler:
make a new file called mod_gamemode.java or whatever you want to call the mod.
open it and type:
Code:
package net.minecraft.src;

import net.minecraft.client.Minecraft;

public class mod_gamemode extends BaseMod
{
    private int GamemodeID = 4;
        public mod_gamemode()
        {
          GMAPI.AddGamemode(GamemodeID, "Namehere", new PlayerControllerSP(mc)); //Can be a custom PlayerController
      GMAPI.AddGamemodeLine1(GamemodeID,"New gamemode");
      GMAPI.AddGamemodeLine2(GamemodeID,"Epic thing here");
      ModLoader.SetInGameHook(this, true, false);
        }
  public boolean OnTickInGame(Minecraft minecraft)
    {

        if(minecraft == null)
        {
            minecraft = ModLoader.getMinecraftInstance();
        }
        if(minecraft.thePlayer == null || minecraft.theWorld == null)
        {
            return false;
        }
        if(GMAPI.CurrentPC == "Namehere")
        {
            mc.thePlayer.health = 20;
            mc.thePlayer.fire = 0;
        }
        return true;
    }
    private Minecraft mc = ModLoader.getMinecraftInstance();
        public String Version() { return GMAPI.GetVersion; }
}
Change all that says Namehere and the "New Gamemode" and "Epic thing here"

Help
1. At mc.thePlayer.health = 20;, the number 20 means the half hearts.
2. ID's range from 4 to 99.

maciejkiller
Member

Posts : 5
Join date : 2011-11-07

View user profile

Back to top Go down

View previous topic View next topic Back to top


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