Jump to content

Create a sword


Eaglenator

Recommended Posts

package example.items;

 

import net.minecraft.block.Block;

import net.minecraft.item.EnumToolMaterial;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemSword;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

public class Items {

 

public static void init() {

    EspadaDeObsidiana = new ItemSword(ItemInfo.WAND_ID, EnumToolMaterial);

 

}

 

public static Item EspadaDeObsidiana;

public static void addNames() {

LanguageRegistry.addName(new ItemStack(EspadaDeObsidiana, 1), ItemInfo.WAND_NAME);

}

 

public static void registerRecipes() {

GameRegistry.addRecipe(new ItemStack (EspadaDeObsidiana, 1),

    new Object[] {  " O ",

                    " O ",

                    " / ",

 

 

                    'O', Block.obsidian,

                    '/', Item.stick,

 

            });

  }

 

}

 

 

                   

                   

what I can write in the part:

 

public static void init() {

    EspadaDeObsidiana = new ItemSword(ItemInfo.WAND_ID, (here));

 

appear error in that part, I think I must write EnumToolMaterial, but the recipe uses Obsidian, the obsidian is not in the type EnumToolMaterial, what can I do?

Link to comment
Share on other sites

1. Use code tags or paste code into https://gist.github.com/ (with JAVA syntax highlighting!).

 

2. When you have an error, you should always mention what the error says.

 

 

Now I'll look into your error :)

You aren't going to like what I have to say though :(

You're problem is unrelated to Minecraft's code, even to forge.

The main problem you are having right now is with basic programming logic and Java syntax.

It may be a simple typo, but then you would have realized by the error message, combined with your other code I'm sure in my assesment.

 

Most people will just ignore such advise, but if you care to learn see below :P

 

 

I don't believe in 14 year olds on youtube rambling on about java basics, simply because they tend to do one or more of the following:

Skip important things.

Lack real insight in what they are teaching and why (Aka. Do this, don't care why, it just works!)

Lacks a proper learning path and progression towards terminology, programming and logic design which are your goals to learn when learning a programming language, is it not? :P

Now I've found some exceptions to this, and you may find things that suit you better.

But I do whole heartedly recommend the course I'm linking below.

 

CS106A - Programming Methodology

It's a professional beginner course in programming, focused in Java.

100% Free course, made by Stanford university. No real pre-requisites to taking the course and it's just like the real course.

The real course was filmed and all the lecture videos are available along with all handouts and other materials given (Including their modified eclipse version, and example exams!).

 

From experience I can promise you that you will NOT be wasting your time by doing this first, you will be modding so much faster after mastering the basics that you will wonder why you didn't do this earlier. It's a small time to spend learning the basics compared to the time you waste struggling with simple things if you don't ;)

 

Anyways here's the link; use it as you wish and good luck to you!

http://see.stanford.edu/see/lecturelist.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111

 

PS:

Have fun coding!

 

 

 

PPS:

You are doing

Class = new ItemSword(/*args */);

you can't set a class to something.

You need to set the variable, not the class ;)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

1. Use code tags or paste code into https://gist.github.com/ (with JAVA syntax highlighting!).

 

2. When you have an error, you should always mention what the error says.

 

 

Now I'll look into your error :)

You aren't going to like what I have to say though :(

You're problem is unrelated to Minecraft's code, even to forge.

The main problem you are having right now is with basic programming logic and Java syntax.

It may be a simple typo, but then you would have realized by the error message, combined with your other code I'm sure in my assesment.

 

Most people will just ignore such advise, but if you care to learn see below :P

 

 

I don't believe in 14 year olds on youtube rambling on about java basics, simply because they tend to do one or more of the following:

Skip important things.

Lack real insight in what they are teaching and why (Aka. Do this, don't care why, it just works!)

Lacks a proper learning path and progression towards terminology, programming and logic design which are your goals to learn when learning a programming language, is it not? :P

Now I've found some exceptions to this, and you may find things that suit you better.

But I do whole heartedly recommend the course I'm linking below.

 

CS106A - Programming Methodology

It's a professional beginner course in programming, focused in Java.

100% Free course, made by Stanford university. No real pre-requisites to taking the course and it's just like the real course.

The real course was filmed and all the lecture videos are available along with all handouts and other materials given (Including their modified eclipse version, and example exams!).

 

From experience I can promise you that you will NOT be wasting your time by doing this first, you will be modding so much faster after mastering the basics that you will wonder why you didn't do this earlier. It's a small time to spend learning the basics compared to the time you waste struggling with simple things if you don't ;)

 

Anyways here's the link; use it as you wish and good luck to you!

http://see.stanford.edu/see/lecturelist.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111

 

PS:

Have fun coding!

 

 

 

PPS:

You are doing

Class = new ItemSword(/*args */);

you can't set a class to something.

You need to set the variable, not the class ;)

 

I agree with Mazetar. If the buttons aren't working, use the


tag, or even better, as Mazetar said (once again), use Gist on Github.

 

And yes, you want to have some basic knowledge about Java. You can use the link Mazetar gave you, or you can follow TheNewBoston's tutorials, if you don't want lengthy videos and are lazy.

 

The way I learnt java? I learnt java in fifth grade (at the age of 10) from a book called Head First Java. They use really easy-to-follow language and use good examples. Learning from there, here I am - coding minecraft mods(released one a few days ago) at the age of 12(seventh grade)!

 

 

The thing I want to say, is you can't just get to coding before learning the language.

 

P.S to Mazetar -

 

You said

 

PPS:

You are doing

Class = new ItemSword(/*args */);

you can't set a class to something.

You need to set the variable, not the class ;)

 

I think you are wrong. If you look closely, he is using the variable but he is initializing the variable AFTER declaration, which results in Java not being able to find the variable.

 

Regards,

Ablaze.

Add me on Skype: AblazeTheBest. Send a message saying "#HeyAblaze"

 

Currently: Making a mod!

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.