Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

}

 

 

 

 

 

}

 

 

 

 

 

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.