package manxiosa.manxiosasugaredmod;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid="ManxiosaSugared", name="Manxiosa Sugared Mod", version= "1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class ManxiosaSugared {
@Instance("ManxiosaSugared")
public static ManxiosaSugared instance;
private static final Item Pot = new ItemPot (12200);
@SidedProxy(clientSide="manxiosa.manxiosasugaredmod.client.ClientProxy",
serverSide="manxiosa.manxiosasugaredmod.CommonProxy")
public static CommonProxy proxy;
@PreInit
public void PreInit(FMLPreInitializationEvent event) {
}
@Init
public void load(FMLInitializationEvent event) {
LanguageRegistry.addName(Pot, "Pot");
proxy.registerRenderers();
}
@PostInit
public void postInit(FMLPostInitializationEvent event) {
}
}
ClientProxy.class
package manxiosa.manxiosasugaredmod.client;
import net.minecraftforge.client.MinecraftForgeClient;
import manxiosa.manxiosasugaredmod.CommonProxy;
public class ClientProxy extends CommonProxy {
@Override
public void registerRenderers() {
MinecraftForgeClient.preloadTexture(ITEMS_PNG);
MinecraftForgeClient.preloadTexture(BLOCK_PNG);
}
}
CommonProxy.class
package manxiosa.manxiosasugaredmod;
public class CommonProxy {
public static String ITEMS_PNG="/manxiosa/manxiosasugaredmod/itemmnxa.png";
public static String BLOCK_PNG="/manxiosa/manxiosasugaredmod/terrainmnxa.png";
public void registerRenderes() {
}
}
ItemPot.class
package manxiosa.manxiosasugaredmod;
import net.minecraft.item.Item;
import net.minecraft.creativetab.CreativeTabs;
public class ItemPot extends Item {
public ItemPot(int id) {
super (id);
setMaxStackSize(64);
setCreativeTab(CreativeTabs.tabMisc);
setIconIndex(0);
setItemName("Pot");
}
public String getTextureFile() {
return CommonProxy.ITEMS_PNG;
}
}
u///u thank you so much
I see your problem - the registerRenderers() method in the CommonProxy is misspelled. It should work if you fix it! Hope this helps
I'm getting trouble trying to install the forge thing... damn macs...
I dragged the Install.sh file into terminal, after typing bash, hit enter, and I only got "python: can't open file "install.py".
Help?
I'm getting trouble trying to install the forge thing… dam macs...
I dragged the Install.sh file into terminal, after typing bash, hit enter, and I only got "python: can't open file "install.py".
Help?
Did you type "cd " then drag in your forge folder, then type "bash install.sh"? If not, try re-downloading Forge.
This modding tutorial is great, it is really helping me and my friend in our first modding adventure! As a side note do i have to make the textures immediatly after setting up the proxy stuff to be able to test the mod in eclipse?
This modding tutorial is great, it is really helping me and my friend in our first modding adventure! As a side note do i have to make the textures immediatly after setting up the proxy stuff to be able to test the mod in eclipse?
I'm glad that you enjoy the tutorial! In order to test the mod, you will need the textures in the location you typed in the CommonProxy.
:c i can't get my textures to show up. the item is in game, and it has a name, but the texture is blank. Here's my code
modMain.java
package Lecapria.main; //The package your mod is in
import net.minecraft.block.Block;
import java.net.Proxy;
import net.minecraft.item.Item;
import Lecapria.main.client.core.handlers.ClientPacketHandler;
import Lecapria.main.common.core.CommonProxy;
import Lecapria.main.common.core.handlers.ServerPacketHandler;
import Lecapria.main.client.core.item.ItemTeeth;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.SidedProxy;
@NetworkMod(clientSideRequired=true,serverSideRequired=true, //Whether client side and server side are needed
clientPacketHandlerSpec = @SidedPacketHandler(channels = {"modGeneral" }, packetHandler = ClientPacketHandler.class), //For clientside packet handling
serverPacketHandlerSpec = @SidedPacketHandler(channels = {}, packetHandler = ServerPacketHandler.class)) //For serverside packet handling
@Mod(modid="Lecapria'sMod",name="MainMod",version="1.0") //Gives Forge extra info about your mod
public class modMain
{ //The class file
public static Item wormTeeth = new ItemTeeth(15000);
@Instance("MainMod") //The instance, this is very important later on
public static modMain instance = new modMain();
@SidedProxy(clientSide = "Lecapria.main.client.core.ClientProxy", serverSide = "Lecapria.main.common.core.CommonProxy") //Tells Forge the location of your proxies
public static CommonProxy proxy;
@Init
public void InitCobaltCraft(FMLInitializationEvent event)
{ //Your main initialization method
proxy.addNames();
proxy.registerBlocks();
proxy.addRecipes();
NetworkRegistry.instance().registerGuiHandler(this, proxy); //Registers the class that deals with GUI data
}
}
CommonProxy.java
package Lecapria.main.common.core;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import Lecapria.main.modMain;
public class CommonProxy implements IGuiHandler
{
//THIS IS IMPORTANT, CANNOT BE A PROXY/GUI HANDLER WITHOUT THIS!!
public void registerRenderInformation() //Client side texture registering
{
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
return null;
}
public void registerTiles()
{
}
public void registerBlocks()
{
}
public void addNames()
{
LanguageRegistry.addName(modMain.wormTeeth, "Worm Teeth"); //Adds the name for the ruby item
}
public void addRecipes()
{
}
}
ClientProxy.java
package Lecapria.main.client.core;
import Lecapria.main.common.core.CommonProxy;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy
{
public void registerRenderInformation()
{
MinecraftForgeClient.preloadTexture("/modMainGFX/Tiles/items/teeth.png");
}
}
ItemTeeth.java
package Lecapria.main.client.core.item;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.*;
import Lecapria.main.modMain;
import net.minecraft.creativetab.CreativeTabs;
public class ItemTeeth extends Item
{
public ItemTeeth(int par1)
{
super(par1); //Returns super constructor: par1 is ID
setTextureFile("/modMainGFX/Tiles/items/teeth.png"); //Sets the item texture file
setItemName("LecapriaItemWormTeeth"); //Sets the incode name of the item, make sure it doesn't clash with other items, weird stuff happens
setCreativeTab(CreativeTabs.tabMaterials); //Tells the game what creative mode tab it goes in
}
@SideOnly(Side.CLIENT) //Marks a method as client side only, typically for graphics and rendering
public int getItemIconFromDamage(int i)
{
return 0; //The first icon on the spritesheet
}
}
:c i can't get my textures to show up. the item is in game, and it has a name, but the texture is blank. Here's my code
modMain.java
package Lecapria.main; //The package your mod is in
import net.minecraft.block.Block;
import java.net.Proxy;
import net.minecraft.item.Item;
import Lecapria.main.client.core.handlers.ClientPacketHandler;
import Lecapria.main.common.core.CommonProxy;
import Lecapria.main.common.core.handlers.ServerPacketHandler;
import Lecapria.main.client.core.item.ItemTeeth;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.SidedProxy;
@NetworkMod(clientSideRequired=true,serverSideRequired=true, //Whether client side and server side are needed
clientPacketHandlerSpec = @SidedPacketHandler(channels = {"modGeneral" }, packetHandler = ClientPacketHandler.class), //For clientside packet handling
serverPacketHandlerSpec = @SidedPacketHandler(channels = {}, packetHandler = ServerPacketHandler.class)) //For serverside packet handling
@Mod(modid="Lecapria'sMod",name="MainMod",version="1.0") //Gives Forge extra info about your mod
public class modMain
{ //The class file
public static Item wormTeeth = new ItemTeeth(15000);
@Instance("MainMod") //The instance, this is very important later on
public static modMain instance = new modMain();
@SidedProxy(clientSide = "Lecapria.main.client.core.ClientProxy", serverSide = "Lecapria.main.common.core.CommonProxy") //Tells Forge the location of your proxies
public static CommonProxy proxy;
@Init
public void InitCobaltCraft(FMLInitializationEvent event)
{ //Your main initialization method
proxy.addNames();
proxy.registerBlocks();
proxy.addRecipes();
NetworkRegistry.instance().registerGuiHandler(this, proxy); //Registers the class that deals with GUI data
}
}
CommonProxy.java
package Lecapria.main.common.core;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import Lecapria.main.modMain;
public class CommonProxy implements IGuiHandler
{
//THIS IS IMPORTANT, CANNOT BE A PROXY/GUI HANDLER WITHOUT THIS!!
public void registerRenderInformation() //Client side texture registering
{
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
return null;
}
public void registerTiles()
{
}
public void registerBlocks()
{
}
public void addNames()
{
LanguageRegistry.addName(modMain.wormTeeth, "Worm Teeth"); //Adds the name for the ruby item
}
public void addRecipes()
{
}
}
ClientProxy.java
package Lecapria.main.client.core;
import Lecapria.main.common.core.CommonProxy;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy
{
public void registerRenderInformation()
{
MinecraftForgeClient.preloadTexture("/modMainGFX/Tiles/items/teeth.png");
}
}
ItemTeeth.java
package Lecapria.main.client.core.item;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.*;
import Lecapria.main.modMain;
import net.minecraft.creativetab.CreativeTabs;
public class ItemTeeth extends Item
{
public ItemTeeth(int par1)
{
super(par1); //Returns super constructor: par1 is ID
setTextureFile("/modMainGFX/Tiles/items/teeth.png"); //Sets the item texture file
setItemName("LecapriaItemWormTeeth"); //Sets the incode name of the item, make sure it doesn't clash with other items, weird stuff happens
setCreativeTab(CreativeTabs.tabMaterials); //Tells the game what creative mode tab it goes in
}
@SideOnly(Side.CLIENT) //Marks a method as client side only, typically for graphics and rendering
public int getItemIconFromDamage(int i)
{
return 0; //The first icon on the spritesheet
}
}
Hmm... look at my tutorials quickly, your layout looks a bit different. That code may be for an older version, but I don't use it, so check out the code in the tutorial.
Hmm... look at my tutorials quickly, your layout looks a bit different. That code may be for an older version, but I don't use it, so check out the code in the tutorial.
I see your problem - the registerRenderers() method in the CommonProxy is misspelled. It should work if you fix it! Hope this helps
thank you so much. sorry Dx
(what a shame....)
I dragged the Install.sh file into terminal, after typing bash, hit enter, and I only got "python: can't open file "install.py".
Help?
Did you type "cd " then drag in your forge folder, then type "bash install.sh"? If not, try re-downloading Forge.
What do you mean? And what's with the emoticons?
Lol did it work?
As a side note do i have to make the textures immediatly after setting up the proxy stuff to be able to test the mod in eclipse?
I'm glad that you enjoy the tutorial! In order to test the mod, you will need the textures in the location you typed in the CommonProxy.
modMain.java
CommonProxy.java
ClientProxy.java
ItemTeeth.java
My Planetminecraft Page
Hmm... look at my tutorials quickly, your layout looks a bit different. That code may be for an older version, but I don't use it, so check out the code in the tutorial.
My Planetminecraft Page
Try again - if it doesn't work, send me that code. I can only help you with my own code. Sorry!
My Planetminecraft Page
It should, but I haven't tested it.