Jump to content

addArmor replacement


GigaNova

Recommended Posts

GameRegistry replaces most things with ModLoader, so, try that.

 

Thank you, but there is no .addarmor in GameRegistery.

 

This is my code.

package net.minecraft.src;
import java.util.Random;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.src.ItemArmor;
import net.minecraftforge.client.MinecraftForgeClient;



public class mod_UraniacArmour extends BaseMod


{

//First number: data value
//Second number: durability/strength of UraniacArmour
//Third number: skin (what the UraniacArmour looks like when you're wearing it)
//Fourth number: type of amour (0 = Helm, 1 = UraniacBody, 2 = UraniacLegs, 3 = UraniacBoots)

public static final Item UraniacHelmet = new UraniacItemArmor(4007, EnumArmorMaterial.URANIAC, ModLoader.addArmor("UraniacHelmet"), 0).setItemName("Uraniac Helmet").setIconIndex(15);
public static final Item UraniacBody = new UraniacItemArmor(4008, EnumArmorMaterial.URANIAC, ModLoader.addArmor("UraniacBody"), 1).setItemName("Uraniac Chestplate").setIconIndex(14);
public static final Item UraniacLegs = new UraniacItemArmor(4009, EnumArmorMaterial.URANIAC, ModLoader.addArmor("UraniacLegs"), 2).setItemName("Uraniac Legs").setIconIndex(12);
public static final Item UraniacBoots = new UraniacItemArmor(4010, EnumArmorMaterial.URANIAC, ModLoader.addArmor("UraniacBoots"), 3).setItemName("Uraniac Boots").setIconIndex(13);

public mod_UraniacArmour()
{

//This adds the item textures, which is what the UraniacArmour looks like when you're holding it
//This sets the recipes for each piece of UraniacArmour.
//Note: I made it so the recipes are the same as regular UraniacArmour recipes,
// except they're made completely out of dirt
//The next four lines add the in-game names to each piece of UraniacArmour.
	ModLoader.addName(UraniacHelmet, "Uraniac Helmet");
	ModLoader.addName(UraniacBody, "Uraniac Chest Plate");
	ModLoader.addName(UraniacLegs, "Uraniac Greaves");
	ModLoader.addName(UraniacBoots, "Uraniac Boots");

}

//This function tells ModLoader what "version" your mod is (don't worry about it, I put in pi for you)
public String getVersion(){
	return "1.3.2";
}
public void load() {
	ModLoader.addRecipe(new ItemStack(UraniacHelmet, 1), new Object[] {
		"***", "* *", Character.valueOf('*'), mod_UraniacBar.UraniacBar
	});
	ModLoader.addRecipe(new ItemStack(UraniacBody, 1), new Object[] {
		"* *", "***", "***", Character.valueOf('*'), mod_UraniacBar.UraniacBar
	});
	ModLoader.addRecipe(new ItemStack(UraniacLegs, 1), new Object[] {
		"***", "* *", "* *", Character.valueOf('*'), mod_UraniacBar.UraniacBar
	});
	ModLoader.addRecipe(new ItemStack(UraniacBoots, 1), new Object[] {
		"* *", "* *", Character.valueOf('*'), mod_UraniacBar.UraniacBar
	});		
        {
                MinecraftForgeClient.preloadTexture("/DPIndex.png");
        }
}
}

 

The Server gives the error: NoSuchMethod modloader.addarmor.

Link to comment
Share on other sites

Here is a few commands to help you convert.

GameRegistry.addRecipe
LanguageRegistry.addName
GameRegistry.registerBlock
FurnaceRecipes.smelting().addSmelting

 

 

Now for some problems you will have:

First if your not using Eclipse (or something similar) get it, it will make your life easier.

 

Get out of net.minecraft.src

use package giganova.uraniac;

 

Never make any imports to client classes on your common classes, always go through your proxy.

 

 

I have a bit of time to kill, and your code sample is short so here it is converted:

 

 

Minecraft\src\giganova\uraniac\client\ClientProxy.java

http://pastebin.com/duDPTKQ5

 

Minecraft\common\giganova\uraniac\CommonProxy.java

http://pastebin.com/dFmyiXvE

 

Minecraft\common\giganova\uraniac\UraniacArmour.java

http://pastebin.com/TDEcnBk5

Link to comment
Share on other sites

Here is a few commands to help you convert.

GameRegistry.addRecipe
LanguageRegistry.addName
GameRegistry.registerBlock
FurnaceRecipes.smelting().addSmelting

 

 

Now for some problems you will have:

First if your not using Eclipse (or something similar) get it, it will make your life easier.

 

Get out of net.minecraft.src

use package giganova.uraniac;

 

Never make any imports to client classes on your common classes, always go through your proxy.

 

 

I have a bit of time to kill, and your code sample is short so here it is converted:

 

 

Minecraft\src\giganova\uraniac\client\ClientProxy.java

http://pastebin.com/duDPTKQ5

 

Minecraft\common\giganova\uraniac\CommonProxy.java

http://pastebin.com/dFmyiXvE

 

Minecraft\common\giganova\uraniac\UraniacArmour.java

http://pastebin.com/TDEcnBk5

 

Thanks alot!

 

Its working now!

Link to comment
Share on other sites

  • 7 months later...

I am actually having troubles with using this method. Is there any chance someone could fix the error I'm getting? It says that I cannot make a static reference to the field I'm using. I followed what you put down for the int entirely. Is there any way I can fix it without making it static? I've already tried making it static and it crashes the game.

 

My Main Mod Class (Only the part I need help with):

 

public static CommonProxy proxy;

 

public static EnumArmorMaterial hardcoreArmor = EnumHelper.addArmorMaterial("HARDCORE", 100, new int[]{6, 8, 12, 6}, 30);

 

int renderHardcore = proxy.addArmor("hardcoreArmor");

 

public static final Item hardcoreHelmet = new HardcoreArmor(5012, hardcoreArmor, renderHardcore, 0).setCreativeTab(HardcoreTab).setUnlocalizedName("hardcoreHelmet");

public static final Item hardcorePlate = new HardcoreArmor(5013, hardcoreArmor, renderHardcore, 1).setCreativeTab(HardcoreTab).setUnlocalizedName("hardcorePlate");

public static final Item hardcoreLegs = new HardcoreArmor(5014, hardcoreArmor, renderHardcore, 2).setCreativeTab(HardcoreTab).setUnlocalizedName("hardcoreLegs");

public static final Item hardcoreBoots = new HardcoreArmor(5015, hardcoreArmor, renderHardcore, 3).setCreativeTab(HardcoreTab).setUnlocalizedName("hardcoreBoots");

 

 

 

My Common Proxy:

 

package mc.Mitchellbrine.HardcoreNether.proxy;

 

public class CommonProxy {

public void registerRenderInformation() {}

 

    public int addArmor(String armor) { return 0; }

 

 

}

 

 

My ClientProxy:

 

package mc.Mitchellbrine.HardcoreNether.proxy;

 

import cpw.mods.fml.client.registry.RenderingRegistry;

 

public class ClientProxy extends CommonProxy{

 

@Override

public void registerRenderInformation() {

}

 

    @Override

    public int addArmor(String armor)

    {

        return RenderingRegistry.addNewArmourRendererPrefix(armor);

    }

}

 

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

I am actually having troubles with using this method. Is there any chance someone could fix the error I'm getting? It says that I cannot make a static reference to the field I'm using. I followed what you put down for the int entirely. Is there any way I can fix it without making it static? I've already tried making it static and it crashes the game.

 

My Main Mod Class (Only the part I need help with):

 

public static CommonProxy proxy;

 

public static EnumArmorMaterial hardcoreArmor = EnumHelper.addArmorMaterial("HARDCORE", 100, new int[]{6, 8, 12, 6}, 30);

 

int renderHardcore = proxy.addArmor("hardcoreArmor");

 

public static final Item hardcoreHelmet = new HardcoreArmor(5012, hardcoreArmor, renderHardcore, 0).setCreativeTab(HardcoreTab).setUnlocalizedName("hardcoreHelmet");

public static final Item hardcorePlate = new HardcoreArmor(5013, hardcoreArmor, renderHardcore, 1).setCreativeTab(HardcoreTab).setUnlocalizedName("hardcorePlate");

public static final Item hardcoreLegs = new HardcoreArmor(5014, hardcoreArmor, renderHardcore, 2).setCreativeTab(HardcoreTab).setUnlocalizedName("hardcoreLegs");

public static final Item hardcoreBoots = new HardcoreArmor(5015, hardcoreArmor, renderHardcore, 3).setCreativeTab(HardcoreTab).setUnlocalizedName("hardcoreBoots");

 

 

 

My Common Proxy:

 

package mc.Mitchellbrine.HardcoreNether.proxy;

 

public class CommonProxy {

public void registerRenderInformation() {}

 

    public int addArmor(String armor) { return 0; }

 

 

}

 

 

My ClientProxy:

 

package mc.Mitchellbrine.HardcoreNether.proxy;

 

import cpw.mods.fml.client.registry.RenderingRegistry;

 

public class ClientProxy extends CommonProxy{

 

@Override

public void registerRenderInformation() {

}

 

    @Override

    public int addArmor(String armor)

    {

        return RenderingRegistry.addNewArmourRendererPrefix(armor);

    }

}

 

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
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
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.