Jump to content

1.11.2 Creating custom Ore. [SOLVED]


DavidSullivan

Recommended Posts

New to this so bare with me please.

I am now making blocks no problem but I want to make a custom ore.

I can see there is a class BlockOre.

One would think that all ores drop metals so why don't they have a setItemDropped or SetOreDropped function?

Or am I missing something.

Do I really have to extend and override to return the idDropped?

 

If so what is the point of BlockOre?

 

Link to comment
Share on other sites

Because vanilla ore blocks drop themselves, which is handled by the super class,

Block

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.

Link to comment
Share on other sites

David what exactly are you looking to do?

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

I'm designing my first mod. I figure in order to build the stuff in my mod I will need some custom ores.

Figured I should add a copper ore, which would smelt to Copper_Ingots

 

then I could use those those in recipes to build custom engines and such in the future.

 

If Im reading this correct I simply extend the BlockOre and

 

@overide

public Item getItemDropped(IBlockState state, Random rand, int fortune)

 

 

or is this an old way of doing it?

Link to comment
Share on other sites

OK. I can make blocks and declare things like

 

cheese = new ItemFood(...

 

and I understand this gives said Item certain properties that make it act like food.

I can't find one that looks obvious like ItemOre or ItemMetal.

Is there one that makes it able to be melted in the forge?

 

 

 

 

 

Link to comment
Share on other sites

I'm designing my first mod. I figure in order to build the stuff in my mod I will need some custom ores.

Figured I should add a copper ore, which would smelt to Copper_Ingots

 

then I could use those those in recipes to build custom engines and such in the future.

 

If Im reading this correct I simply extend the BlockOre and

 

@overide

public Item getItemDropped(IBlockState state, Random rand, int fortune)

 

 

or is this an old way of doing it?

 

If you're looking to have a block that when destroyed it drops itself, do nothing. If you want this "Copper Ore" to drop "Copper Ingot" when destroyed, use

		this.getItemDropped(state, rand, fortune)

in the block class itself.

 

Is that right diesieben07?

 

 

 

OK. I can make blocks and declare things like

 

cheese = new ItemFood(...

 

and I understand this gives said Item certain properties that make it act like food.

I can't find one that looks obvious like ItemOre or ItemMetal.

Is there one that makes it able to be melted in the forge?

 

If you want a smelting recipe, you need to use GameRegistry.addSmelting in the init.

 

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

This seems like a really common task for most modders

has anyone ever created a custom ore and do you have a code example that will simplify this.

 

If not I will figure it out and post one eventually.

 

If you want example code for an ore, look in my signature for my GitHub on TeamMadness Mod, I made many ores there.

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

If you want a smelting recipe, you need to use GameRegistry.addSmelting in the init.
preInit.

 

Oh, I use my smelting and crafting recipes in the init. Sorry

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

These are great comments everyone thanks you. So taking different bits.

I made a normal block called copperBlock

in the language pack I called it Copper Ore.

 

when destroyed it drops a block of copper ore.

 

Then I added

 

GameRegistry.addSmelting(copperBlock, new ItemStack(ModItems.cheese, 2), 3F);

 

just to test it. cheese is a custom Item I added earlier.

 

now when I put the copper in the furnace it wont burn.

 

what am I missing

 

Link to comment
Share on other sites

Well, we don't have access to all of your code. Care to post any of it so we can actually help you?

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

Sure I'll start with this and you tell me if you need more.

 

package me.DSul.SullyModPack.Init;

 

import me.DSul.SullyModPack.ModInfo;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockOre;

import net.minecraft.block.material.MapColor;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemBlock;

import net.minecraft.item.ItemStack;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.model.ModelLoader;

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

 

 

 

/**

* Created by ManLand-PC on 1/19/2017.

*/

public class ModBlocks {

 

    public static Block cheeseBlock;

    public static Block copperBlock;

 

    public static void init(){

        cheeseBlock = new Block(Material.SPONGE).setUnlocalizedName("cheeseblock").setCreativeTab(CreativeTabs.DECORATIONS);

        copperBlock = new Block(Material.IRON).setUnlocalizedName("copperblock").setCreativeTab(CreativeTabs.DECORATIONS);

        copperBlock.setHardness(2f);

        GameRegistry.addSmelting(copperBlock, new ItemStack(ModItems.cheese, 2), 3F);

       

 

 

 

    }

    public static void registerBlocks(){

        registerBlock(cheeseBlock);

        registerBlock(copperBlock);

 

    }

    public static void registerRenders(){

        registerRender(cheeseBlock);

        registerRender(copperBlock);

 

    }

    public static void registerRender(Block block){

        Item item = Item.getItemFromBlock(block);

        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(ModInfo.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));

 

    }

    public static void registerBlock(Block block){

        GameRegistry.register(block, new ResourceLocation(ModInfo.MOD_ID, block.getUnlocalizedName().substring(5)));

        GameRegistry.register(new ItemBlock(block), new ResourceLocation(ModInfo.MOD_ID, block.getUnlocalizedName().substring(5)));

    }

}

 

Link to comment
Share on other sites

GameRegistry.addSmelting(copperBlock, new ItemStack(ModItems.cheese, 2), 3F);

 

By the way, "3.0" there isn't any different than "1.0"

The number is the "probability that the furnace will drop 1 experience per item smelted."  A value greater than 1 is treated as 1.

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.

Link to comment
Share on other sites

I found the problem.

 

***

I was GameRegistry.addSmelting(copperBlock, new ItemStack(ModItems.cheese, 2), 3F);

 

before I even registered the blocks.

 

Moved it to the end of

 

public static void registerBlocks(){

        registerBlock(cheeseBlock);

        registerBlock(copperBlock);

 

        GameRegistry.addSmelting(copperBlock, new ItemStack(ModItems.cheese, 2), 3F);

 

    }

 

and now it works.

 

 

Link to comment
Share on other sites

[[[ SOLVED ]]]

 

super easy to make custom ore blocks.

 

just create a normal block with your ore name then after registeringItems and registeringBlocks

--> so the game knows what you are working with

 

use

 

        GameRegistry.addSmelting(copperBlock, new ItemStack(ModItems.cheese, 2), 3F);

 

 

Link to comment
Share on other sites

Cough. [nobbc][nobbc][/nobbc] is a thing, guys.

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.

Link to comment
Share on other sites

It is a tag that prevents BBcode inside it from being parsed.

 

Watch.

 

[nobbc]This sentence is rendered as is[/nobbc]

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.

Link to comment
Share on other sites

  • 1 year later...
8 minutes ago, supreme marshal said:

I have the same problem, I created some custom block but when I create a Smelting Recipe, the block won't burn in the furnace. But I couldn't fix my problem like you did. 

This thread is a year old, if it didn't solve your problem start a new thread which contains all relevant info, such as your code and any errors.

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.

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.