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

I'm trying to do meta data blocks but I keep getting errors. Also how would I give each block a texture. The tutorial on it wasn't very in depth.For the code look at the metadata blocks tutorials because I was basically going off that. http://www.minecraftforge.net/wiki/Metadata_Based_Subblocks

 

The method getItemNameIS(ItemStack) of type BrickItems must override or implement a supertype method(works when i remove the @Override)

@Override

public String getItemNameIS(ItemStack itemstack) {

return getItemName() + "." + subNames[itemstack.getItemDamage()];

}

 

 

The method setItemName(String) is undefined for the type BrickItems

setItemName("brick");

 

The method getTextureFile() of type Brick must override or implement a supertype method

public String getTextureFile () {

return CommonProxy.BLOCK_PNG;

}

i can help you with the textures

 

show your source codes at least, so i can see what you already have, just show the block and itemblock that you have,

  • Author

Main class:

 

package whatsfast.MoreBricks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
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;

@Mod(modid="moreBricks", name="More Bricks", version="1.5.2 V0.1")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class MoreBricks {
	public static final int brickID = 502;
	public static final Block brick = new Brick(brickID);

	private static final String[] multiBlockNames = { 
		"White Brick", "Orange Brick", "Magenta Brick", "Light Blue Brick",
		"Yellow Brick", "Light Green Brick", "Pink Brick", "Dark Grey Brick",
		"Light Grey Brick", "Cyan Brick", "Purple Brick", "Blue Brick",
		"Brown Brick", "Green Brick", "Red Brick", "Black Brick"
	};


        // The instance of your mod that Forge uses.
        @Instance("moreBricks")
        public static MoreBricks instance;
        
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="whatsfast.minecraft.MoreBricks.ClientProxy", serverSide="whatsfast.minecraft.MoreBricks.CommonProxy")
        public static CommonProxy proxy;
        
        @PreInit
        public void preInit(FMLPreInitializationEvent event) {
                // Stub Method
        }
        @Init
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();
                
                GameRegistry.registerBlock(brick, BrickItems.class);
        		
        		for (int ix = 0; ix < 16; ix++) {
        			ItemStack cloth = new ItemStack(Block.cloth, 1, ix);
        			ItemStack brickStack = new ItemStack(brick, 1, ix);
        			
        			GameRegistry.addShapelessRecipe(brickStack, cloth);
        			LanguageRegistry.addName(brickStack, multiBlockNames[brickStack.getItemDamage()]);
        		}
        }
        
        @PostInit
        public void postInit(FMLPostInitializationEvent event) {
                // Stub Method
        }
}

 

CommonProxy

 

package whatsfast.MoreBricks;

public class CommonProxy {
    //Don't know what to do for this
    public static String Red Brick = "/tutorial/generic/block.png";
    
    // Client stuff
    public void registerRenderers() {
            // Nothing here as the server doesn't render graphics!
    }
}

 

ClientProxy

 

package whatsfast.MoreBricks.client;

import net.minecraftforge.client.MinecraftForgeClient;
import whatsfast.MoreBricks.CommonProxy;

public class ClientProxy extends CommonProxy {
        
        @Override
        public void registerRenderers() {
        		//still don't know
                MinecraftForgeClient.preloadTexture(red);
        }
        
}

 

Birck.java

 

package whatsfast.MoreBricks;

import java.util.List;
import java.util.Random;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.block.material.Material;

public class Brick extends Block {
public Brick (int id) {
	super(id, Material.ground);
	setBlockName("Brick");
	setCreativeTab(CreativeTabs.tabBlock);
}

public int getBlockTextureFromSideAndMetadata (int side, int metadata) {
	return 16 + metadata;
}
@Override
public String getTextureFile () {
	return CommonProxy.BLOCK_PNG;
}

@Override
public int damageDropped (int metadata) {
	return metadata;
}

@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs tab, List subItems) {
	for (int ix = 0; ix < 16; ix++) {
		subItems.add(new ItemStack(this, 1, ix));
	}
}
}

 

BrickItems.java

 

package whatsfast.MoreBricks;

import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class BrickItems extends ItemBlock {

private final static String[] subNames = {
	"white", "orange",  "magenta", "lightBlue", "yellow", "lightGreen",
	"pink", "darkGrey", "lightGrey", "cyan", "purple", "blue", "brown",
	"green", "red", "black"
};

public BrickItems(int id) {
	super(id);
	setHasSubtypes(true);
	setItemName("brick");
}

@Override
public int getMetadata (int damageValue) {
	return damageValue;
}

@Override
public String getItemNameIS(ItemStack itemstack) {
	return getItemName() + "." + subNames[itemstack.getItemDamage()];
}

}

 

Are you modding in minecraft 1.4.7? Cause in 1.5.x you dont have to preload textures anymore. I've got a link for you that can help you out:

 

http://wuppy29.blogspot.nl/2013/04/modding-151-metadata-blocks.html

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.