Jump to content

Custom Sword


bhavikchugani

Recommended Posts

4 hours ago, bhavikchugani said:

i dont really know any java

That's a real problem. Java is a prerequisite for this forum, so you must go learn it elsewhere or have enough programming experience that you can wing it successfully. In other words, claiming Java ignorance will earn you disdain here, not sympathy.

 

Fortunately, the web is a rich source of help with Java, and the Eclipse IDE is a powerful crutch to the new Java programmer. Best of all, you have all of the decompiled and deobfuscated vanilla source code to explore (and Forge source too). Get out there (exploring the existing Minecraft code base) and learn yourself some Java.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

22 hours ago, Jay Avery said:

Create a subclass of ItemSword that uses your material.

how exactly. would this code so far be correct?

package items;
import com.bhavik.testmod.PickaxeTest;
import com.bhavik.testmod.reference;

import items.ItemRuby;
import net.minecraft.item.Item;
public class ItemSword extends Item{	
	public ItemSword(){
		setUnlocalizedName(reference.PickaxeTestItems.RUBYSWORD.getUnlocalizedName());
		setRegistryName(reference.PickaxeTestItems.RUBYSWORD.getRegistryName());
		setCreativeTab(PickaxeTest.tabPickaxeTest);
	}
	
}

 

Link to comment
Share on other sites

19 minutes ago, bhavikchugani said:

how exactly. would this code so far be correct?


package items;
import com.bhavik.testmod.PickaxeTest;
import com.bhavik.testmod.reference;

import items.ItemRuby;
import net.minecraft.item.Item;
public class ItemSword extends Item{	
	public ItemSword(){
		setUnlocalizedName(reference.PickaxeTestItems.RUBYSWORD.getUnlocalizedName());
		setRegistryName(reference.PickaxeTestItems.RUBYSWORD.getRegistryName());
		setCreativeTab(PickaxeTest.tabPickaxeTest);
	}
	
}

 

Your class needs to extend ItemSword, not Item.

Link to comment
Share on other sites

55 minutes ago, Jay Avery said:

Your class needs to extend ItemSword, not Item.

And is ItemSword a minecraft import??

Changed it but getting error for next line of code saying "Implicit Superconstructor ItemSword() is undefined"

 

Edited by bhavikchugani
Addon
Link to comment
Share on other sites

46 minutes ago, bhavikchugani said:

And is ItemSword a minecraft import??

Changed it but getting error for next line of code saying "Implicit Superconstructor ItemSword() is undefined"

 

Yes, ItemSword is a vanilla class in minecraft. The constructor for that class requires parameters, so you need to manually call super in your own constructor and pass the parameters to it.

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.