Jump to content

Recommended Posts

Posted

Just as how if you mine stone you get cobblestone (unless you use silk touch), I am trying to make it so that when basalt stone (added by me) is mined, it drops basalt cobblestone from IC2 (it's not actually basalt cobblestone, but it looks cobble-y).

I have this working for another stone I've added, but for that I added the cobble myself. It's the ore dict part I'm having trouble with.

 

According to the many tutorials I've looked at, you import "net.minecraftforge.oredict.OreDictionary", and in the 'getItemDropped' section instead of "return Item.getItemFromBlock(ModBlocks.basaltCobblestone);" one uses "return Item.getItemFromBlock(:blockBasalt);". Eclipse then tells me "blockBasalt cannot be resolved to a variable".

 

If I instead try "return Item.getItemFromBlock("blockBasalt");", "blockBasalt" shows up blue and the error reads "The method getItemFromBlock(Block) in the type Item is not applicable for the arguments (String)".

 

And combining the two "return Item.getItemFromBlock(":blockBasalt");", gives me the same error as the previous.

 

A lot of the tutorials/information on the ore dictionary (and Forge in general, depending on what aspects you're looking at) seem like they are for earlier versions, and so potentially out dated. The 'How to use the ore dictionary' tutorial is for 1.6.4, and I'm not sure how much regarding this has changed since then.

 

My block.class:

 

 

package com.fallingkitten.abstractadditions.blocks;

 

import java.util.Random;

 

import com.fallingkitten.abstractadditions.lib.Constants;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraftforge.oredict.OreDictionary;

 

public class BlockBasaltStone extends Block

{

 

private String name = "basaltStone";

 

public BlockBasaltStone()

{

super(Material.rock);

this.setBlockName(Constants.MODID + "_" + name);

                setBlockTextureName(Constants.MODID + ":" + name);

GameRegistry.registerBlock(this, name);

this.setCreativeTab(CreativeTabs.tabBlock);

setHardness(20.0F);

setResistance(45.0F);

setHarvestLevel("pickaxe", 0);

}

 

    @Override

    public Item getItemDropped(int metadata, Random random, int fortune) {

        return Item.getItemFromBlock(":blockBasalt");

    }

   

    @Override

    protected boolean canSilkHarvest()

    {

        return true;

    }

}

 

 

 

If anyone could help, that would be appreciated. Or point me in the direction of an up to date and informative tutorial.

Posted

1. You should understand basic java for modding.

2. OreDictionary#getOres(String name) gives List of Itemstack registered with the oredict id.

You could use first entry of it. (ofc you should check if the list is empty before that)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Yes, I realise the purpose of the ore dictionary. The fact that it is an IC2 block is incidental, in theory I want this to work with any basalt added by any mod (but IC2 is the only one I know of, and the only one I use that does, hence the mention of IC2). So going from that, I shouldn't have to specify IC2 in the code, should I? Else that would suggest that when drawing from the ore dictionary one would have to specify, say, all the copper ingots from all the mods which have them, and from what I've read that's not how it works.

 

Abastro, some people learn best by effectively poking at and playing with something, getting it wrong, and going from there.

 

Moving on, does anyone have some helpful input for me?

Posted
I want this to work with any basalt added by any mod

 

Drop your own block registered with the oreDict, the translation to any other basalt is what the ore dict DOES.

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

I want this to work with any basalt added by any mod

 

Drop your own block registered with the oreDict, the translation to any other basalt is what the ore dict DOES.

He might not want to add his own basalt block. Yes dropping another mods oredict item is not appropriate, but anyway he could want that.

 

@fallingkitten

Anyway, as @Draco18 said creating your own Bassalt block and registering it to the OreDict is better way.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Oh, sure you could use another block from the oreDict, that'd be fine too. :)

You just don't need to care which one.

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

If I understand what the original poster is trying to do, I think Abastro's recommendation to get the list of ores from the ore dict and work with that seems like the best approach. You could drop the first thing in the list, or randomize which one comes out. Like if 5 mods for some reason all added basalt then you could randomly choose from the list.

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.