Jump to content

SandStoneItems


tminor1

Recommended Posts

Hi so I am trying to learn how to make mods with minecraft forge. So i decided to start simple with adding a new item to the game. So I found thins page that I used to help me. http://www.minecraftforum.net/forums/archive/tutorials/930012-creating-mods-minecraft-forge-28-1-12

 

So I used that page to try to add a new pickaxe to the game that is made out of sandstone. I don't have crafting for it yet I just wanted to see if I could add it. I will try to get the crafting working after I at least can get the item in the game.  Here is the code.

 

This is for Mod.java

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

package net.minecraft.src;

 

import net.minecraft.src.forge.*;

 

public class mod_SandItems extends BaseMod

{

static EnumToolMaterial toolTITANIUM = EnumHelper.addToolMaterial("TITANIUM", 2, 500, 7F, 3, 9);

public static final Item sandstonePickaxe = (new SandstonePickaxe(999, toolTITANIUM)).setIconCoord(0, 3).setItemName("sandstonePickaxe");

 

public mod_SandItems()

{

 

}

 

public void load()

{

MinecraftForgeClient.preloadTexture("/SandTtems/Texture/Pick.png");

MinecraftForge.setToolClass(sandPick, "pickaxe", 2);

}

 

public String getVersion() {

return "1.0.0";

}

 

}

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is for SandPick.java

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

package net.minecraft.src;

 

import net.minecraft.src.forge.*;

 

public class SandPick extends ItemPickaxe implements ITextureProvider

{

 

protected ItemPickaxe(int i, EnumToolMaterial enumtoolmaterial)

{

super(i, enumtoolmaterial);

}

 

public String getTextureFile()

{

return "/SandItems/Texture/Pick.png";

}

 

}

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

So after I got all that the next thing I needed to do was convert the .java files in to .class files then put them in to a .jar file. However when I run the javac command it gives me an error like this. error: Class names, 'Mod' , are only accepted if annotation processing is explicitly requested.

 

I don't know why. Also if there is anything I need to add to my code pleas tell me.

Link to comment
Share on other sites

First of all you asking me how was i even able to use it. I don't know if it would even work when I use the -javac command it gives me that error. I need to convert the java files to class files to put them in a .jar file. Also I don't use eclips. It takes up a lot of memory. And you can use cmd and the -javac command to convert .java files in to .class. but it gives me that error. So if it was giving that error with cmd I don't see how eclips would have any different outcome. As for that page I found it was the first thing I found that would help me add items. I am using 1.7.2. I mainly want to know why it gives me that error when I try to convert the .java files for my mod to .class files. No where on any how to that I found does it tell you how to do that and tell you what to do if you get an error.

Link to comment
Share on other sites

First of all, I would defiantly recommend using Eclipse, it does not take up that much memory.

 

Second of all, I would recommend going here http://www.wuppy29.com/minecraft/modding-tutorials/forge-modding-1-7/#sthash.cce4kN9Y.dpbs, they are tutorials by a modder called Wuppy, they are great for beginners and even advanced modders!

 

I hope I can help and if you need any more help just let me know! :)

Link to comment
Share on other sites

Hey so I don't have eclipse working but I was just looking online for some help that was for 1.7.2 and I found this. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571559-1-7-2-source-code-forge-modding-tutorials

 

Then I made these.

~~~~~~~~~~~~~~~~~~~~~

Mod.java

~~~~~~~~~~~~~~~~~~~~~

package net.sandItems.mod;

 

import cpw.mods.fml.common.Mod;

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

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import net.sandIems.mod.SandPick;

import net.minecraft.creativetab.CreativeTabs;

 

@Mod(modid = SandItems.modid, version = SandItems.version)

public class Mod

{

public static final String modid = "SandItems";

public static final String version = "0.1 MC1.7.2";

 

@EventHandler

{

public static final Item.ToolMaterial CUSTOM = EnumHelper.addToolMaterial("CUSTOM", 2, 131, 1.0F, 1.5F, 5);

public void preInit(FMLPreInitializationEvent event)

}

@EventHandler

public void preInit(FMLPreInitializationEvent event)

{

SandPickaxe = new CustomPickaxe(CUSTOM).setUnlocalizedName("SandPickaxe").setCreativeTab (CreativTabs.tabTools).setTextureName("Pick");

GameRegistry.registerItem(SandPickaxe, "SandPickaxe")

}

 

}

 

~~~~~~~~~~~~~~~

SandPick.java

~~~~~~~~~~~~~~~

package net.sandItems.mod;

 

import net.minecraft.item.ItemPickaxe;

import net.minecraft.item.Item.ToolMaterial;

 

public class SandPick extends ItemPickaxe

{

public CustomPickaxe(ToolMaterial material)

{

super(material);

}

}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So again I wanted to see if this code would work. So I decided I was going to compile Mod.java first then SandPick.java. However when I got on cmd and typed javac Mod it gave me that same error that I posted about above.

Link to comment
Share on other sites

I'm with tattyseal and Elyon on this one, you should definitely use Eclipse rather than manually using javac. But, if you do insist on keeping on with that method, the tutorials by Wuppy posted above are pretty good, you should read those.

Link to comment
Share on other sites

Well I got eclipse working and I am using it to fix up my code but there is one problem. Most of the problems that I am getting is that eclipse needs to reed the code from minecraft and minecraft forge. I can get the minecraft code from MCP. but how do I get the forge code?

Link to comment
Share on other sites

Ok so I ran ForgeGradlew.bat. It did some things then told me this "Cannot find System Java Compiler. Ensure that you have installed JDK (not just a JRE) and configure your JAVA_HOME system variable to point to the according directory." Well I do have JDK installed and I have it in my system path like this.  "c:\Program Files (x86)\Java\jdk1.7.0_45\bin" Is this wrong? Do I need to change or add something? What do I need to do to make this work because Eclipse works fine and so does MCP so why is this happening?

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.