Mystify Posted January 18, 2015 Posted January 18, 2015 When I run my mod from eclipse, it works fine. When I build it, I get a couple of issues. The first is that some deleted folders end up in the resulting jar. Specifically, the examplemod is still present, and a folder I renamed reverts back to an old name. I can delete the example mod folders again and rename it in the jar to resolve the errors that result. When I try to run the jar, I get an invocation target exception, Reveal hidden contents ---- Minecraft Crash Report ---- // Ouch. That hurt Time: 1/18/15 3:59 PM Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderException: java.lang.reflect.InvocationTargetException at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:225) at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:182) at com.mystify.galactic.blocks.ColoredBlock.<init>(ColoredBlock.java:33) at com.mystify.galactic.blocks.AlienStone.<init>(AlienStone.java:32) at com.mystify.galactic.Galactic.preinit(Galactic.java:231) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:413) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:325) at net.minecraft.client.main.Main.main(SourceFile:120) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:211) ... 41 more Caused by: java.lang.NoSuchMethodError: com.mystify.galactic.blocks.ColoredBlockItemBlock.setMaxDamage(I)Lnet/minecraft/item/Item; at com.mystify.galactic.blocks.ColoredBlockItemBlock.<init>(ColoredBlockItemBlock.java:16) ... 46 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_71, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 76417864 bytes (72 MB) / 302235648 bytes (288 MB) up to 1060372480 bytes (1011 MB) JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.10 FML v8.0.14.1289 Minecraft Forge 11.14.0.1289 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{8.0.14.1289} [Forge Mod Loader] (forge-1.8-11.14.0.1289-1.8.jar) Unloaded->Constructed->Pre-initialized Forge{11.14.0.1289} [Minecraft Forge] (forge-1.8-11.14.0.1289-1.8.jar) Unloaded->Constructed->Pre-initialized galactic{.1} [Galactic Colored Blocks] (Galactic Blocks-1.8-0.1.jar) Unloaded->Constructed->Errored the line that the error comes from is "this.setMaxDamage(0);" in the constructor of a class that extends ItemBlock Quote
Mystify Posted January 18, 2015 Author Posted January 18, 2015 package com.mystify.galactic.blocks; import net.minecraft.block.Block; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.registry.GameRegistry; public class ColoredBlockItemBlock extends ItemBlock { IColoredBlock cBlock; public ColoredBlockItemBlock(Block block) { super(block); cBlock=(IColoredBlock)block; this.setMaxDamage(0); this.setHasSubtypes(true); } /** * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is * placed as a Block (mostly used with ItemBlocks). */ public int getMetadata(int damage) { return damage; } /** * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have * different names based on their damage or NBT. */ public String getUnlocalizedName(ItemStack stack) { return cBlock.getFullName(stack.getMetadata()); } } package com.mystify.galactic; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Iterator; import com.mystify.galactic.blocks.AlienCoarseDirt; import com.mystify.galactic.blocks.AlienCobble; import com.mystify.galactic.blocks.AlienCobbleMossy; import com.mystify.galactic.blocks.AlienCobbleSlab; import com.mystify.galactic.blocks.AlienCobbleSlabDouble; import com.mystify.galactic.blocks.AlienCobbleStairs; import com.mystify.galactic.blocks.AlienCobbleWall; import com.mystify.galactic.blocks.AlienCobbleWallMossy; import com.mystify.galactic.blocks.AlienDirt; import com.mystify.galactic.blocks.AlienDoor; import com.mystify.galactic.blocks.AlienFarmland; import com.mystify.galactic.blocks.AlienFence; import com.mystify.galactic.blocks.AlienFenceGate; import com.mystify.galactic.blocks.AlienGrass; import com.mystify.galactic.blocks.AlienGravel; import com.mystify.galactic.blocks.AlienLever; import com.mystify.galactic.blocks.AlienLog; import com.mystify.galactic.blocks.AlienPlankSlab; import com.mystify.galactic.blocks.AlienPlankSlabDouble; import com.mystify.galactic.blocks.AlienPlankStairs; import com.mystify.galactic.blocks.AlienPlanks; import com.mystify.galactic.blocks.AlienSand; import com.mystify.galactic.blocks.AlienSandstone; import com.mystify.galactic.blocks.AlienSandstoneCarved; import com.mystify.galactic.blocks.AlienSandstoneSlab; import com.mystify.galactic.blocks.AlienSandstoneSlabDouble; import com.mystify.galactic.blocks.AlienSandstoneSmooth; import com.mystify.galactic.blocks.AlienSandstoneStairs; import com.mystify.galactic.blocks.AlienStone; import com.mystify.galactic.blocks.AlienStoneBrick; import com.mystify.galactic.blocks.AlienStoneBrickCarved; import com.mystify.galactic.blocks.AlienStoneBrickCracked; import com.mystify.galactic.blocks.AlienStoneBrickMossy; import com.mystify.galactic.blocks.AlienStoneBrickSlab; import com.mystify.galactic.blocks.AlienStoneBrickSlabDouble; import com.mystify.galactic.blocks.AlienStoneBrickStairs; import com.mystify.galactic.blocks.AlienStoneButton; import com.mystify.galactic.blocks.AlienStonePressurePlate; import com.mystify.galactic.blocks.AlienStoneSlab; import com.mystify.galactic.blocks.AlienStoneSlabDouble; import com.mystify.galactic.blocks.AlienTrapdoor; import com.mystify.galactic.blocks.AlienWoodButton; import com.mystify.galactic.blocks.AlienWoodPressurePlate; import com.mystify.galactic.blocks.ColoredBlock; import com.mystify.galactic.blocks.ColoredBlockItemBlock; import com.mystify.galactic.blocks.IColoredBlock; import com.mystify.galactic.blocks.SlabItemBlock; import com.mystify.galactic.items.AlienDoorItem; import com.mystify.galactic.items.IColoredItem; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @Mod(modid = References.MODID, version = References.VERSION) public class Galactic { public static Block alienStone; @Mod.EventHandler public void preinit(FMLPreInitializationEvent event) { alienStone = new AlienStone(); } @Mod.EventHandler public void init(FMLInitializationEvent event) { Recipes.initRecipies(); if(event.getSide() == Side.CLIENT) { //blocks addColorVariantsFor(alienStone); } } private void addColorVariantsFor(Block block){ EnumDyeColor[] aenumdyecolor = EnumDyeColor.values(); int i = aenumdyecolor.length; Item itemVersion = GameRegistry.findItem(References.MODID, ((IColoredBlock) block).getName()); String[] variants = new String[i]; for (int j = 0; j < i; ++j) { String fullySpecifiedName=References.MODID + ":" + ((IColoredBlock) block).getName()+"."+ aenumdyecolor[j].getUnlocalizedName(); variants[j]=fullySpecifiedName; String registeredName=References.MODID + ":" + ((IColoredBlock) block).getName()+"."+ aenumdyecolor[j].getUnlocalizedName(); registerBlock(block, j,registeredName); } ModelBakery.addVariantName(Item.getItemFromBlock(block), variants); } public static void registerBlock(Block block, int metadata, String blockName) { registerItem(Item.getItemFromBlock(block), metadata, blockName); } } public class AlienStone extends ColoredBlock { public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); public AlienStone(){ super(Material.rock,"alienStone"); this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumDyeColor.WHITE)); setHardness(1.5F).setResistance(10.0F).setStepSound(soundTypePiston); } public abstract class ColoredBlock extends Block implements IColoredBlock { public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); private String name; public ColoredBlock(Material material, String name){ super(material); this.name=name; GameRegistry.registerBlock(this, ColoredBlockItemBlock.class,name); setUnlocalizedName(References.MODID+"_"+name); setCreativeTab(Galactic.tabColoredBlock); } I cut out most of the classes, but this should be all the relevant code for where the exception occurs Quote
shadowfacts Posted January 18, 2015 Posted January 18, 2015 Show your build.gradle file. Quote Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
Mystify Posted January 18, 2015 Author Posted January 18, 2015 buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } apply plugin: 'forge' version = "1.8-0.1" group= "com.mystify.galactic" archivesBaseName = "Galactic Blocks" minecraft { version = "1.8-11.14.0.1289-1.8" runDir = "eclipse" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not allways work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "snapshot_nodoc_20141130" } dependencies { // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } Quote
Mystify Posted January 19, 2015 Author Posted January 19, 2015 I tried reverting to an earlier forge version from last month, but it changed nothing. I tried commenting out the method call the stack trace was being thrown on, but it just threw it at the next line instead. I made a simpler mod with a single crafting recipe and no new blocks and it ran without issue. Could it be an issue with the mappings? Are the ones I'm using actually for 1.8? Quote
coolAlias Posted January 19, 2015 Posted January 19, 2015 Your build.gradle looks totally fine. Have you tried using an earlier version of Forge 1.8? I've been using 1.8-11.14.0.1281-1.8 with those mappings and the jar builds and runs with no issues. Quote http://i.imgur.com/NdrFdld.png[/img]
Mystify Posted January 19, 2015 Author Posted January 19, 2015 On 1/19/2015 at 6:05 AM, coolAlias said: Your build.gradle looks totally fine. Have you tried using an earlier version of Forge 1.8? I've been using 1.8-11.14.0.1281-1.8 with those mappings and the jar builds and runs with no issues. That is exactly the version of forge I rolled back to to test, and I had the same error. Quote
Mystify Posted January 19, 2015 Author Posted January 19, 2015 I tried making a smaller version with just the code I posted and it worked fine. My current theory is that it has something to do with the renamed folder. Does anyone know how gradle can be including deleted folders in the build, or use old folder names? Quote
coolAlias Posted January 19, 2015 Posted January 19, 2015 Run 'gradlew clean', refresh your workspace, then try again. Sometimes the workspace does not register changes you make if you make them in Windows Explorer - for example, if I am browsing a folder and change a texture name, Eclipse still thinks it's the old name until I tell it to refresh. I've never had it affect the actual build, though... worth a try I suppose. Quote http://i.imgur.com/NdrFdld.png[/img]
Mystify Posted January 20, 2015 Author Posted January 20, 2015 the clean seemed to do the trick. Thank you all for your help Quote
Recommended Posts
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.