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 have a problem with the block metadata textures. All the textures appear correct while in your inventory, but when you place them they all have the same texture, being the first block's texture. I don't know what I'm doing wrong. :P Here's my block file:

package com.eastonium.bionicle.blocks;

import java.util.List;

import com.eastonium.bionicle.Bionicle;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;

public class BlockKoro extends Block
{
public static final String[] stoneBlockNames = new String[] {"Onu_1", "Onu_2", "Po_1", "Po_2", "Ta_1", "Ta_2", "Ta_3", "Trdx_1", "Trdx_2"};
public static final String[] litBlockNames = new String[] {"Onu_1", "Ta_0"};
public static final String[] iceBlockNames = new String[] {"Ko_1", "Ko_2"};
public static final String[] leafyBlockNames = new String[] {"Ga_1", "Ga_2", "Ga_3"};
    @SideOnly(Side.CLIENT)
    private IIcon[] icons;

public BlockKoro(Material blockMaterial) 
{
	super(blockMaterial);
	this.setCreativeTab(Bionicle.bioBlockTab);
}

@Override
@SideOnly(Side.CLIENT)
    public IIcon getIcon(int par1, int par2)
    {
        if (par2 < 0 || par2 >= this.icons.length)
        {
            par2 = 0;
        }
        return this.icons[par2];
    }

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

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
    public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list)
    {
	int type = (this.getMaterial() == Material.rock ? 9 : (this.getMaterial() == Material.leaves ? 3 : 2));
	for(int i = 0; i < type; i++)
	{
		list.add(new ItemStack(block, 1, i));
	}        
    }

@Override
@SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister iconRegisterer)
    {
	int type = (this.getMaterial() == Material.rock ? 9 : (this.getMaterial() == Material.leaves ? 3 : 2));
        this.icons = new IIcon[type];

        for (int i = 0; i < this.icons.length; ++i)
        {
        	if(this.getMaterial() == Material.rock){
        		this.icons[i] = iconRegisterer.registerIcon(Bionicle.MODID + ":" + stoneBlockNames[i]);
        	}else if(this.getMaterial() == Material.redstoneLight){
        		this.icons[i] = iconRegisterer.registerIcon(Bionicle.MODID + ":" + litBlockNames[i]);
        	}else if(this.getMaterial() == Material.packedIce){
        		this.icons[i] = iconRegisterer.registerIcon(Bionicle.MODID + ":" + iceBlockNames[i]);
        	}else if(this.getMaterial() == Material.leaves){
        		this.icons[i] = iconRegisterer.registerIcon(Bionicle.MODID + ":" + leafyBlockNames[i]);
        	}
        }
    }
}

  • Author

the par2 in getIcon is the metadata, so I am accounting for it. the blocks don't have different textures on the sides.

the par2 in getIcon is the metadata, so I am accounting for it. the blocks don't have different textures on the sides.

Ah, yeah so it is.  I have them swapped in my helper function for some reason, sorry about that.

 

I'm guessing then that your block is always being placed with metadata 0.

Have you registered the Blocks correctly?  i.e. are you using ItemBlockWithMetadata, not just ItemBlock?  (or alternatively - your own Item extend ItemBlock overriding getMetadata() )?

 

-TGG

 

 

 

 

  • Author

Yeah, I'm not using an Itemblock thing, I realized I needed that earlier today. I think i can take it from here

 

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.