Jump to content

Custom Sword Error.


flamehougher

Recommended Posts

Well even though I had fixed the item problem I had(with the help of the kind people on the modder support) I have run into another problem  :'(

 

The problem is that when ever I try to make the sword do the thing where it starts up with the mod it says it can't be bound to ItemSword/ItemTool/Item/ANYTHING!!!!

 

Main Code

package mods.zanofite.common;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemTool;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Item;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="Zanofite", name = "Zanofite", version = "0.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Zanofite {

public static net.minecraft.item.Item ZanofiteItem;
int itemzanofite = 501;
public static net.minecraft.item.Item ZanofiteSword;
int itemzanofitesword = 502;


@Init	 
public void load(FMLInitializationEvent event){

ZanofiteItem = new ItemZanofite(501).setUnlocalizedName("Itemzanofite");
ZanoItemWork();

ZanofiteSword = new ItemZanosword(502).setUnlocalizedName("Zanofite Sword");
SwordWork();
}




private static void ZanoItemWork(){
GameRegistry.registerItem((net.minecraft.item.Item) ZanofiteItem, "ItemZanofite");
LanguageRegistry.addName(ZanofiteItem, "Zanofite Item");

}


private static void SwordWork(){
        //This is the Problem 
GameRegistry.registerItem((net.minecraft.item.ItemSword) ZanofiteSword, "ItemZanofite");
//This is the Problem           ^^^^^^^^^^^^^^^^^^^^
        LanguageRegistry.addName(ZanofiteSword, "Zanofite Sword");
}






}

 

Sword Code (works Fine)

 

package mods.zanofite.common;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.Item;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.Icon;

public class ItemZanosword extends Item{
	private int weaponDamage;

	public ItemZanosword(int id) {
		super(id);
		this.setCreativeTab(CreativeTabs.tabCombat);
		this.setMaxDamage(200);
		this.maxStackSize = 1;
		this.weaponDamage = 12;
	}


	public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
    {
        if (par2Block.blockID == Block.web.blockID)
        {
            return 15.0F;
        }
        else
        {
            Material var3 = par2Block.blockMaterial;
            return var3 != Material.plants && var3 != Material.vine && var3 != Material.coral && var3 != Material.leaves && var3 != Material.pumpkin ? 1.0F : 1.5F;
        }
    }

	public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
    {
        par1ItemStack.damageItem(1, par3EntityLiving);
        return true;
    }

	public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
    {
        if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
        {
            par1ItemStack.damageItem(2, par7EntityLiving);
        }

        return true;
    }

	public int getDamageVsEntity(Entity par1Entity)
    {
        return this.weaponDamage;
    }

	@SideOnly(Side.CLIENT)
	 public boolean isFull3D()
    {
        return true;
    }

	 public EnumAction getItemUseAction(ItemStack par1ItemStack)
	    {
	        return EnumAction.block;
	    }

	 public int getMaxItemUseDuration(ItemStack par1ItemStack)
	    {
	        return 2000;
	    }




	@SideOnly(Side.CLIENT)
	@Override
	public void updateIcons(IconRegister par1IconRegister){
		this.iconIndex=par1IconRegister.registerIcon("zanofite:zanofitesword1");
	}

	 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
	    {
	        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
	        return par1ItemStack;
	    }

	 public boolean canHarvestBlock(Block par1Block)
	    {
	        return par1Block.blockID == Block.web.blockID;
	    } 








}

 

 

It says

2013-04-01 15:33:19 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.1.8.611 for Minecraft 1.5.1 loading

2013-04-01 15:33:19 [iNFO] [ForgeModLoader] Java is Java HotSpot 64-Bit Server VM, version 1.7.0_17, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

2013-04-01 15:33:19 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

2013-04-01 15:33:21 [iNFO] [sTDOUT] 229 recipes

2013-04-01 15:33:21 [iNFO] [sTDOUT] 27 achievements

2013-04-01 15:33:21 [iNFO] [Minecraft-Client] Setting user: Player992

2013-04-01 15:33:21 [iNFO] [sTDOUT] (Session ID is -)

2013-04-01 15:33:21 [iNFO] [sTDERR] Client asked for parameter: server

2013-04-01 15:33:21 [iNFO] [Minecraft-Client] LWJGL Version: 2.4.2

2013-04-01 15:33:22 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization

2013-04-01 15:33:22 [iNFO] [sTDOUT] MinecraftForge v7.7.1.611 Initialized

2013-04-01 15:33:22 [iNFO] [ForgeModLoader] MinecraftForge v7.7.1.611 Initialized

2013-04-01 15:33:22 [iNFO] [sTDOUT] Replaced 85 ore recipies

2013-04-01 15:33:22 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization

2013-04-01 15:33:22 [iNFO] [ForgeModLoader] Reading custom logging properties from A:\Minecraft Mods\forge\mcp\jars\config\logging.properties

2013-04-01 15:33:22 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL

2013-04-01 15:33:22 [iNFO] [ForgeModLoader] Searching A:\Minecraft Mods\forge\mcp\jars\mods for mods

2013-04-01 15:33:24 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load

2013-04-01 15:33:24 [iNFO] [mcp] Activating mod mcp

2013-04-01 15:33:24 [iNFO] [FML] Activating mod FML

2013-04-01 15:33:24 [iNFO] [Forge] Activating mod Forge

2013-04-01 15:33:24 [iNFO] [Zanofite] Activating mod Zanofite

2013-04-01 15:33:24 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0

2013-04-01 15:33:24 [iNFO] [sTDOUT]

2013-04-01 15:33:24 [iNFO] [sTDOUT] Starting up SoundSystem...

2013-04-01 15:33:24 [iNFO] [sTDOUT] Initializing LWJGL OpenAL

2013-04-01 15:33:24 [iNFO] [sTDOUT]    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

2013-04-01 15:33:24 [iNFO] [sTDOUT] OpenAL initialized.

2013-04-01 15:33:25 [iNFO] [sTDOUT]

2013-04-01 15:33:25 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt

2013-04-01 15:33:25 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt

2013-04-01 15:33:25 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt

2013-04-01 15:33:25 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt

2013-04-01 15:33:25 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt

2013-04-01 15:33:25 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt

2013-04-01 15:33:25 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt

2013-04-01 15:33:26 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt

2013-04-01 15:33:26 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt

2013-04-01 15:33:26 [sEVERE] [ForgeModLoader] Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue

2013-04-01 15:33:26 [sEVERE] [ForgeModLoader]

mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized

Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized

Zanofite [Zanofite] (bin) Unloaded->Constructed->Pre-initialized->Errored

2013-04-01 15:33:26 [sEVERE] [ForgeModLoader] The following problems were captured during this phase

2013-04-01 15:33:26 [sEVERE] [ForgeModLoader] Caught exception from Zanofite

java.lang.ClassCastException: mods.zanofite.common.ItemZanosword cannot be cast to net.minecraft.item.ItemSword

at mods.zanofite.common.Zanofite.SwordWork(Zanofite.java:44)

at mods.zanofite.common.Zanofite.load(Zanofite.java:30)

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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515)

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.propogateStateMessage(LoadController.java:165)

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:98)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:689)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:206)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:444)

at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

at net.minecraft.client.Minecraft.run(Minecraft.java:729)

at java.lang.Thread.run(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] java.lang.ClassCastException: mods.zanofite.common.ItemZanosword cannot be cast to net.minecraft.item.ItemSword

2013-04-01 15:33:26 [iNFO] [sTDERR] at mods.zanofite.common.Zanofite.SwordWork(Zanofite.java:44)

2013-04-01 15:33:26 [iNFO] [sTDERR] at mods.zanofite.common.Zanofite.load(Zanofite.java:30)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-04-01 15:33:26 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-04-01 15:33:26 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-04-01 15:33:26 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)

2013-04-01 15:33:26 [iNFO] [sTDERR] at cpw.mods.fml.common.Loader.initializeMods(Loader.java:689)

2013-04-01 15:33:26 [iNFO] [sTDERR] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:206)

2013-04-01 15:33:26 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:444)

2013-04-01 15:33:26 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

2013-04-01 15:33:26 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:729)

2013-04-01 15:33:26 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

2013-04-01 15:33:55 [iNFO] [sTDERR] Someone is closing me!

Link to comment
Share on other sites

Hi!

 

I didn't read the code entirely, and although I don't know exactly how to fix the problem, maybe you don't need to deal with that problem at all, because usually implementing new swords is quite simple. And what strikes my eye about that line of code is the fact that you are trying to register your sword with the same name of an already registered item. Read on, nevertheless, because maybe you will decide to change the implementation of your sword after reading this:

 

Unless your ZanofiteSword does something that other swords don't, I dont think you need a class for implementing it. All you need is a new ToolMaterial.

 

You'd need a field like this:

 

public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial
                                                            (
                                                                "Zanofite",
                                                                [harvestLevel here (int)],
                                                                [maxUses here (int)],
                                                                [eficiency here (float)],
                                                                [damage here (int)],
                                                                [enchantability here (int)]
                                                            );

 

EnumHelper is a Forge class, meant to help us cheat on something: You can't extend an Enum type. Forge does it anyway through that class, using something called Reflection (which is basically the ability to inspect a type and change anything you want about in on runtime.)

 

As for the method EnumHelper.addToolMaterial, the arguments you need to pass are the propreties of the new ToolMaterial you are making up:

 

harvestLevel: It's an integer number that kinda says how strong are the tools made from this material when used to break other things and get their drop. This is how minecraft implements the "minimum tool material" you need to use to harvest something (for example, to harvest obsidian you need at least diamond). The harvestLevels for the minecraft existing ToolMaterials are:

 

WOOD = 0

GOLD = 0

STONE = 1

IRON = 2

EMERALD = 3 (this is the name of diamond as a ToolMaterial, for some reason)

 

maxUses: Another integer, it's how much damage your item can sustain before it breaks (-1 if unbreakable, I think. Not sure). For the vanilla ToolMaterials, these are the values:

 

GOLD = 32

WOOD = 59

STONE = 131

IRON = 250

EMERALD = 1561

 

eficiency: this is a float value that states how fast the tools made from this ToolMaterial harvest/break things. The vanilla values are listed below:

 

WOOD = 2.0

STONE = 4.0

IRON = 6.0

EMERALD = 8.0

GOLD = 12.0

 

damage: How much is the basic damage this ToolMaterial deals on things like mobs and players. Swords get like a greater multiplier (see ItemSword class to know exactly how that damage is altered before it turns into the sword's real damage). Again, the vanilla values:

 

WOOD = 0

GOLD = 0

STONE = 1

IRON = 2

EMERALD = 3

 

enchantability: That's another integer. It's used for calculating how strong are the enchantments you can get on a Tool when putting it on an enchanting table. The higher this number, the better the enchantments (other things as bookshelves around the enchanting table also aply, of course. I don't know what are the exact calculations minecraft does to select a random enchantment when you are using an enchanting table. All I know is that this number gets involved in the way i said).

 

To know more about the EnumToolMaterial enum go see it for yourself. It's fully qualified name is net.minecraft.item.EnumToolMaterial

 

So, basically, I think you should first add your new tool material and then you should make an ItemSword of that material. It should look something like this:

 

public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial
                                                            (
                                                                "Zanofite",
                                                                [harvestLevel here (int)],
                                                                [maxUses here (int)],
                                                                [eficiency here (float)],
                                                                [damage here (int)],
                                                                [enchantability here (int)]
                                                            );
public static final Item ZanofiteSword =
    (new ItemSword(itemzanofitesword, ZanofiteToolMaterial).setUnlocalizedName([your sword's unlocalized name here (String)]);

 

and as for registering it:

GameRegistry.registerItem(ZanofiteSword, [the same unlocalized name you gave to this sword before goes here]);
LanguageRegistry.addName(ZanofiteSword, [now the language name, the one that will show as the in-game sword's name]);

 

I think that's it. And I hope I didn't say something wrong. Please do check it all for yourself anyway, cause I may have made mistakes. Good Luck!

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Link to comment
Share on other sites

Haha!  :)

 

Thanks, I'm happy to hear that I helped! This community is helping me a lot for the past few days (I think it's been a week now since I started playing mod programmer). I want to help people too!

 

I was gonna write some sort of speach on how I love this forum (I actually deleted 5 lines of text that were already written). But I think it suffices to say: "I love this forum". As much as I love minecraft.

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Link to comment
Share on other sites

Okay I hate to bother people but I need help again, there are red lines under all of the comers,  ItemZanosword and the semi colon at the end of new item sword and I don't know what is wrong.

 

package mods.zanofite.common;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.Item;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.Icon;

public class ItemZanosword extends Item{
	//error^^^^^^^
public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial
            (
                "Zanofite",
                [harvestLevel (6)],//<error
                [maxUses (3000)],//<error
                [eficiency (12)],//<error
                [damage (6)],//<error
                [enchantability (21)]//<error
            );
public static final Item ZanofiteSword =
(new ItemSword(itemzanofitesword, ZanofiteToolMaterial).setUnlocalizedName(ZanofiteSword, "ZanofiteSword");//<error


}

 

By this I mean that it's telling me to create the class EnumHelper and all the damage Maxuses and all that needs to be created as a method and ItemZanoSword needs a constructor.

Link to comment
Share on other sites

Oh, first of all, when i wrote this:

 

public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial
            (
                "Zanofite",
                [harvestLevel (6)],//<error
                [maxUses (3000)],//<error
                [eficiency (12)],//<error
                [damage (6)],//<error
                [enchantability (21)]//<error
            );

 

What I meant by each of those error lines is that you should add your own value to them. I wrote things like that to make it clear what each argument meant. So that method should be invoked as follows:

 

public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial("Zanofite", 6, 3000, 12, 6, 21);

 

Also, notice that you dont need that ItemZanosword class. You can take a look at net.minecraft.item.Item class and check out how minecraft creates all swords (and other tools) by simply calling the proper constructor passing the id and the ToolMaterial as arguments.

 

You can do the same as minecraft does, like this for example:

 

@Mod(modid="Zanofite", name = "Zanofite", version = "0.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Zanofite {

        /* here are your IDs. But remember not to use those for other purpose than instantiating the items, because they
         * change internally. If you ever need to reference the ID of any Item use the field Item.itemID like this:
         * int zanoswordID = ZanofiteSword.itemID.*/
        private static final int itemzanofite = 501;
        private static final int itemzanofitesword = 502;

        /* Here is your ToolMaterial. You can make ItemSword, ItemAxe, ItemPickaxe, etc by passing this field as the second
         * argument to the constructor, just like we do it with the ZanofiteSword bellow.*/
        public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial("Zanofite", 6, 3000, 12, 6, 21);

public static final Item ZanofiteItem = new ItemZanofite(itemzanofite).setUnlocalizedName("Itemzanofite");

        /* And here is your ZanofiteSword.*/
public static final Item ZanofiteSword = 
                  (new ItemSword(itemzanofitesword, ZanofiteToolMaterial)).setUnlocalizedName(ZanofiteSword, "ZanofiteSword"));

        @Init
        public void load(FMLInitializationEvent event){
        ZanoItemWork();
        SwordWork();
        }

        /* And etc. Go on defining your ZanoItemWork and SwordWork methods for registering as before. Don't forget to use the
         * same unlocalized names that you gave to your items when instatiating them. */
}

 

Also, notice that whenever you need to access a static field/method of a class from outside that class, you need to prefix the field/method name with the name of the class. For example, addToolMaterial is a static method of the class EnumHelper, and this is why we have to write EnumHelper.addToolMaterial to invoke this method.

 

So, outside your Zanofite class, to access your sword and other static fields you have to write Zanofite.ZanofiteSword, Zanofite.ZanofiteItem and so on. I hope I was clearer this time. Sorry for omiting a few things last time.

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Link to comment
Share on other sites

Why would you move your files? Just read what I wrote and do that. It will work :)

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Link to comment
Share on other sites

Okay so i copied the code you put up word for word respectively and i get this

 

package mods.zanofite.common;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraftforge.common.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Item;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="Zanofite", name = "Zanofite", version = "0.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Zanofite {

public static final int itemzanofite = 501;
public static final int itemzanofitesword=502;



public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial("Zanofite", 6, 3000, 12, 6, 21);
public static final Item ZanofiteItem = new ItemZanofite(itemzanofite).setUnlocalizedName("Itemzanofite");
                                       //error^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type mismatch: cannot convert from Item to Mod.Item

public static final Item ZanofiteSword =
		(new ItemSword(itemzanofitesword, ZanofiteToolMaterial)).setUnlocalizedName(ZanofiteSword, "ZanofiteSword");
                                                                 //error^^^^^^^^^^^^^^^^^^^^^^^^^ Cannot reference a field before it is defined
@Init	 
public void load(FMLInitializationEvent event){

itemzanofite = new ItemZanofite(501).setUnlocalizedName("Itemzanofite");
			 //error^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Type mismatch: cannot convert from Item to int

ZanoItemWork();


}




private static void ZanoItemWork(){
GameRegistry.registerItem((net.minecraft.item.Item) itemzanofite, "ItemZanofite");
                        //error^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Cannot cast from int to Item
LanguageRegistry.addName(ZanofiteItem, "Zanofite Item");

}


private static void SwordWork(){
GameRegistry.registerItem((net.minecraft.item.ItemSword) ZanofiteSword, "ItemZanofite");
LanguageRegistry.addName(ZanofiteSword, "Zanofite Sword");
}






}

 

 

and the error when starting it is

 

2013-04-06 10:58:46 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.1.8.611 for Minecraft 1.5.1 loading

2013-04-06 10:58:46 [iNFO] [ForgeModLoader] Java is Java HotSpot 64-Bit Server VM, version 1.7.0_17, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

2013-04-06 10:58:46 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

2013-04-06 10:58:48 [iNFO] [sTDOUT] 229 recipes

2013-04-06 10:58:48 [iNFO] [sTDOUT] 27 achievements

2013-04-06 10:58:48 [iNFO] [Minecraft-Client] Setting user: Player824

2013-04-06 10:58:48 [iNFO] [sTDOUT] (Session ID is -)

2013-04-06 10:58:48 [iNFO] [sTDERR] Client asked for parameter: server

2013-04-06 10:58:48 [iNFO] [Minecraft-Client] LWJGL Version: 2.4.2

2013-04-06 10:58:49 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization

2013-04-06 10:58:49 [iNFO] [sTDOUT] MinecraftForge v7.7.1.611 Initialized

2013-04-06 10:58:49 [iNFO] [ForgeModLoader] MinecraftForge v7.7.1.611 Initialized

2013-04-06 10:58:49 [iNFO] [sTDOUT] Replaced 85 ore recipies

2013-04-06 10:58:49 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization

2013-04-06 10:58:49 [iNFO] [ForgeModLoader] Reading custom logging properties from A:\Minecraft Mods\forge\mcp\jars\config\logging.properties

2013-04-06 10:58:49 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL

2013-04-06 10:58:49 [iNFO] [ForgeModLoader] Searching A:\Minecraft Mods\forge\mcp\jars\mods for mods

2013-04-06 10:58:51 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load

2013-04-06 10:58:51 [iNFO] [mcp] Activating mod mcp

2013-04-06 10:58:51 [iNFO] [FML] Activating mod FML

2013-04-06 10:58:51 [iNFO] [Forge] Activating mod Forge

2013-04-06 10:58:51 [iNFO] [Zanofite] Activating mod Zanofite

2013-04-06 10:58:51 [iNFO] [sTDERR] Exception in thread "Minecraft main thread" java.lang.Error: Unresolved compilation problems:

2013-04-06 10:58:51 [iNFO] [sTDERR] Type mismatch: cannot convert from Item to Mod.Item

2013-04-06 10:58:51 [iNFO] [sTDERR] The method setUnlocalizedName(String) in the type Item is not applicable for the arguments (Mod.Item, String)

2013-04-06 10:58:51 [iNFO] [sTDERR] Cannot reference a field before it is defined

2013-04-06 10:58:51 [iNFO] [sTDERR] Type mismatch: cannot convert from Item to int

2013-04-06 10:58:51 [iNFO] [sTDERR] Cannot cast from int to Item

2013-04-06 10:58:51 [iNFO] [sTDERR]

2013-04-06 10:58:51 [iNFO] [sTDERR] at mods.zanofite.common.Zanofite.<init>(Zanofite.java:26)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at java.lang.reflect.Constructor.newInstance(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at java.lang.Class.newInstance0(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at java.lang.Class.newInstance(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer$JavaAdapter.getNewInstance(FMLModContainer.java:129)

2013-04-06 10:58:51 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:487)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-04-06 10:58:51 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-04-06 10:58:51 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-04-06 10:58:51 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)

2013-04-06 10:58:51 [iNFO] [sTDERR] at cpw.mods.fml.common.Loader.loadMods(Loader.java:502)

2013-04-06 10:58:51 [iNFO] [sTDERR] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:160)

2013-04-06 10:58:51 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:407)

2013-04-06 10:58:51 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

2013-04-06 10:58:51 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:729)

2013-04-06 10:58:51 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

2013-04-06 10:59:33 [iNFO] [sTDERR] Someone is closing me!

Link to comment
Share on other sites

the first two ints that you declare are for IDs, not Item information.

 

Also, your ZanofiteItem class might be importing the wrong Item class.

 

and setUnlocalizedName() should only need 1 argument.

Yes, my ideas can be naive. But I'm hoping that speaking my mind will inspire those who know what they are doing!

Link to comment
Share on other sites

Hi again! Don't copy things word by word. It's very likely people answering on these forums will make small errors like typos because in eclipse things like that are automatically corrected for you. Now, let's see those errors you're getting.

 

The first one is really strange but it's very easy to fix. Look at the beginning of your code. There are a lot of import statements up there. Import statements save you from having to call each type by it's fully qualified name all the time. The full name of a type (class or enum or whatever else Java has to offer as a type) is prefixed with the package that type belongs to. for example, minecraft class Item has this full name: net.minecraft.item.Item. And here's what's wrong! you are importing the wrong type. Look there, you are importing a class named Item that belongs to another package:

 

Change this:

import cpw.mods.fml.common.Mod.Item;

 

to this

import net.minecraft.item.Item;

 

Ok, the second error is a stupid error of mine. But this happens when you're outside an IDE. Just remove the reference to ZanofiteSword from the argument list of setUnlocalizedName. I don't even think that method has an overload that takes an Item reference as an argument. My bad:

 

Change this:

public static final Item ZanofiteSword =
		(new ItemSword(itemzanofitesword, ZanofiteToolMaterial)).setUnlocalizedName(ZanofiteSword, "ZanofiteSword");

 

To this:

public static final Item ZanofiteSword =
		(new ItemSword(itemzanofitesword, ZanofiteToolMaterial)).setUnlocalizedName("ZanofiteSword");

 

As for the third error, just remove that line entirely. Did I really write that? I'm sorry, sometimes I answer these from bed, just before going to sleep (which is the case now). That line doesn't make sense at all.

 

 

And the last one. You have a field named itemzanofite (the first field in your class) and it's an integer. The overload we want to use of the method GameRegistry.RegisterItem has the following signature:

 

void GameRegistry.RegisterItem(net.minecraft.item.Item arg0, String arg1)

 

(don't copy-paste that anywhere, I'm just making a point). Which means it expects an Item as first argument and a String as its second argument. So, instead of passing your int field, you need to pass your actual Item field:

 

Change this:

GameRegistry.registerItem((net.minecraft.item.Item) itemzanofite, "ItemZanofite");

 

To this:

GameRegistry.registerItem(ZanofiteItem, "Itemzanofite");

 

(Also notice the different casing in the String passed as second argument. You have to use the same string you passed to setUnlocalizedName)

 

AND finally, don't forget to invoke your SwordWork method from inside the load method. As it is now, that method never get's invoked and it's work is never done. So your sword is never properly registered. Add this line to the load method:

 

SwordWork();

 

That's it. I hope it works now, but if it doesn't work because of minor errors like those you had before applying these corrections, it's probably gonna be easier to figure out what's wrong and fix them after reading this post. Good Luck!

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Link to comment
Share on other sites

  • 2 weeks later...

Yay i now have a sword that dose damage but its problem now is the texture is missing and wont do anything and i have know idea why it is doing this or what part of code it making it do this and it says the texture ZanofieSword.png is missing but its not, it scans right over it and goes here it..........wait here is no texture while holding it arg im gonna smash my computer soon pleas help....... :'(

 

 

2013-04-14 16:40:14 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.1.8.611 for Minecraft 1.5.1 loading

2013-04-14 16:40:14 [iNFO] [ForgeModLoader] Java is Java HotSpot 64-Bit Server VM, version 1.7.0_17, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

2013-04-14 16:40:14 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

2013-04-14 16:40:17 [iNFO] [sTDOUT] 229 recipes

2013-04-14 16:40:17 [iNFO] [sTDOUT] 27 achievements

2013-04-14 16:40:17 [iNFO] [Minecraft-Client] Setting user: Player288

2013-04-14 16:40:17 [iNFO] [sTDOUT] (Session ID is -)

2013-04-14 16:40:17 [iNFO] [sTDERR] Client asked for parameter: server

2013-04-14 16:40:17 [iNFO] [Minecraft-Client] LWJGL Version: 2.4.2

2013-04-14 16:40:17 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization

2013-04-14 16:40:17 [iNFO] [sTDOUT] MinecraftForge v7.7.1.611 Initialized

2013-04-14 16:40:17 [iNFO] [ForgeModLoader] MinecraftForge v7.7.1.611 Initialized

2013-04-14 16:40:17 [iNFO] [sTDOUT] Replaced 85 ore recipies

2013-04-14 16:40:17 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization

2013-04-14 16:40:17 [iNFO] [ForgeModLoader] Reading custom logging properties from A:\Minecraft Mods\forge\mcp\jars\config\logging.properties

2013-04-14 16:40:17 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL

2013-04-14 16:40:18 [iNFO] [ForgeModLoader] Searching A:\Minecraft Mods\forge\mcp\jars\mods for mods

2013-04-14 16:40:19 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load

2013-04-14 16:40:19 [iNFO] [mcp] Activating mod mcp

2013-04-14 16:40:19 [iNFO] [FML] Activating mod FML

2013-04-14 16:40:19 [iNFO] [Forge] Activating mod Forge

2013-04-14 16:40:19 [iNFO] [Zanofite] Activating mod Zanofite

2013-04-14 16:40:19 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0

2013-04-14 16:40:19 [iNFO] [sTDOUT]

2013-04-14 16:40:19 [iNFO] [sTDOUT] Starting up SoundSystem...

2013-04-14 16:40:20 [iNFO] [sTDOUT] Initializing LWJGL OpenAL

2013-04-14 16:40:20 [iNFO] [sTDOUT]    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

2013-04-14 16:40:20 [iNFO] [sTDOUT] OpenAL initialized.

2013-04-14 16:40:20 [iNFO] [sTDOUT]

2013-04-14 16:40:21 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt

2013-04-14 16:40:21 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt

2013-04-14 16:40:21 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt

2013-04-14 16:40:21 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt

2013-04-14 16:40:21 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt

2013-04-14 16:40:21 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt

2013-04-14 16:40:21 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt

2013-04-14 16:40:21 [WARNING] [Minecraft-Client] TextureManager.createTexture called for file textures/items/ZanofiteSword.png, but that file does not exist. Ignoring.

2013-04-14 16:40:22 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt

2013-04-14 16:40:22 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt

2013-04-14 16:40:22 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods

2013-04-14 16:40:23 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt

2013-04-14 16:40:23 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt

2013-04-14 16:40:23 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt

2013-04-14 16:40:23 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt

2013-04-14 16:40:23 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt

2013-04-14 16:40:23 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt

2013-04-14 16:40:23 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt

2013-04-14 16:40:24 [WARNING] [Minecraft-Client] TextureManager.createTexture called for file textures/items/ZanofiteSword.png, but that file does not exist. Ignoring.

2013-04-14 16:40:24 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt

2013-04-14 16:40:24 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt

2013-04-14 16:40:30 [iNFO] [Minecraft-Server] Starting integrated minecraft server version 1.5.1

2013-04-14 16:40:30 [iNFO] [Minecraft-Server] Generating keypair

2013-04-14 16:40:30 [iNFO] [ForgeModLoader] Loading dimension 0 (iofhwofhiogj) (net.minecraft.server.integrated.IntegratedServer@a2d7196)

2013-04-14 16:40:30 [iNFO] [ForgeModLoader] Loading dimension 1 (iofhwofhiogj) (net.minecraft.server.integrated.IntegratedServer@a2d7196)

2013-04-14 16:40:30 [iNFO] [ForgeModLoader] Loading dimension -1 (iofhwofhiogj) (net.minecraft.server.integrated.IntegratedServer@a2d7196)

2013-04-14 16:40:30 [iNFO] [Minecraft-Server] Preparing start region for level 0

2013-04-14 16:40:31 [iNFO] [sTDOUT] loading single player

2013-04-14 16:40:31 [iNFO] [Minecraft-Server] Player288[/127.0.0.1:0] logged in with entity id 419 at (284.5841735841933, 86.0, 243.40259854562922)

2013-04-14 16:40:38 [iNFO] [Minecraft-Server] Saving and pausing game...

2013-04-14 16:40:38 [iNFO] [Minecraft-Server] Saving chunks for level 'iofhwofhiogj'/Overworld

2013-04-14 16:40:38 [iNFO] [Minecraft-Server] Saving chunks for level 'iofhwofhiogj'/Nether

2013-04-14 16:40:38 [iNFO] [Minecraft-Server] Saving chunks for level 'iofhwofhiogj'/The End

2013-04-14 16:40:39 [iNFO] [Minecraft-Server] Stopping server

2013-04-14 16:40:39 [iNFO] [Minecraft-Server] Saving players

2013-04-14 16:40:39 [iNFO] [Minecraft-Server] Saving worlds

2013-04-14 16:40:39 [iNFO] [Minecraft-Server] Saving chunks for level 'iofhwofhiogj'/Overworld

2013-04-14 16:40:39 [iNFO] [Minecraft-Server] Saving chunks for level 'iofhwofhiogj'/Nether

2013-04-14 16:40:39 [iNFO] [Minecraft-Server] Saving chunks for level 'iofhwofhiogj'/The End

2013-04-14 16:40:40 [iNFO] [ForgeModLoader] Unloading dimension 0

2013-04-14 16:40:40 [iNFO] [ForgeModLoader] Unloading dimension -1

2013-04-14 16:40:40 [iNFO] [ForgeModLoader] Unloading dimension 1

2013-04-14 16:40:42 [iNFO] [Minecraft-Client] Stopping!

2013-04-14 16:40:42 [iNFO] [sTDOUT]

2013-04-14 16:40:42 [iNFO] [sTDOUT] SoundSystem shutting down...

2013-04-14 16:40:42 [iNFO] [sTDOUT]    Author: Paul Lamb, www.paulscode.com

2013-04-14 16:40:42 [iNFO] [sTDOUT]

 

 

package mods.zanofite.common;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSword;
import net.minecraftforge.common.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="Zanofite", name = "Zanofite", version = "0.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Zanofite {

public static final int itemzanofite = 501;
public static final int itemzanofitesword=502;



public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial("Zanofite", 6, 3000, 12, 6, 21);
public static final Item ZanofiteItem = new ItemZanofite(itemzanofite).setUnlocalizedName("Itemzanofite");
                                       
public static final Item ZanofiteSword = new ItemSword(itemzanofitesword, ZanofiteToolMaterial).setUnlocalizedName("ZanofiteSword");
                                                                 
@Init	 
public void load(FMLInitializationEvent event){

ZanoItemWork();
SwordWork();

}




private static void ZanoItemWork(){
                        
LanguageRegistry.addName(ZanofiteItem, "Zanofite Item");

}


private static void SwordWork(){
GameRegistry.registerItem((net.minecraft.item.ItemSword) ZanofiteSword, "ZanofiteSword");
LanguageRegistry.addName(ZanofiteSword, "Zanofite Sword");



}






}

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.