Jump to content

Recommended Posts

Posted

I am pretty new to creating my own Mods using Forge.

I tried a simple one, but it does not worked. It was supposed to melt a self created ore into a self created item. I had no problems with creating a recipe 1 diamond -> 8 coal for example. But it does not work with own blocks. The ore block i want to melt and the item works perfectly fine btw ( texture, getting effects by rightclicking item etc.)

And sorry for my bad english :/

 

package de.jens;



import de.jens.blocks.BlockAmethystOre;
import de.jens.items.ItemAmethyst;
import de.jens.items.ItemAmethystAxe;
import de.jens.items.ItemAmethystHoe;
import de.jens.items.ItemAmethystPickaxe;
import de.jens.items.ItemAmethystSpade;
import de.jens.items.ItemAmethystSword;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
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.ItemAxe;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraftforge.common.util.EnumHelper;
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.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = Firststeps.MODID)
public class Firststeps {

public static final String MODID = "firststeps";


//tools

public static ToolMaterial amethystToolMaterial = EnumHelper.addToolMaterial("amethystToolMaterial", 3, 1000, 15.0F, 10, 10);



// Items
public static Item amethyst = new ItemAmethyst();
public static ItemSword amethystSword = new ItemAmethystSword();
public static ItemAxe amethystAxe = new ItemAmethystAxe();
public static ItemHoe amethystHoe = new ItemAmethystHoe();
public static ItemPickaxe amethystPickaxe = new ItemAmethystPickaxe();
public static ItemSpade amethystSpade = new ItemAmethystSpade();

//blocks
public static Block amethystOre = new BlockAmethystOre();





@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	//shapeless crafting
	ItemStack stackWool = new ItemStack(Blocks.wool);
	ItemStack stackWeb5 = new ItemStack(Blocks.web, 5);
	GameRegistry.addShapelessRecipe(stackWeb5, stackWool);

	//crafting
	ItemStack stackStone = new ItemStack(Blocks.stone);
	ItemStack stackCobbleStone = new ItemStack(Blocks.cobblestone);
	ItemStack stackDispenser = new ItemStack(Blocks.dispenser);
	GameRegistry.addRecipe(stackDispenser, "ccc","c c","sss", 'c', stackCobbleStone, 's', stackStone);

	//smelting
	ItemStack stackDiamond = new ItemStack(Items.diamond);
	ItemStack stackCoalBlock8 = new ItemStack(Blocks.coal_block, ;
	ItemStack stackAmethystOre = new ItemStack(amethystOre);
	ItemStack stackAmethyst = new ItemStack(amethyst);

	GameRegistry.addSmelting(stackAmethystOre, stackAmethyst, 10000);
	GameRegistry.addSmelting(stackDiamond, stackCoalBlock8, 1000);
}

@EventHandler
public void init(FMLInitializationEvent event) {
	//item registry
	GameRegistry.registerItem(amethyst, "amethyst"); 
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(amethyst, 0, new ModelResourceLocation("firststeps:amethyst", "inventory"));

	GameRegistry.registerItem(amethystAxe, "amethystAxe");
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(amethystAxe, 0, new ModelResourceLocation("firststeps:amethystAxe", "inventory"));

	GameRegistry.registerItem(amethystPickaxe, "amethystPickaxe");
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(amethystPickaxe, 0, new ModelResourceLocation("firststeps:amethystPickaxe", "inventory"));

	GameRegistry.registerItem(amethystHoe, "amethystHoe");
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(amethystHoe, 0, new ModelResourceLocation("firststeps:amethystHoe", "inventory"));

	GameRegistry.registerItem(amethystSpade, "amethystSpade");
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(amethystSpade, 0, new ModelResourceLocation("firststeps:amethystSpade", "inventory"));












	GameRegistry.registerItem(amethystSword, "amethystSword");
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(amethystSword, 0, new ModelResourceLocation("firststeps:amethystSword", "inventory"));

	//block registry
	 GameRegistry.registerBlock(amethystOre, "amethyst_ore");
	 Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(amethystOre), 0, new ModelResourceLocation("firststeps:amethyst_ore","inventory")); 

}


@EventHandler
public void postInit(FMLPostInitializationEvent event) {


}


}

 

 

Posted

1) You are registering your recipes before the

Items

, this will not work.

2) Register your

Item

s in preInit

3) You are registering your renderers in common code, move this to your ClientProxy.

4) Use

ModelLoader.setCustomModelResourceLocation

instead of

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register

5) Don't instantiate your Items on the same line where you declare them. Do it right before you register them.

 

There are probably more issues with your code, and I'm not going to bother looking for all of them.

 

Either way, the tutorial you are using is pretty bad. Look for a good one instead, or come back here for help after you fix the main 5 issues I pointed out.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Also update.  If you really want to use 1.8, then update to 1.8.9

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.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hey, sorry I haven't said anything in a while. I was banned on here for sending you straight up crash logs and they banned me for spam... but I learned that these forums are for forge only and I was working with neoforge... but thank you for all the help.
    • la verdad nose que hago
    • Ok i check and this is real axioM, BUT i have seen strange thing when mods less then 100 is working great but when its more then 100, i got crash   i realy need this mod can i some how fix it? or only delete axiom
    • It is an issue with the mod Axiom
    • I am in 1.20.1, and I have about 50 mods, I'd say. But for some reason, the search bar broke at some point. It's a real pain to search for a certain object.. Mods that I have(I had to write ALL OF THESE OUT arhg): Epic Knights. AI-Improvements, Alexscaves, alexsmobs, AmbientSounds, Aquamirae, Architectury, Betterfpsdist, BiomesOPlenty, Bookshelf, Born In Chaos, Bountiful Critters, CarbonConfig, Citadel, Cloth config, Clumps, Corgilib, Creative Core, Creeperoverhaul, crittersandcompanions, CullLessLeaves, Cupboard, Duckling, Embeddium, Enchantment Descriptions, Enderman Overhaul, Entity Model Features, Entity Texture Features, Entity Culling, Exotic Birds, Extra Sounds, Falling Leaves, Farmers Delight, Fast Leaf Decay, Fastload, Ferritecore, FpsReducer2, Framework Forge, Gamma Creatures Mod, Geckolib, Geophilic, Ghosts, Goblin Traders, Gpumemleakfix, Guardvillagers, Ichunutil, ImmediatelyFast Forge, Immersive Paintings, Incendium, Konkrete Forge, Let Sleeping Dogs Lie, Make Bubbles Pop, MCW Bridges, MCW doors, MCW Fences, MCW lights, MCW paths, MCW trapdoors, Medieval Paintings, More Creative Tabs Combo, Nether's Overhaul, Nyfss Spiders Forge, Obscure Api, oculus MC, Oh The Biomes We've Gone, Oh The Trees You'll Grow, Physics Mod, Prehistoric Park, Quark Delight, Quark, Rainbow Reef, Refurbished Furniture Forge, Regrowth, Repurposed Structures, Resourcefulconfig, Ribbits, Rubidium, Saturn mc, Skin Layers 3d Forge, Smoothchunk, Starlight, Structory, TerraBlender, Terralith, Visuality, Water Erosion, Xaeros Minimap, Xaeros World Map, YungsApi, YungsBetter Desert Temples, Yungs Better Dungeons, Yungs Jungle Templates, Yungs Better Mineshafts, Yungs Better Nether Fortresses, Yungs Better Strongholds, Yungs Better Witch Huts, Yungs Bridges, Yungs Extras, Zeta.   Why isn't my search bar working!!!!😭
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.