Jump to content

[Solved][1.7.10] Built mod doesn't seem to register recipes


Parad0x

Recommended Posts

Hey!

 

I'm new to forge modding, and this is probably just me being an idiot, but whenever I build my mod (either gradlew build or gradlew runClient), my recipes do not register.

It works in eclipse run, not gradlew build. I messed around with a bunch of things, but I still couldn't get it to work.

Anyways, it looks something along the lines of this now:

Generic.java

package tutorial.generic;

//Imports snipped

@Mod(modid=Generic.MODID, name=Generic.MODNAME, version=Generic.MODVER) //Tell forge "Oh hey, there's a new mod here to load."
public class Generic //Start the class Declaration
{
    //Set the ID of the mod (Should be lower case).
    public static final String MODID = "generic";
    //Set the "Name" of the mod.
    public static final String MODNAME = "somename";
    //Set the version of the mod.
    public static final String MODVER = "0.0.1";

    @Instance(value = Generic.MODID) //Tell Forge what instance to use.
    public static Generic instance;
    
    @SidedProxy(clientSide = "tutorial.generic.ClientProxy", serverSide = "tutorial.generic.ServerProxy")
    public static CommonProxy proxy;
    
    static GenEventHandler events = new GenEventHandler();
       
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
    	proxy.preInit(event);
    	FMLCommonHandler.instance().bus().register(events);
    	MinecraftForge.EVENT_BUS.register(events);
    	GenericEntity.mainRegistry();
    	GameRegistry.addShapelessRecipe(new ItemStack(GenericItem.genericItem), new Object[] {Blocks.dirt});
    	GameRegistry.addRecipe(new ItemStack(GenericItem.genericItem),"  B"," A ","A  ",'A',Items.stick, 'B', Items.redstone);
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	proxy.init(event);
    }
       
    @EventHandler
    public void load(FMLInitializationEvent event)
    {

    }
       
    @EventHandler
    public void postInit(FMLPostInitializationEvent event)
    {
    	proxy.postInit(event);
    }
}

GenericItem.java

package tutorial.generic;

//Imports snipped

public class GenericItem extends Item {

public static Item genericItem;

@SideOnly(Side.CLIENT)
public EnumRarity getRarity(ItemStack par1ItemStack)
{
	return EnumRarity.epic;
}

public GenericItem(){
	setMaxStackSize(1);
	setCreativeTab(CreativeTabs.tabCombat);
	setUnlocalizedName("genericItem");
	setTextureName(Generic.MODID + ":genericTexture");
	setMaxDamage(400);
	setFull3D();
}

@EventHandler
public static final void init() {
	genericItem = new GenericItem()
	.setMaxStackSize(1)
	.setCreativeTab(CreativeTabs.tabCombat)
	.setUnlocalizedName("genericItem")
	.setTextureName(Generic.MODID + ":genericTexture")
	.setMaxDamage(400)
	.setFull3D();
	GameRegistry.registerItem(genericItem, "genericItem"); 


}

CommonProxy.java

package tutorial.generic;

//Imports snipped

public class CommonProxy {

    public void preInit(FMLPreInitializationEvent e) {
    	GenericItem.init();
    }

    public void init(FMLInitializationEvent e) {

    }

    public void postInit(FMLPostInitializationEvent e) {

    }

}

 

build.gradle

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.0"
group= "tutorial.generic.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"

sourceSets {
    main {
        java { srcDirs = ["$projectDir/src/java"] }
        resources { srcDirs = ["$projectDir/src/resources"] }
    }
}

minecraft {
    version = "1.7.10-10.13.4.1558-1.7.10"
    runDir = "eclipse"
}

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'
    }
}

Link to comment
Share on other sites

After messing around a bit, adding some things, and trying to build it again, it now appears, that CommonProxy.class does not exist in the jar. 

 

Furthermore, assets\generic\textures only contains "entity" but should contain entity and "items"

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.