Jump to content

Stupid Basic Issue


bigjme

Recommended Posts

Hi everyone. I'm sorry to have to post such a daft question but i can not figure this out.

 

I'm following the basic minecraft modding tutorials. on version 1.6.4 with the latest recommended forge environment and eclipse. I am having issues which probably one of the easiest tutorial sections.

http://www.minecraftforge.net/wiki/Basic_Blocks

 

My issue is, i have all the mod working but i am unable to dig anything with the Material.ground set. I am able to dig normal minecraft dirt but following the tutorial exactly im unable to dig the black. I have the ores section working which is pretty much the exact same code. and if i change the Material.ground to Material.rock it lets me dig it with a pickaxe but not a shovel as specified.

 

i have even tried to add a new Material using

"public static Material machine = (new Material(MapColor.dirtColor));"

 

but that wont work when i define that material either. Is this an issue with the action not executing? on my running test environment im unable to dig any blocks atall without the proper tool? i.e. i'm unable to dig normal dirt with my fist or any other tool but a shovel?

 

maybe i am missing something simple here.... i know its only basic but if i don't ask i will never learn. And i am slowly learning lava as i go

 

Thanks,

Jamie

Link to comment
Share on other sites

The hell?  What are you trying to do?

 

Material should be passed to super() as Material.Dirt, not creating a new material.

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

Right the tutorial shows how to add basic blocks. one of them being the same as dirt, and the other an ore. I have the ore one setup and working. it can be mined using a picaxe etc. like i wanted. I have smelting and crafting recipes working and items added in. But the "genericDirt" example doesn't work. It is there, has the right name etc. but i can not mine it with a shovel or any other tool. it acts as if the block is not there atall.

I know none of that will make sense so here's my code. I will cut it down to the bits you will want

 

Generic.java

package tutorial.generic;

// This Import list will grow longer with each additional tutorial.
// It's not pruned between full class postings, unlike other tutorial code.
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.item.crafting.FurnaceRecipes;

@Mod(modid="GenericModID", name="Generic", version="0.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class Generic 
{
        public static Block genericDirt;
        
        @Instance(value="generic")
        public static Generic instance;
        
        @SidedProxy(clientSide="tutorial.generic.client.ClientProxy", serverSide="tutorial.generic.CommonProxy")
        public static CommonProxy proxy;
        
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) 
        {
        	 
                genericDirt = new GenericBlock(503, Material.ground, 0.5F, Block.soundStoneFootstep, CreativeTabs.tabBlock, "genericDirt");
                LanguageRegistry.addName(genericDirt, "Generic Dirt");
                MinecraftForge.setBlockHarvestLevel(genericDirt, "shovel", 0);
                GameRegistry.registerBlock(genericDirt, "genericDirt");
                
                proxy.registerRenderers();
        }
}

 

genericBlock.java

package tutorial.generic;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.block.material.Material;
import net.minecraft.block.StepSound;

public class GenericBlock extends Block
{
         public GenericBlock(int id, Material material, float hardness, StepSound sound, CreativeTabs tab, String name) 
     {
             super(id, material);
             setHardness(hardness);
             setStepSound(sound);
             setUnlocalizedName(name);
             setCreativeTab(tab);
        }
        

}

 

 

code would have been  up sooner but was having trouble loading up the website. I am not using this code for a mod i would just rather know whats wrong with it to earn

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.



×
×
  • Create New...

Important Information

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