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

[Unsolved] How to make an armor using Forge for SMP?


Soviet
 Share

Recommended Posts

Hello again,

 

I would like some help to make my mod working on SMP.

According to the previous topic, http://www.minecraftforge.net/forum/index.php/topic,3053.msg20596.html#msg20596, all you need to do is to put your mod in the server and that's fine. Well, not for me. In solo, mod works fine and does not crash. I get immediate crash when trying to set it up on SMP. I used the Forge ModLoader to load my mod. Here's the log:

 

 

 

---- Minecraft Crash Report ----

// Ooh. Shiny.

 

Time: 30/06/13 00:23

Description: Exception in server tick loop

 

java.lang.NoSuchMethodError: net.minecraft.src.ModLoader.addArmor(Ljava/lang/String;)I

at s0vietique.alloycraft.client.Alloycraft.<clinit>(Alloycraft.java:55)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:425)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:103)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:504)

at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:85)

at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:350)

at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:69)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:431)

at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:573)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.5.2

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.7.0_25, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode, sharing), Oracle Corporation

Memory: 27327992 bytes (26 MB) / 48537600 bytes (46 MB) up to 259522560 bytes (247 MB)

JVM Flags: 0 total;

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Suspicious classes: FML and Forge are installed

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v7.51 FML v5.2.23.737 Minecraft Forge 7.8.1.737 4 mods loaded, 4 mods active

mcp{7.51} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed

FML{5.2.23.737} [Forge Mod Loader] (coremods) Unloaded->Constructed

Forge{7.8.1.737} [Minecraft Forge] (coremods) Unloaded->Constructed

Alloycraft{0.5 BETA} [Alloycraft] (Alloycraft 1-5-2.zip) Unloaded

Profiler Position: N/A (disabled)

Is Modded: Definitely; Server brand changed to 'fml,forge'

Type: Dedicated Server (map_server.txt)

 

 

 

From what I read, it has trouble with the armor adding by ModLoader.

Here are the culprits:

 



public final static Item bootsCopper = new SovCopperBoots(912, CopperArmorMaterial, ModLoader.addArmor("copper"), 3).setUnlocalizedName("copperBoots").setCreativeTab(CreativeTabs.tabCombat);
		public final static Item leggingsCopper = new SovCopperLeggings(913, CopperArmorMaterial, ModLoader.addArmor("copper"), 2).setUnlocalizedName("copperLegging").setCreativeTab(CreativeTabs.tabCombat);
		public final static Item chestCopper = new SovCopperChest(914, CopperArmorMaterial, ModLoader.addArmor("copper"), 1).setUnlocalizedName("copperChest").setCreativeTab(CreativeTabs.tabCombat);
		public final static Item helmetCopper = new SovCopperHelmet(915, CopperArmorMaterial, ModLoader.addArmor("copper"), 0).setUnlocalizedName("copperHelmet").setCreativeTab(CreativeTabs.tabCombat);

public final static Item bootsSteel = new SovSteelBoots(908, steelArmorMaterial2, ModLoader.addArmor("steel"), 3).setUnlocalizedName("steelBoots").setCreativeTab(CreativeTabs.tabCombat);
		public final static Item leggingsSteel = new SovSteelLeggings(909, steelArmorMaterial2, ModLoader.addArmor("steel"), 2).setUnlocalizedName("steelLegging").setCreativeTab(CreativeTabs.tabCombat);
		public final static Item chestSteel = new SovSteelChest(910, steelArmorMaterial2, ModLoader.addArmor("steel"), 1).setUnlocalizedName("steelChest").setCreativeTab(CreativeTabs.tabCombat);
		public final static Item helmetSteel = new SovSteelHelmet(911, steelArmorMaterial2, ModLoader.addArmor("steel"), 0).setUnlocalizedName("steelHelmet").setCreativeTab(CreativeTabs.tabCombat);

 

 

Can anyone give a hand? Thanks by advance.

Link to comment
Share on other sites

I don't know if it helps, but when I put my mod in "coremods" instead of "mods" in my server folders, the server doesn't crash anymore. But! When I try to place a block from my mod, it instantly disappears (spawn protection not counted) and is removed from my inventory. Also, I don't see any traces of my custom ores...

Link to comment
Share on other sites

Here's the code I use to register armor in Forge:

 

public static Item gemChest = new GemChest(5004, EnumArmorMaterial.IRON, 2, 1).setUnlocalizedName("gemChest");
Registration.itemRegistration(gemChest, "Gem Chest");

public static void itemRegistration(Item par1, String par2)
  {
	  GameRegistry.registerItem(par1, par2);
      LanguageRegistry.addName(par1, par2);
  }

Link to comment
Share on other sites

I used the tutorial by TheGrovesyProject101. It uses a deprecated class, but it works.

 

Doesn't work.

Here's the code I use to register armor in Forge:

 

public static Item gemChest = new GemChest(5004, EnumArmorMaterial.IRON, 2, 1).setUnlocalizedName("gemChest");
Registration.itemRegistration(gemChest, "Gem Chest");

public static void itemRegistration(Item par1, String par2)
  {
	  GameRegistry.registerItem(par1, par2);
      LanguageRegistry.addName(par1, par2);
  }

 

I want to do an armor with custom textures. I don't want it to have iron textures.

Link to comment
Share on other sites

No problem, just override the texture in the item class:

@Override
        public String getArmorTextureFile(ItemStack itemstack) 
        {
                        return "/mods/Amanus/textures/gemArmor.png";
        }

Link to comment
Share on other sites

No problem, just override the texture in the item class:

@Override
        public String getArmorTextureFile(ItemStack itemstack) 
        {
                        return "/mods/Amanus/textures/gemArmor.png";
        }

 

I mean, my items are textured. It's when worn they aren't.

Link to comment
Share on other sites

I did like you said, I still get iron texture.

 

Pretty sure you method works but what do I have to change ?

Here's a sample of my code:

public final static Item bootsSteel = new SovSteelBoots(908, steelArmorMaterial2, 2, 3).setUnlocalizedName("steelBoots").setCreativeTab(CreativeTabs.tabCombat);

So, 2 is the iron texture. What do I replace it with ?

Link to comment
Share on other sites

In the new version you have to use the getArmorTexture() function from the Item class to your armor item calss.Here is an example on how to use it:(took from my own mod)

 

 

 

package mods.GeoActivity.common.items.armor;

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.IArmorTextureProvider;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ReinforcedBoots extends ItemArmor
{
    public ReinforcedBoots(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4)
    {
        super(par1, par2EnumArmorMaterial, par3, par4);
    }

    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
    {
        return "/mods/GeoActivity/textures/armor1.png"; //path to the armor texture that is rendered on the player, see the Vanilla textures
    }

    @SideOnly(Side.CLIENT)
    public void registerIcons(IconRegister icon)
    {
             this.itemIcon = icon.registerIcon("GeoActivity:reinforced_boots"); // the texture of the item in inventory
    }
}

 

 

 

Also when you register the armor you have to do it like so:

 

reinforcedBoots = new ReinforcedBoots(reBoots, ReinforcedArmorMaterial, RenderingRegistry.addNewArmourRendererPrefix("reinforced"), 3).setUnlocalizedName("reinforcedboots").setCreativeTab(CreativeTabs.tabCombat);

 

Notice the RenderingRegistry added there with a custom name you want.

It works perfectly fine for me, with no errors.

Link to comment
Share on other sites

In the new version you have to use the getArmorTexture() function from the Item class to your armor item calss.Here is an example on how to use it:(took from my own mod)

 

 

 

package mods.GeoActivity.common.items.armor;

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.IArmorTextureProvider;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ReinforcedBoots extends ItemArmor
{
    public ReinforcedBoots(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4)
    {
        super(par1, par2EnumArmorMaterial, par3, par4);
    }

    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
    {
        return "/mods/GeoActivity/textures/armor1.png"; //path to the armor texture that is rendered on the player, see the Vanilla textures
    }

    @SideOnly(Side.CLIENT)
    public void registerIcons(IconRegister icon)
    {
             this.itemIcon = icon.registerIcon("GeoActivity:reinforced_boots"); // the texture of the item in inventory
    }
}

 

 

 

Also when you register the armor you have to do it like so:

 

reinforcedBoots = new ReinforcedBoots(reBoots, ReinforcedArmorMaterial, RenderingRegistry.addNewArmourRendererPrefix("reinforced"), 3).setUnlocalizedName("reinforcedboots").setCreativeTab(CreativeTabs.tabCombat);

 

Notice the RenderingRegistry added there with a custom name you want.

It works perfectly fine for me, with no errors.

 

I used your methods and yes, it works. Problem is, it still crashes my server.jar:

 

 

---- Minecraft Crash Report ----

// You're mean.

 

Time: 30/06/13 22:25

Description: Exception in server tick loop

 

java.lang.NoClassDefFoundError: net/minecraft/client/renderer/entity/RenderPlayer

at cpw.mods.fml.client.registry.RenderingRegistry.addNewArmourRendererPrefix(RenderingRegistry.java:51)

at s0vietique.alloycraft.client.Alloycraft.<clinit>(Alloycraft.java:56)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:425)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:103)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:504)

at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:85)

at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:350)

at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:69)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:431)

at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:573)

Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.entity.RenderPlayer

at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:238)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 32 more

Caused by: java.lang.RuntimeException: Attempted to load class bht for invalid side SERVER

at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50)

at cpw.mods.fml.relauncher.RelaunchClassLoader.runTransformers(RelaunchClassLoader.java:352)

at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:225)

... 34 more

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.5.2

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.7.0_25, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode, sharing), Oracle Corporation

Memory: 20077712 bytes (19 MB) / 50151424 bytes (47 MB) up to 259522560 bytes (247 MB)

JVM Flags: 0 total;

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Suspicious classes: FML and Forge are installed

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v7.51 FML v5.2.23.737 Minecraft Forge 7.8.1.737 4 mods loaded, 4 mods active

mcp{7.51} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed

FML{5.2.23.737} [Forge Mod Loader] (coremods) Unloaded->Constructed

Forge{7.8.1.737} [Minecraft Forge] (coremods) Unloaded->Constructed

Alloycraft{0.5 BETA} [Alloycraft] (Alloycraft 1-5-2.zip) Unloaded

Profiler Position: N/A (disabled)

Is Modded: Definitely; Server brand changed to 'fml,forge'

Type: Dedicated Server (map_server.txt)

 

 

Link to comment
Share on other sites

Bump... Please, I don't understand what I have to do to make it work on SMP.

Line 56 of Alloycraft is...?

 

public final static Item bootsSteel = new SovSteelBoots(908, steelArmorMaterial2, RenderingRegistry.addNewArmourRendererPrefix("steel"), 3).setUnlocalizedName("steelBoots").setCreativeTab(CreativeTabs.tabCombat);

This is the first armor line in my main class.

Link to comment
Share on other sites

Bump... Please, I don't understand what I have to do to make it work on SMP.

Line 56 of Alloycraft is...?

 

public final static Item bootsSteel = new SovSteelBoots(908, steelArmorMaterial2, RenderingRegistry.addNewArmourRendererPrefix("steel"), 3).setUnlocalizedName("steelBoots").setCreativeTab(CreativeTabs.tabCombat);

This is the first armor line in my main class.

Oh. Right. Erm, Decebal²? Where are you calling that? Because it's client-only.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Link to comment
Share on other sites

my mod use proxy's but i can tell your how i make mine work step by step and if that don't work your can pm me your skype and i can explain it to your

1. we need the client so we are gonna put

   public static int addArmor(String Armor){
        return 0;
    }

in the commonproxy

the server do not need it so that's why commonproxy will return 0

2. add the same code in your client proxy but this time it is going to return RenderingRegistry.addNewArmourRendererPrefix(armor) insted of 0

    public static int addArmor(String armor){
        return RenderingRegistry.addNewArmourRendererPrefix(armor);
    }

3. now to use this code in a item your are simple just gonna add it like this

Name = new Armorclass(id, Enum, CommonProxy.addArmor("add something here"), 0);

4. now we need the armor to show up but i think your all ready now that so just say if your need more help (or as i said before pm me your skype)

 

edit--

feel free to look at my mods github to see with 100% how i make armor work with forge and SMP

https://github.com/henrikse55/Item-Pack

Link to comment
Share on other sites

Easy fix use this:

 

Base Class

Static:

public static EnumArmorMaterial BRONZE = EnumHelper.addArmorMaterial("BRONZE", 8,  new int[]{2, 6, 4, 2}, 5);

Load:

BronzePlateChest = new BronzeArmor(2016,  Core.BRONZE, proxy.addArmor("Bronze Platechest"), 1).setUnlocalizedName("CyphScape_BronzeChestPlate");

 

Armor Class:

package mods.cyphereion.cyphscape.core;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.IArmorTextureProvider;

public class BronzeArmor extends ItemArmor implements IArmorTextureProvider{

public BronzeArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial,
		int par3, int par4) {
	super(par1, par2EnumArmorMaterial, par3, par4);
	this.setCreativeTab(Core.tabCyphScape);
}

@Override
public String getArmorTextureFile(ItemStack itemstack) {
	if(itemstack.itemID == Core.BronzeFullHelmet.itemID || itemstack.itemID == Core.BronzePlateChest.itemID || itemstack.itemID == Core.BronzeBoots.itemID){
	return "/textures/armor/Bronze_1.png";
	}

	if(itemstack.itemID == Core.BronzePlateLegs.itemID){
		return "/textures/armor/Bronze_2.png";
	}

	else return null;

}

}

 

That is literally it. And btw try to avoid modloader methods, those need modloader mp to work. Forge has built in multiplayer so stick with that.

 

Whoops forgot. Here it is now :3

 

Client Proxy:

	public int addArmor(String armor){
	return RenderingRegistry.addNewArmourRendererPrefix(armor);
}

 

 

Common Proxy:

public static int addArmor(String Armor){
        return 0;
    }

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



×
×
  • Create New...

Important Information

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