OK I think when I put it in the 2nd time it failed but then I put in ./gradlew eclipse and it said it was successful!! Sorry I can't put on the images it would be a while before I could get this reply out!!
OK I think when I put it in the 2nd time it failed but then I put in ./gradlew eclipse and it said it was successful!! Sorry I can't put on the images it would be a while before I could get this reply out!!
You need to run the first command successfully before you can get the second one to work. Just copy and paste what Command Prompt says into pastebin.
- The method setBlockName(String) is undefined for the type BlockTitaniumOre BlockTitaniumOre.java /Minecraft/src/main/java/Item/blocks line 14 Java Problem
- The method setBlockTextureName(String) is undefined for the type BlockTitaniumOre BlockTitaniumOre.java /Minecraft/src/main/java/Item/blocks line 15 Java Problem
- The method setBlockName(String) is undefined for the type BlockTitaniumOre BlockTitaniumOre.java /Minecraft/src/main/java/Item/blocks line 14 Java Problem
- The method setBlockTextureName(String) is undefined for the type BlockTitaniumOre BlockTitaniumOre.java /Minecraft/src/main/java/Item/blocks line 15 Java Problem
I use forge 1.8
I don't really know what changed in 1.8, so these tutorials may not work for it. Are you extending the Block class though?
I had the problem where my texture's weren't showing up because I had a capital letter in my mod name. Even after changing it to lowercase it wouldn't work. I found out that although I had corrected the issue in code, my build directory still had the mod name in caps.
To solve this problem delete the <forge src>\build\resources\main\assets folder and it will re-created your mod folder in lower case when you run again.
... or possibly one of the gradle clean tasks would accomplish this, but this is the quick solution.
One other tip - to enable run in eclipse i'm using this strategy:
From Eclipse, use pull-down menu Run / External Tools / External Tools Configurations...
Select "Program" in left navigator panel then click the "New launch configuration" button in the tool bar (first button in my tool bar).
With Main tab selected, fill out the following fields:
Name: (above the tabs) to "Gradle" (or whatever name you want for the launcher).
Location: Use "Browse File System..." button to navigate to your "gradle.bat" or "gradlew.bat" to run.
Working Directory: Use "Browse Workspace..." button to select directory with the "build.gradle" file for the desired project (same directory as above in this case)
Arguments: Enter "runclient"
when you want to run, just click run button with the little red toolbox underneath. good luck
These tutorials are really well thought n written. I've a little background in python n C, so I got away with no compilation error (thanks to your elaborate guide). But the en_US.lang file doesn't seem to Name the items n blocks yet! I did all you said but there's some problem I guess. Sorry if this question is redundent. Here are my files:
testmod.java
package com.pokedev.testmod;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import com.pokedev.testmod.help.Reference; //Manually added the import as eclipse was unable to do it for me
import com.pokedev.testmod.init.ModBlocks;
import com.pokedev.testmod.init.ModItems;
@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
public class testmod
{
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
ModItems.init();
ModBlocks.init();
}
@Mod.EventHandler
public void Init(FMLInitializationEvent event)
{
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
}
Reference.java
package com.pokedev.testmod.help;
public class Reference
{
public static final String MODID = "testmod_pokedev";
public static final String NAME = "testmod";
public static final String VERSION = "alpha";
}
RegisterHelper.java
package com.pokedev.testmod.help;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.GameRegistry;
public class RegisterHelper
{
package com.pokedev.testmod.init;
import com.pokedev.testmod.help.RegisterHelper;
import com.pokedev.testmod.items.testmodItem;
import net.minecraft.item.Item;
public class ModItems
{
public static Item testIngot = new testmodItem().setUnlocalizedName("testIngot");
public static void init()
{
RegisterHelper.registerItem(testIngot);
}
}
ModBlocks.java
package com.pokedev.testmod.init;
import net.minecraft.block.Block;
import com.pokedev.testmod.blocks.BlocktestBlock;
import com.pokedev.testmod.help.RegisterHelper;
public class ModBlocks
{
public static Block testBlock = new BlocktestBlock();
public static void init()
{
RegisterHelper.registerBlock(testBlock);
}
also I named the package for language file 'assets.modid.lang' and not as 'assets.MODID.lang' where MODID is some other string. Can you tell me where the problem is? Thanks.
These tutorials are really well thought n written. I've a little background in python n C, so I got away with no compilation error (thanks to your elaborate guide). But the en_US.lang file doesn't seem to Name the items n blocks yet! I did all you said but there's some problem I guess. Sorry if this question is redundent. Here are my files:
testmod.java
package com.pokedev.testmod;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import com.pokedev.testmod.help.Reference; //Manually added the import as eclipse was unable to do it for me
import com.pokedev.testmod.init.ModBlocks;
import com.pokedev.testmod.init.ModItems;
@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
public class testmod
{
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
ModItems.init();
ModBlocks.init();
}
@Mod.EventHandler
public void Init(FMLInitializationEvent event)
{
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
}
Reference.java
package com.pokedev.testmod.help;
public class Reference
{
public static final String MODID = "testmod_pokedev";
public static final String NAME = "testmod";
public static final String VERSION = "alpha";
}
RegisterHelper.java
package com.pokedev.testmod.help;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.GameRegistry;
public class RegisterHelper
{
package com.pokedev.testmod.init;
import com.pokedev.testmod.help.RegisterHelper;
import com.pokedev.testmod.items.testmodItem;
import net.minecraft.item.Item;
public class ModItems
{
public static Item testIngot = new testmodItem().setUnlocalizedName("testIngot");
public static void init()
{
RegisterHelper.registerItem(testIngot);
}
}
ModBlocks.java
package com.pokedev.testmod.init;
import net.minecraft.block.Block;
import com.pokedev.testmod.blocks.BlocktestBlock;
import com.pokedev.testmod.help.RegisterHelper;
public class ModBlocks
{
public static Block testBlock = new BlocktestBlock();
public static void init()
{
RegisterHelper.registerBlock(testBlock);
}
also I named the package for language file 'assets.modid.lang' and not as 'assets.MODID.lang' where MODID is some other string. Can you tell me where the problem is? Thanks.
Change it to:
item.testIngot.name=Ningot
Basically just remove the spaces between the "=" sign, and the two words.
You need to run the first command successfully before you can get the second one to work. Just copy and paste what Command Prompt says into pastebin.
Host the file on a site like imgur, and link 'em here.
Sure. My email is [email protected]
- The method setBlockName(String) is undefined for the type BlockTitaniumOre BlockTitaniumOre.java /Minecraft/src/main/java/Item/blocks line 14 Java Problem
- The method setBlockTextureName(String) is undefined for the type BlockTitaniumOre BlockTitaniumOre.java /Minecraft/src/main/java/Item/blocks line 15 Java Problem
I use forge 1.8
I don't really know what changed in 1.8, so these tutorials may not work for it. Are you extending the Block class though?
I heard about the changes to texturing, just not exactly what changes. JSON files must be a pain though, but hopefully I'm wrong.
I had the problem where my texture's weren't showing up because I had a capital letter in my mod name. Even after changing it to lowercase it wouldn't work. I found out that although I had corrected the issue in code, my build directory still had the mod name in caps.
To solve this problem delete the <forge src>\build\resources\main\assets folder and it will re-created your mod folder in lower case when you run again.
... or possibly one of the gradle clean tasks would accomplish this, but this is the quick solution.
Thanks for the tutorials!
--------------------------------------------------------------------------------------------
One other tip - to enable run in eclipse i'm using this strategy:
From Eclipse, use pull-down menu Run / External Tools / External Tools Configurations...
Select "Program" in left navigator panel then click the "New launch configuration" button in the tool bar (first button in my tool bar).
With Main tab selected, fill out the following fields:
- Name: (above the tabs) to "Gradle" (or whatever name you want for the launcher).
- Location: Use "Browse File System..." button to navigate to your "gradle.bat" or "gradlew.bat" to run.
- Working Directory: Use "Browse Workspace..." button to select directory with the "build.gradle" file for the desired project (same directory as above in this case)
- Arguments: Enter "runclient"
when you want to run, just click run button with the little red toolbox underneath. good lucktestmod.java
package com.pokedev.testmod;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import com.pokedev.testmod.help.Reference; //Manually added the import as eclipse was unable to do it for me
import com.pokedev.testmod.init.ModBlocks;
import com.pokedev.testmod.init.ModItems;
@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
public class testmod
{
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
ModItems.init();
ModBlocks.init();
}
@Mod.EventHandler
public void Init(FMLInitializationEvent event)
{
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
}
package com.pokedev.testmod.help;
public class Reference
{
public static final String MODID = "testmod_pokedev";
public static final String NAME = "testmod";
public static final String VERSION = "alpha";
}
package com.pokedev.testmod.help;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.GameRegistry;
public class RegisterHelper
{
public static void registerBlock(Block block)
{
GameRegistry.registerBlock(block, Reference.MODID + block.getUnlocalizedName().substring(5));
}
public static void registerItem(Item item)
{
GameRegistry.registerItem(item, Reference.MODID + item.getUnlocalizedName().substring(5));
}
}
package com.pokedev.testmod.init;
import com.pokedev.testmod.help.RegisterHelper;
import com.pokedev.testmod.items.testmodItem;
import net.minecraft.item.Item;
public class ModItems
{
public static Item testIngot = new testmodItem().setUnlocalizedName("testIngot");
public static void init()
{
RegisterHelper.registerItem(testIngot);
}
}
package com.pokedev.testmod.init;
import net.minecraft.block.Block;
import com.pokedev.testmod.blocks.BlocktestBlock;
import com.pokedev.testmod.help.RegisterHelper;
public class ModBlocks
{
public static Block testBlock = new BlocktestBlock();
public static void init()
{
RegisterHelper.registerBlock(testBlock);
}
}
package com.pokedev.testmod.items;
import com.pokedev.testmod.help.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class testmodItem extends Item
{
public testmodItem()
{
super();
setCreativeTab(CreativeTabs.tabMisc);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister par1IconRegister)
{
itemIcon = par1IconRegister.registerIcon(Reference.MODID + ":" + getUnlocalizedName().substring(5));
}
}
package com.pokedev.testmod.blocks;
import com.pokedev.testmod.help.Reference;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
public class BlocktestBlock extends Block
{
public BlocktestBlock()
{
super(Material.iron);
setBlockName("testBlock");
setBlockTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5));
setCreativeTab(CreativeTabs.tabBlock);
}
}
item.testIngot.name = Ningot
tile.testBlock.name = Preampharous Ore
also I named the package for language file 'assets.modid.lang' and not as 'assets.MODID.lang' where MODID is some other string. Can you tell me where the problem is? Thanks.
Change it to:
Basically just remove the spaces between the "=" sign, and the two words.
static Item.ToolMaterial BACON = EnumHelper.addToolMaterial("BACON", 2, 512, 2.0F, 2.0F, 14);
Is "Enum" specific to your mod? what would i change it to if so?
Import EnumHelper.
import net.minecraftforge.common.util.EnumHelper;