Jump to content

[1.10] How do I make a custom 3D sword and put it in to the Game


Rockinredross867

Recommended Posts

You have to start splitting things up into pieces. First, you make a normal

Item

. Then you make it a sword. After that, you make a fancy model for it in the JSON file. For all of those are plenty of tutorials online.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Well the thing is I'm not rendering it because someone has not yet answered my question. But here is my source code.

 

package com.christmasmod.init;

import com.christmasmod.items.ItemCandyCane;
import com.christmasmod.items.WeaponChristmasBatton;
import com.christmasmod.main.Reference;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {

private static Item candyCane;
private static Item christmasBatton;

public static void init() {
	candyCane = new ItemCandyCane();
	christmasBatton = new WeaponChristmasBatton();
}

public static void register() {
	GameRegistry.register(candyCane);
	GameRegistry.register(christmasBatton);
}

public static void registerRenders() {
	registerRender(candyCane);
	registerRender(christmasBatton);
}

private static void registerRender(Item item) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
	.register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}

}

 

package com.christmasmod.items;

import com.christmasmod.main.Reference;

import net.minecraft.item.ItemSword;

public class WeaponChristmasBatton extends ItemSword {

public WeaponChristmasBatton() {
	super(ToolMaterial.DIAMOND);
	setUnlocalizedName(Reference.EModItems.CHRISTMAS_BATTON.getUnlocalizedName());
	setRegistryName(Reference.EModItems.CHRISTMAS_BATTON.getRegistryName());
	setFull3D();
}

}

 

package com.christmasmod.proxies;

import com.christmasmod.init.ModItems;

public class ClientProxy implements IProxy {

@Override
public void init() {
	ModItems.registerRenders();
}

}

 

package com.christmasmod.main;

import com.christmasmod.init.ModItems;
import com.christmasmod.proxies.IProxy;

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;

@Mod(modid = Reference.MOD_ID, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class Main {

@SidedProxy(clientSide = Reference.CLIENT_SIDED_PROXY_CLASS, serverSide = Reference.SERVER_SIDED_PROXY_CLASS)
public static IProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	ModItems.init();
	ModItems.register();
}

@EventHandler
public void init(FMLInitializationEvent event) {
	proxy.init();
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}

}

 

package com.christmasmod.main;

public class Reference {

public static final String MOD_ID = "christmasmod";
public static final String NAME = "Christmas Mod";
public static final String VERSION = "0.1";
public static final String ACCEPTED_VERSIONS = "[1.10]";

public static final String CLIENT_SIDED_PROXY_CLASS = "com.christmasmod.proxies.ClientProxy";
public static final String SERVER_SIDED_PROXY_CLASS = "com.christmasmod.proxies.ServerProxy";

public static enum EModItems {
	CANDY_CANE("candyCane", "ItemCandyCane"),
	CHRISTMAS_BATTON("christmasBatton", "WeaponChristmasBatton");

	private String unlocalizedName;
	private String registryName;

	EModItems(String unlocalizedName, String registryName) {
		this.unlocalizedName = unlocalizedName;
		this.registryName = registryName;
	}

	public String getUnlocalizedName() {
		return unlocalizedName;
	}

	public String getRegistryName() {
		return registryName;
	}
}
}

 

{
"textures": {
	"texture0": "christmasmod:items/WeaponChristmasBatton0",
	"texture1": "christmasmod:items/WeaponChristmasBatton1",
	"particle": "christmasmod:items/WeaponChristmasBatton0"
},
"elements": [
	{
		"from": [ 8.0, 33.0, 7.0 ],
		"to": [ 9.0, 40.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 1, 13, 2, 14  ], "texture": "#texture0"},
			"up":	{ "uv": [ 1, 10, 2, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 1, 1, 2, 8  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 1, 5, 8  ], "texture": "#texture0"},
			"west":	{ "uv": [ 10, 1, 11, 8  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 1, 8, 8  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 8.0, 31.0, 7.0 ],
		"to": [ 9.0, 32.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"up":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 7.0, 40.0, 7.0 ],
		"to": [ 8.0, 41.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 8.0, 40.0, 8.0 ],
		"to": [ 9.0, 41.0, 9.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 9.0, 40.0, 7.0 ],
		"to": [ 10.0, 41.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 8.0, 32.0, 8.0 ],
		"to": [ 9.0, 33.0, 9.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"up":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 7.0, 32.0, 7.0 ],
		"to": [ 8.0, 33.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"up":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 8.0, 32.0, 6.0 ],
		"to": [ 9.0, 33.0, 7.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"up":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 9.0, 32.0, 7.0 ],
		"to": [ 10.0, 33.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"up":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 4, 13, 5, 14  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 6.0, 41.0, 7.0 ],
		"to": [ 7.0, 54.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 13, 1, 14, 14  ], "texture": "#texture0"},
			"south":{ "uv": [ 13, 1, 14, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"},
			"east":	{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"}
		}
	},
	{
		"from": [ 7.0, 41.0, 6.0 ],
		"to": [ 8.0, 54.0, 9.0 ],
		"faces": {
			"down":	{ "uv": [ 9, 1, 10, 4  ], "texture": "#texture1"},
			"up":	{ "uv": [ 10, 10, 11, 13  ], "texture": "#texture0"},
			"north":{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"},
			"south":{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"},
			"west":	{ "uv": [ 4, 1, 7, 14  ], "texture": "#texture1"},
			"east":	{ "uv": [ 4, 1, 7, 14  ], "texture": "#texture1"}
		}
	},
	{
		"from": [ 9.0, 41.0, 6.0 ],
		"to": [ 10.0, 54.0, 9.0 ],
		"faces": {
			"down":	{ "uv": [ 9, 1, 10, 4  ], "texture": "#texture1"},
			"up":	{ "uv": [ 10, 10, 11, 13  ], "texture": "#texture0"},
			"north":{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"},
			"south":{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"},
			"west":	{ "uv": [ 4, 1, 7, 14  ], "texture": "#texture1"},
			"east":	{ "uv": [ 4, 1, 7, 14  ], "texture": "#texture1"}
		}
	},
	{
		"from": [ 8.0, 40.0, 6.0 ],
		"to": [ 9.0, 41.0, 7.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 8.0, 40.0, 6.0 ],
		"to": [ 9.0, 41.0, 7.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 8.0, 41.0, 5.0 ],
		"to": [ 9.0, 54.0, 6.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 13, 1, 14, 14  ], "texture": "#texture0"},
			"south":{ "uv": [ 13, 1, 14, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"},
			"east":	{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"}
		}
	},
	{
		"from": [ 8.0, 41.0, 9.0 ],
		"to": [ 9.0, 54.0, 10.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 13, 1, 14, 14  ], "texture": "#texture0"},
			"south":{ "uv": [ 13, 1, 14, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"},
			"east":	{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"}
		}
	},
	{
		"from": [ 10.0, 41.0, 7.0 ],
		"to": [ 11.0, 54.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 13, 1, 14, 14  ], "texture": "#texture0"},
			"south":{ "uv": [ 13, 1, 14, 14  ], "texture": "#texture0"},
			"west":	{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"},
			"east":	{ "uv": [ 1, 1, 2, 14  ], "texture": "#texture1"}
		}
	},
	{
		"from": [ 8.0, 54.0, 6.0 ],
		"to": [ 9.0, 55.0, 9.0 ],
		"faces": {
			"down":	{ "uv": [ 10, 10, 11, 13  ], "texture": "#texture0"},
			"up":	{ "uv": [ 9, 1, 10, 4  ], "texture": "#texture1"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 9, 6, 12, 7  ], "texture": "#texture1"},
			"east":	{ "uv": [ 9, 6, 12, 7  ], "texture": "#texture1"}
		}
	},
	{
		"from": [ 7.0, 54.0, 7.0 ],
		"to": [ 8.0, 55.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 8.0, 55.0, 7.0 ],
		"to": [ 9.0, 56.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"}
		}
	},
	{
		"from": [ 9.0, 54.0, 7.0 ],
		"to": [ 10.0, 55.0, 8.0 ],
		"faces": {
			"down":	{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"up":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"north":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"south":{ "uv": [ 4, 10, 5, 11  ], "texture": "#texture0"},
			"west":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"},
			"east":	{ "uv": [ 7, 10, 8, 11  ], "texture": "#texture0"}
		}
	}
]
}

 

This is all the code that I have relative to the Christmas Baton weapon.

Link to comment
Share on other sites

first of all in the json file it references to items/yourtextures are the texture names spelled correctly? next, you need a json file that handles item rendering, you but it in (modid)/models/item and call it (itemname).json with this code inside.

 

 

 

{

    "parent": "(modid)/block/(youritem)",

    "display": {

        "thirdperson": {

            "rotation": [ 10, -45, 170 ],

            "translation": [ 0, 1.5, -2.75 ],

            "scale": [ 0.375, 0.375, 0.375 ]

        }

    }

}

 

 

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.