Как правильно привязать текстуру к блоку типа .obj с определенной метадатой?
Вот как у меня. Класс блока:
Класс TileEntity блока:
На самом деле должны быть разные текстуры. Что я сделал не так? Заранее спасибо
Вот как у меня. Класс блока:
Код:
public class ColumnObj extends BlockContainer implements ITileEntityProvider {
public IIcon[] icon_array;
public static String[] ids = new String[] {
"c1",
"c2",
"c3",
"c4",
"c5",
"c6",
"c7",
"c8",
"c9",
"c10",
"c11",
"c12",
"c13",
"c14",
"c15",
"c16",
"c17",
"c18",
"c19",
"c20",
"c21",
"c22",
"c23",
"c24",
"c25",
"c26",
"c27",
"c28",
"c29",
"c30",
"c31",
"c32",
"c33",
"c34",
"c35",
"c36",
"c37",
"c38",
"c39",
"c40",
"c41",
"c42",
"c43",
"c44",
"c45",
"c46",
"c47",
"c48",
"c49",
"c50",
"c51",
"c52",
};
public ColumnObj(String unlocalisedName) {
super(Material.rock);
setBlockName("column");
setCreativeTab(CreativeTabManager.getTab("sao.townblocks"));
setBlockTextureName(Reference.MOD_ID + ":column");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int ids) {
if (ids >= 0 && ids < ColumnObj.ids.length) {
return icon_array[ids];
}
return super.getIcon(side, ids);
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item ids, CreativeTabs table, List list) {
for (int j = 0; j < ColumnObj.ids.length; ++j) {
list.add(new ItemStack(ids, 1, j));
}
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister ir) {
super.registerBlockIcons(ir);
icon_array = new IIcon[ids.length];
for (int i = 0; i < ids.length; ++i) {
icon_array[i] = ir.registerIcon(getTextureName() + "/" + ids[i]);
}
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new ColumnTileEntity();
}
@Override
public int damageDropped(int ids) {
return ids;
}
public int getRenderType() {
return -1;
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
}
Класс TileEntity блока:
Код:
public class ColumnTileEntityR extends TileEntitySpecialRenderer {
public final static column model = new column();
public final static ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "/textures/blocks/column/" + ColumnObj.ids.length + ".png");
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) {
render((ColumnTileEntity)tile, x, y, z, f);
}
private void render(ColumnTileEntity tile, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glTranslatef(0.5F, 0.0F, 0.5F);
GL11.glScalef(1.5F, 1.0F, 1.5F);
bindTexture(texture);
model.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
}
На самом деле должны быть разные текстуры. Что я сделал не так? Заранее спасибо