Jump to content

Recommended Posts

Posted

Hi all

 

I created a basic recipe mod that makes a shapeless recipe. The shapeless recipe is 2 yellow flowers = 1 stone sword.

 

This was just a generic test I was doing to see if I wrote it all correct. Anywho, I was wondering once I write the code, how do I make it run?  I see it listed under mods in the main screen but it doesn't have a disable option or anything.

 

Thanks

 

Posted

Congratulations, it's running!

 

Unless you made a coding error, your recipe works!

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

here ya go. i changed it to sand and made it not shapeless to try and it still doesnt work.

 

 

package com.xenios.testmod;

 

import net.minecraft.enchantment.Enchantment;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.ItemStack;

import net.minecraft.util.WeightedRandomChestContent;

import net.minecraftforge.common.ChestGenHooks;

import net.minecraftforge.common.DungeonHooks;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

@Mod(modid = TestMod.MODID, version = TestMod.VERSION)

public class TestMod {

public static final String MODID = "xenios_testmod";

public static final String VERSION = "1.0 Alpha";

 

@EventHandler

public void init(FMLInitializationEvent event) {

 

// recipes

GameRegistry.addRecipe(new ItemStack(Items.apple), "XXX", "XXX", "XXX",

'X', Blocks.leaves);

GameRegistry.addShapelessRecipe(new ItemStack(Items.dye, 2, 1),

Items.redstone, new ItemStack(Items.dye, 1, 1));

// TEST

GameRegistry.addRecipe(new ItemStack(Items.stone_sword, 1), "XX", 'X',

Blocks.sand);

 

net.minecraftforge.fml.common.registry.GameRegistry.addSmelting(

Blocks.stone, new ItemStack(Blocks.stonebrick), 0.1F);

ItemStack enchantedSwordItemStack = new ItemStack(Items.stone_sword);

enchantedSwordItemStack.addEnchantment(Enchantment.sharpness, 1);

 

net.minecraftforge.fml.common.registry.GameRegistry.addShapelessRecipe(

enchantedSwordItemStack, Items.flint, Items.stone_sword);

 

// Dungeon changes

DungeonHooks.removeDungeonMob("Spider");

ChestGenHooks.removeItem(ChestGenHooks.DUNGEON_CHEST, new ItemStack(

Items.saddle));

ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST,

new WeightedRandomChestContent(

new ItemStack(Blocks.cobblestone), 25, 50, 10));

 

}

}

Posted

I have a book i got from barnes and noble i am following that teaches modding. i dont have any syntax errors so it all appears good.

 

The sand = swords part i threw in there myself since sand is easy to come by and i wanted to test the mod to see if i did it properly.

Posted

Alright. I havent tired the others, but the sand and flowers didnt work.

 

I honestly am new to minecraft, i got it so i can mod for fun and for educational purposes, so i might be doing something wrong. I dont think i am though.

Posted

Why do you do GameRegistry.xyz(); at one time and the line below you do

net.minecraftforge.fml.common.registry.GameRegistry.abc()

?

Maybe your inports are broken?

 

Otherwise after a quick testing it works for me...

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

I have the little impresion

youar putting the recipe on init() ,

but must be in preinit()

 

 

@Mod.EventHandler

    public void preInit(FMLPreInitializationEvent event) {

    Configuration config = new Configuration(event.getSuggestedConfigurationFile());

    MercenaryModBlocks.init();

    MercenaryModItems.init();

    MercenaryModRecipes.init();

   

    FMLCommonHandler.instance().bus().register(new mercenarymod.utilidades.KeyInputHandler());

    mercenarymod.utilidades.KeyBindings.init();

 

//KeyInputHandler

   

    }

Posted

Why do you do GameRegistry.xyz(); at one time and the line below you do

net.minecraftforge.fml.common.registry.GameRegistry.abc()

?

Maybe your inports are broken?

 

Otherwise after a quick testing it works for me...

 

 

Should I use one over the other? What's the difference?

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.