Jump to content

[1.8] Sword help


toothpick007

Recommended Posts

Hi everyone just wondering if anyone could point me in the right direction im tring to create a sword now ive done the texturing the naming and everything else however i want to apply custom attributes and im unsure where to put it in.

 

Ive create

 

public static ToolMaterial test = EnumHelper.addToolMaterial("The Killer", 0, 1, 12.0F, 4.0F, 22);

 

However im unsure where to put it in all this ...

 

package com.colc.tutorial.init;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.LanguageRegistry;

import com.colc.tutorial.reference;

public class tutorialsword {



public static Item test_sword;
public static ToolMaterial test = EnumHelper.addToolMaterial("The Killer", 0, 1, 12.0F, 4.0F, 22);

public static void init(){

	test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat);	


}

public static void register(){

	GameRegistry.registerItem(test_sword, test_sword.getUnlocalizedName().substring(5));//tile.test_item
	LanguageRegistry.addName(test_sword, "Jedi Sword");
}

public static void registerrenders()
{

	registerrender(test_sword);

}
public static void registerrender(Item item){

	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5),"inventory"));;
}
}

Link to comment
Share on other sites

Well, you don't have a main mod file (or haven't shown it) so that code is never being called.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Sorry here is my main file

 

package com.colc.tutorial;

import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.colc.tutorial.init.tutorialblocks;
import com.colc.tutorial.init.tutorialitems;
import com.colc.tutorial.init.tutorialsword;
import com.colc.tutorial.proxy.CommonProxy;


@Mod(modid = reference.MOD_ID, name = reference.MOD_Name,version = reference.VERSION )

public class tutorialmod {

@SidedProxy(clientSide = reference.CLIENT_PROXY_CLASS,serverSide = reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy ;





@EventHandler		
public void init(FMLInitializationEvent event)

{

//******* Recipes Section Call Function**************	
	CraftingRecipies();	
//////*******END Recipes Section****************/////

//******* Smelting Section Call Function*************	
	Smelting();
//////*******END Smelting Section****************/////

	proxy.registerrenders();



}


@EventHandler	
public void postInit(FMLPostInitializationEvent event)

{


}


@EventHandler
public void preInit(FMLPreInitializationEvent event)

{




	tutorialitems.init();
	tutorialitems.register();
	tutorialblocks.init();
	tutorialblocks.register();
	tutorialsword.init();
	tutorialsword.register();
}

/////// this is where all your recipes will go////////
public void CraftingRecipies(){

		GameRegistry.addRecipe(new ItemStack(Blocks.obsidian,64),new Object[]{

		"ddd",
		"sss",
		"ddd",
		Character.valueOf('d'),Blocks.dirt,
		Character.valueOf('s'),Items.apple});

		GameRegistry.addShapelessRecipe(new ItemStack(Items.diamond,64 ),new ItemStack(Blocks.dirt));





}

/////// this is where all your Smelting recipes will go////////
public void Smelting(){

	GameRegistry.addSmelting(Blocks.cobblestone, new ItemStack(Items.iron_ingot), 200);
	GameRegistry.addSmelting(tutorialblocks.test_block,new ItemStack(tutorialitems.test_item), 200);

}

}

Link to comment
Share on other sites

If you want your Item to be Sword you need to use ItemSword (or ItemTool) which has ToolMaterial field in it.

 

Item.class is used mostly for very basic items or as a base for extending classes (like food).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

If you want your Item to be Sword you need to use ItemSword (or ItemTool) which has ToolMaterial field in it.

 

Item.class is used mostly for very basic items or as a base for extending classes (like food).

 

where would I place it thou would I need to make a whole new class ????

Link to comment
Share on other sites

where would I place it thou would I need to make a whole new class ????

 

Uh...yeah...

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

basicaly, change:

public class tutorialsword {

to:

public class tutorialsword extends ItemSword {

and add:

public tutorialsword(){
super(test);
}

to the tutorialsword class.

 

(Sorry if I am wrong about something, I havn't actually tried coding in 1.8 before)

If I ever say something stupid, or simply incorrect, please excuse me. I don't know anything about 1.8 modding, and I don't know much about entities either, But I try to help when I can.

Link to comment
Share on other sites

basicaly, change:

public class tutorialsword {

to:

public class tutorialsword extends ItemSword {

and add:

public tutorialsword(){
super(test);
}

to the tutorialsword class.

 

(Sorry if I am wrong about something, I havn't actually tried coding in 1.8 before)

 

okay so I treid all of that now this is my class for the sword

 

package com.colc.tutorial.init;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemSword;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.LanguageRegistry;

import com.colc.tutorial.reference;

public class tutorialsword extends ItemSword {



public static Item test_sword;
public static ToolMaterial test = EnumHelper.addToolMaterial("The Killer", 0, 1, 12.0F, 4.0F, 22);

public tutorialsword(){
super(test);
}

public static void init(){

	test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat);	


}

public static void register(){

	GameRegistry.registerItem(test_sword, test_sword.getUnlocalizedName().substring(5));//tile.test_item
	LanguageRegistry.addName(test_sword, "COLC Sword");
}

public static void registerrenders()
{

	registerrender(test_sword);

}
public static void registerrender(Item item){

	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5),"inventory"));;
}
}

 

However it is still not working :-( I hate this change to 1.8 :-(

Link to comment
Share on other sites

However it is still not working :-( I hate this change to 1.8 :-(

 

Your problem is modding concepts in general. I don't think too much from this thread is really 1.8 specific. If you are following a tutorial, follow are steps really carefully.

just you wait! ;)

Link to comment
Share on other sites

However it is still not working :-( I hate this change to 1.8 :-(

 

Your problem is modding concepts in general. I don't think too much from this thread is really 1.8 specific. If you are following a tutorial, follow are steps really carefully.

 

There are no tutorials on this that's why I am struggling and if you could point out the errors of my way that would be great

Link to comment
Share on other sites

Basically:

 

Why the hell did you smash main-mod-file things into your sword class?

 

What the fuck is this line?

test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat);

 

Where's your @Mod annotation?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Basically:

 

Why the hell did you smash main-mod-file things into your sword class?

 

What the fuck is this line?

test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat);

 

Where's your @Mod annotation?

 

Thank you for your reply and to answer you questions

 

1. Why the hell did you smash main-mod-file things into your sword class?

A : I have no idea what you are referring to...

 

2: What the fuck is this line?

test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat);

A: Well that because I initialize all my objects in their own class unless there is a better way to do it that I havnt found.

 

3:Where's your @Mod annotation?

That's in my main Class

 

Hope this helps and thank you for helping.

Link to comment
Share on other sites

Initialize your items in the init() method of your main file :/. that's the answer to the first two questions.

If I ever say something stupid, or simply incorrect, please excuse me. I don't know anything about 1.8 modding, and I don't know much about entities either, But I try to help when I can.

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

    • Hello there! I am trying to make custom dimensions for a modpack I am making in an older minecraft version, 1.16.5. I like that version and it has a few other mods that have not been updated that I would still like to use. Anyway, I am having a terrible time with getting my dimension to work and have tried using code from other peoples projects to at least figure out what I'm supposed to be doing but it has not been as helpful as I would have liked. If anyone could help that would be greatly appreciated! Here is my github with all the code as I am using it: https://github.com/BladeColdsteel/InvigoratedDimensionsMod I have also included the last log, https://pastebin.com/zX9vsDSq, I had when I tried to load up a world, let me know if there is anything else I should send though, thank you!
    • Whether you are a fan of Hypixel Bedwars, SkyWars and PvP gamemodes like that, well you would enjoy this server! We have a very fun and unique style of PvP that a lot of our players really enjoy and we want to bring this server to more players like you! Yes you reading this post haha. Introducing, the Minezone Network, home of SUPER CRAFT BLOCKS. We've been working on this server for over 4 years now. Here is what we have to offer: SUPER CRAFT BLOCKS: This has 3 different gamemodes you can play, Classic, Duels and Frenzy. Each mode offers over 60 kits to choose from, along with a total of over 60 maps, allowing for various different playstyles on each map. There are also random powerups that spawn on the map which can include Health Pots, Bazookas, Nukes, Extra Lives and way way more! There is also double jump in this gamemode as well, which makes PvP a lot more fun & unique. You only need a minimum of 2 players to start any mode! Classic: Choose a kit, 5 lives for each player, fight it out and claim the #1 spot! Look out for lightning as they can spawn powerups to really give you an advantage in the game! Duels: Fight against another random player or one of your friends and see who is the best! Frenzy: Your kit is randomly selected for you, each life you will have a different kit. You can fight with up to 100 players in this mode and lets see who will be the best out of that 100! All the other stuff from Classic/Duels apply to this mode as well like powerups. We have 2 ranks on this server too, VIP and CAPTAIN which has a bunch of different perks for SCB and other things like Cosmetics and more.   SERVER IP: If this server has caught your interest in any way, please consider joining and you will NOT regret it! Bring some of your friends online for an even better experience and join in on the fun at: IP: minezone.club Hope to see you online!   SERVER TRAILER: https://www.youtube.com/watch?v=0phpMgu1mH0
    • The mod give new blocks  
    • I will a Mode for 1.21 in this Mod give new block, items and dimensions   
  • Topics

×
×
  • Create New...

Important Information

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