Posted July 29, 201411 yr So I have all the items and the textures and the crafting all working. So I then exported the code to a jar file I then put it in the mods folder and tried to run minecraft. (Because now that the mod is done I need to see if it will work with the real minecraft outside of eclipse.) But when I run it the game crashes and tells me java.lang.NoSuchMethodError: net.SandItems.mod.items.SandPickaxe.getCreativeTab()Lnet/minecraft/creativetab/CreativeTabs;. Here is the code for SandPickaxe.java. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ package net.SandItems.mod.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.SandItems.mod.SandItems; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemPickaxe; import net.minecraft.creativetab.CreativeTabs; public class SandPickaxe extends ItemPickaxe { public SandPickaxe(ToolMaterial p_i45347_1_) { super(p_i45347_1_); this.setCreativeTab(getCreativeTab().tabTools); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(SandItems.modid + ":" + this.getUnlocalizedName().substring(5)); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ So I first tried to import the net.minecraft.creativetab.CreativeTabs but it still gave me the same message. Then I tried changing this.setCreativeTab(getCreativeTab().tabTools); to this.setCreativeTab(CreativeTabs.tabTools); but Then it just gave me a crash again. What am I doing wrong?
July 30, 201411 yr Author Hey I don't know if this helps but in eclipse I clicked the button to run the sever and it gave me the same message. [EDIT] never mind about this I changed (getCreativeTab().tabTools) back to (CreativeTabs.tabTools); and every thing in the eclipse development sever and client but it is still giving me problems when I make my mod in to a jar file and run it with the real minecraft. Would it help if I post the crash report? also I am working on a different mod as well and it is giving me problems too.
July 31, 201411 yr Author Ok I did that and it fails and tells me com.google.gson.stream.MalformedJsonExption: Unterminated string. What does that mean?
July 31, 201411 yr Author It says. Build failed with an eception. * What went wrong: A problem occured configuring root project 'SandItems'. com.google.gson.stream.MalformedJsonException: Unterminated string at line 3485 column 49. I am working on a mod pack so I have two mods. This is the code for both the mods. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ package net.SandItems.mod; import net.SandItems.mod.items.SandAxe; import net.SandItems.mod.items.SandHoe; import net.SandItems.mod.items.SandPickaxe; import net.SandItems.mod.items.SandShovel; import net.SandItems.mod.items.SandSword; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; 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.registry.GameRegistry; @Mod(modid = SandItems.modid, version = SandItems.version, name = SandItems.name) public class SandItems { public static final String modid = "sandItems"; public static final String version = "v1.0"; public static final String name = "SandStoneItems"; public static ToolMaterial Sandy = EnumHelper.addToolMaterial("Sandy", 1, 125, 4.0F, 1.0F, 10); public static Item itemSandPickaxe; public static Item itemSandSword; public static Item itemSandShovel; public static Item itemSandAxe; public static Item itemSandHoe; @EventHandler public void PreInit(FMLPreInitializationEvent preEvent){ itemSandPickaxe = new SandPickaxe(Sandy).setUnlocalizedName("SandPick"); itemSandSword = new SandSword(Sandy).setUnlocalizedName("SandSword"); itemSandShovel = new SandShovel(Sandy).setUnlocalizedName("SandShovel"); itemSandAxe = new SandAxe(Sandy).setUnlocalizedName("SandAxe"); itemSandHoe = new SandHoe(Sandy).setUnlocalizedName("SandHoe"); GameRegistry.registerItem(itemSandPickaxe, "SandPickaxe"); GameRegistry.registerItem(itemSandSword, "SandSword"); GameRegistry.registerItem(itemSandShovel, "SandShovel"); GameRegistry.registerItem(itemSandAxe, "SandAxe"); GameRegistry.registerItem(itemSandHoe, "SandHoe"); } @EventHandler public void Init(FMLInitializationEvent event){ GameRegistry.addRecipe(new ItemStack(itemSandPickaxe), new Object[]{"ccc", " x ", " x ", 'x', Items.stick, 'c',new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(itemSandSword), new Object[]{" c ", " c ", " x ", 'x', Items.stick, 'c',new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(itemSandShovel), new Object[]{" c ", " x ", " x ", 'x', Items.stick, 'c',new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(itemSandAxe), new Object[]{"cc ", "cx ", " x ", 'x', Items.stick, 'c',new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(itemSandHoe), new Object[]{"cc ", " x ", " x ", 'x', Items.stick, 'c',new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE)}); } @EventHandler public void PostInit(FMLPostInitializationEvent PostEvent){ } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.SandItems.mod.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.SandItems.mod.SandItems; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemAxe; import net.minecraft.creativetab.CreativeTabs; public class SandAxe extends ItemAxe { public SandAxe(ToolMaterial p_i45327_1_) { super(p_i45327_1_); this.setCreativeTab(CreativeTabs.tabTools); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(SandItems.modid + ":" + this.getUnlocalizedName().substring(5)); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.SandItems.mod.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.SandItems.mod.SandItems; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemHoe; import net.minecraft.creativetab.CreativeTabs; public class SandHoe extends ItemHoe { public SandHoe(ToolMaterial p_i45343_1_) { super(p_i45343_1_); this.setCreativeTab(CreativeTabs.tabTools); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(SandItems.modid + ":" + this.getUnlocalizedName().substring(5)); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.SandItems.mod.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.SandItems.mod.SandItems; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemPickaxe; import net.minecraft.creativetab.CreativeTabs; public class SandPickaxe extends ItemPickaxe { public SandPickaxe(ToolMaterial p_i45347_1_) { super(p_i45347_1_); this.setCreativeTab(CreativeTabs.tabTools); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(SandItems.modid + ":" + this.getUnlocalizedName().substring(5)); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.SandItems.mod.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.SandItems.mod.SandItems; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemSpade; import net.minecraft.creativetab.CreativeTabs; public class SandShovel extends ItemSpade { public SandShovel(ToolMaterial p_i45353_1_) { super(p_i45353_1_); this.setCreativeTab(CreativeTabs.tabTools); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(SandItems.modid + ":" + this.getUnlocalizedName().substring(5)); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.SandItems.mod.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.SandItems.mod.SandItems; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemSword; import net.minecraft.creativetab.CreativeTabs; public class SandSword extends ItemSword { public SandSword(ToolMaterial p_i45356_1_) { super(p_i45356_1_); this.setCreativeTab(CreativeTabs.tabCombat); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(SandItems.modid + ":" + this.getUnlocalizedName().substring(5)); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.classicBlocks.mod; import net.classicBlocks.mod.blocks.ClassicBrick; import net.classicBlocks.mod.blocks.ClassicCobble; import net.classicBlocks.mod.blocks.ClassicMossy; import net.minecraft.init.Blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; 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.registry.GameRegistry; @Mod(modid = classicBlock.modid, version = classicBlock.version, name = classicBlock.name) public class classicBlock { public static final String modid = "classicBlocks"; public static final String version = "v1.0"; public static final String name = "ClassicBlocks"; public static Block blockClassicBrick; public static Block blockClassicCobble; public static Block blockClassicMossy; @EventHandler public void PreInit(FMLPreInitializationEvent preEvent){ blockClassicBrick = new ClassicBrick(Material.rock).setBlockName("classicBrick"); blockClassicCobble = new ClassicCobble(Material.rock).setBlockName("ClassicStoneCobble"); blockClassicMossy = new ClassicMossy(Material.rock).setBlockName("ClassicStoneMossy"); GameRegistry.registerBlock(blockClassicBrick, "ClassicBrick"); GameRegistry.registerBlock(blockClassicCobble, "ClassicCobbleStone"); GameRegistry.registerBlock(blockClassicMossy, "ClassicMossyStone"); } @EventHandler public void Init(FMLInitializationEvent event){ GameRegistry.addShapelessRecipe(new ItemStack(blockClassicBrick), Blocks.brick_block); GameRegistry.addShapelessRecipe(new ItemStack(blockClassicCobble), Blocks.cobblestone); GameRegistry.addShapelessRecipe(new ItemStack(blockClassicMossy), Blocks.mossy_cobblestone); } @EventHandler public void PostInit(FMLPostInitializationEvent PostEvent){ } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.classicBlocks.mod.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.SandItems.mod.SandItems; import net.classicBlocks.mod.classicBlock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; public class ClassicBrick extends Block { public ClassicBrick(Material material) { super(material); this.setHardness(2.0F); this.setResistance(10.0F); this.setStepSound(soundTypePiston); this.setCreativeTab(CreativeTabs.tabBlock); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister){ this.blockIcon = iconRegister.registerIcon(classicBlock.modid + ":" + this.getUnlocalizedName().substring(5)); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.classicBlocks.mod.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.classicBlocks.mod.classicBlock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; public class ClassicCobble extends Block { public ClassicCobble(Material material) { super(material); this.setHardness(2.0F); this.setResistance(10.0F); this.setStepSound(soundTypePiston); this.setCreativeTab(CreativeTabs.tabBlock); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister){ this.blockIcon = iconRegister.registerIcon(classicBlock.modid + ":" + this.getUnlocalizedName().substring(5)); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } package net.classicBlocks.mod.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.classicBlocks.mod.classicBlock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; public class ClassicMossy extends Block { public ClassicMossy(Material material) { super(material); this.setHardness(2.0F); this.setResistance(10.0F); this.setStepSound(soundTypePiston); this.setCreativeTab(CreativeTabs.tabBlock); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister){ this.blockIcon = iconRegister.registerIcon(classicBlock.modid + ":" + this.getUnlocalizedName().substring(5)); } }
July 31, 201411 yr Could it be that the Crash is caused by this line in the Tool Class ? this.setCreativeTab(getCreativeTab().tabTools); i recommend to use this.setCreativeTabs(CreativeTabs.tabTools);
July 31, 201411 yr Author Ok but if I should not put 2 mods in one workspace then what should I do? If I have to create a new workspace for every mod then I will have to go through the gradlew setupDecompWorkspace for every mod I want to make and my computer will be workspaces every where. but could this be the problem?
August 1, 201411 yr Author Alright well I removed classicBlocks from the workspace but when I use gradlew build it gives me the same error. What does unterminated string mean?
August 1, 201411 yr Author Do you suggest that I delete my current work space and rebuild my mod in a new one to see if that works?
August 1, 201411 yr Author Hey so I don't think it has any thing to do with my code at all. You see I wanted to see if it would work so I tried to create a new workspace, and when I ran gradlew setupDecompWorkspace it then game me the same message. When I first created my workspace I have now I had java7 32-bit but I decided to change that to 64-bit because I was tiered of minecraft messing up all the time. So when I upgraded it it then changed the dir from Program Files (x86) to Program files so I had to change my JAVA_HOME. And now it is giving me that problem. this is how I have my JAVA_HOME set C:\Program Files\Java\jdk1.7.0_65 and this is how I have it in my system path "C:\Program Files\Java\jdk1.7.0_65\bin" Could it be because of java 64-bit or do I have something wrong with my Variables?
August 2, 201411 yr If you were using Java 32 bit and now have Java 64 bit, and you use Eclipse, you will need the 64 bit Eclipse. I went throught a similar issue when I updated my Java to 64 bit.
August 3, 201411 yr Author Thanks diesieben07, that worked. One question though. When you run the gradlew build where does it put the .jar file also how do I add a mcmod.info file? I can't figure out how to do that.
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.