The Meaning of Life, the Universe, and Everything.
Join Date:
12/11/2013
Posts:
54
Member Details
Hi, been a while since I've modded - upgrading my 1.6.4 mod to 1.7.10. I'm having trouble with the metablocks. I have them registering and showing up in game (blockname xxx:y), but no matter what I've tried, they are not showing textures. I'm not getting any missing texture errors either, just the black/pink squares. Other than that they are getting all their properties properly, just no texture. Any help appreciated!
The Meaning of Life, the Universe, and Everything.
Join Date:
12/11/2013
Posts:
54
Member Details
Update here - I've got it treating it like a multitexture block now, using this as my metablock class. (textures showing, same 6 for all the metablocks) Not the desired behavior but I think it's almost there, I just need to get it from displaying 1 texture per side to 1 texture per block. Anyone? Pretty sure it's something I'm doing wrong in the IIcon geticon, as it's calling side not block.
hey I have same problem too. I use Cocricot resourcespack and Lotmetablock mod. And it doesn't work too. I ask some people and they said I have to build a server. (but I don't know how to build one)
Hi, been a while since I've modded - upgrading my 1.6.4 mod to 1.7.10. I'm having trouble with the metablocks. I have them registering and showing up in game (blockname xxx:y), but no matter what I've tried, they are not showing textures. I'm not getting any missing texture errors either, just the black/pink squares. Other than that they are getting all their properties properly, just no texture. Any help appreciated!
My metablock class:
import java.util.List;
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 MetaBlock extends Block {
protected MetaBlock(String unlocalizedName, Material material) {
super(material);
this.setBlockName(unlocalizedName);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setBlockTextureName("cytools2:" + unlocalizedName);
this.setHardness(2.0F);
this.setResistance(6.0F);
this.setStepSound(soundTypeMetal);
}
@Override
public int damageDropped(int meta) {
return meta;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < 15; i ++) {
list.add(new ItemStack(item, 1, i));
//System.out.println(String.format("blockitem"+item));
}
}
/*
@Override
public void registerBlockIcons(IIconRegister reg) {
}
*/
public IIcon[] icons = new IIcon[15];
@Override
public void registerBlockIcons(IIconRegister reg) {
for (int i = 0; i < 15; i ++) {
this.icons = reg.registerIcon(this.textureName + "_" + i);
}
}
@Override
public IIcon getIcon(int side, int meta) {
return this.icons[side];
}
}
ItemBlockMetaBlock class:
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlockWithMetadata;
import net.minecraft.item.ItemStack;
public class ItemBlockMetaBlock extends ItemBlockWithMetadata {
public ItemBlockMetaBlock(Block block) {
super(block, block);
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return this.getUnlocalizedName() + "_" + stack.getItemDamage();
}
}
A chunk of code I was trying to get to work in the metablock class but didn't seem to get the job done either
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
for (int x = 0; x < 9; x ++) {
String Iconpre = this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1);
String Iconname = "cytools2:"+Iconpre+x;
//this.blockIcon = reg.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1));
//this.blockIcon = reg.registerIcon(Iconname.substring(this.getUnlocalizedName().indexOf('.') + 1));
this.blockIcon = reg.registerIcon(Iconname);
System.out.println(String.format("texturename: "+this.textureName));
System.out.println(String.format("blockicon: "+Iconname));
//this.setBlockTextureName("cytools2:eblock_0.png");
}
}
*/
Update here - I've got it treating it like a multitexture block now, using this as my metablock class. (textures showing, same 6 for all the metablocks) Not the desired behavior but I think it's almost there, I just need to get it from displaying 1 texture per side to 1 texture per block. Anyone? Pretty sure it's something I'm doing wrong in the IIcon geticon, as it's calling side not block.
import java.util.List;
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 MetaBlock extends Block {
protected MetaBlock(String unlocalizedName, Material material) {
super(material);
this.setBlockName(unlocalizedName);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setBlockTextureName("cytools2:" + unlocalizedName);
this.setHardness(2.0F);
this.setResistance(6.0F);
this.setStepSound(soundTypeMetal);
}
@Override
public int damageDropped(int meta) {
return meta;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < 15; i ++) {
list.add(new ItemStack(item, 1, i));
//System.out.println(String.format("blockitem"+item));
}
}
public IIcon[] icons = new IIcon[15];
@Override
public void registerBlockIcons(IIconRegister reg) {
for (int i = 0; i < 6; i ++) {
this.icons = reg.registerIcon(this.textureName + i);
String ttn = this.textureName + i;
System.out.println(String.format("TN: "+ttn));
}
}
@Override
public IIcon getIcon(int side, int meta) {
return this.icons[side];
}
}
NM, I figured it out.
hey I have same problem too. I use Cocricot resourcespack and Lotmetablock mod. And it doesn't work too. I ask some people and they said I have to build a server. (but I don't know how to build one)
can u show me how u make it work?