Jump to content

1.7.10 latest forge. A bug I cannot understand


PixelPacker

Recommended Posts

When I was trying to make a new ore for the mod and eclipse and minecraft don't like it when it is almost the same exact code as the other blocks but I may have messed up somewhere. yes I did extended the block and did the constructer here is the code for the stuff that is causing me problems.

 

Package:

package pixelpacker.testmod;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

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.registry.GameRegistry;

 

@Mod(modid = "tm", name = "Test Mod", version = "1.0")

public class TestMod {

 

public static Item itemTable;

 

public static Block blockTable;

 

public static Block blockTest;

 

public static Block blockPixinite;

 

 

@EventHandler

    public void preInit(FMLPreInitializationEvent event){

 

blockPixinite = new BlockPixinite().setUnlocalizedName("BlockPixinite").setTextureName("tm:PixiniteOre").setCreativeTab(tabTestMod);

 

itemTable = new ItemTable().setUnlocalizedName("ItemTable").setTextureName("tm:itemtable").setCreativeTab(tabTestMod);

 

GameRegistry.registerItem(itemTable, itemTable.getUnlocalizedName().substring(5)); 

 

GameRegistry.registerBlock(blockPixinite, blockPixinite.getUnlocalizedName().substring(5));

}

@EventHandler

public void init(FMLInitializationEvent event) {

 

  GameRegistry.addRecipe(new ItemStack(itemTable, 10), new Object[]{"WWW",

                                                            " W ",

                                                            " W ", 'W', Blocks.planks});

     

    }

    @EventHandler

    public void postInit(FMLPostInitializationEvent event) {

   

   

    }

    public static CreativeTabs tabTestMod = new CreativeTabs("tabTestMod"){

    @Override

    public Item getTabIconItem(){

        return new ItemStack(blockTest).getItem();

    }

    };

}

   

 

The line of code in question:

blockPixinite = new BlockPixinite().setUnlocalizedName("BlockPixinite").setTextureName("tm:PixiniteOre").setCreativeTab(tabTestMod);

 

Pixinite code:

package pixelpacker.testmod;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.item.Item;

 

public class BlockPixinite extends Block {

 

protected BlockPixinite(Material material) {

super(material);

// TODO Auto-generated constructor stub

}

 

 

 

 

 

}

 

 

 

 

 

Link to comment
Share on other sites

Please - learn Java before modding.

 

1. Constructor can't be protected - make it public to be able to use it outside inheriting classes.

2. Constructor takes Material as argument, you can't construct it without it. Material.class (lookup vanilla).

1.7.10 is no longer supported by forge, you are on your own.

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.