Posted April 17, 201312 yr I tried to make a block (grass), which has multiple textures. The block i made says "Missing Texture" all over it... Does anyone know how to make this? Here is my code: package mods.MattCraft.Common; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.Icon; import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class ZGrassBlock extends Block { private Icon ZGrassTop; private Icon ZGrassSide; private Icon ZDirtBlock; protected ZGrassBlock(int par1) { super(par1, Material.ground); this.setTickRandomly(true); this.setCreativeTab(CreativeTabs.tabBlock); } public int idDropped(int par1, Random par2Random, int par3) { return MattCraftMain.ZDirt.idDropped(0, par2Random, par3); } @SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister reg){ this.blockIcon = reg.registerIcon("MattCraft:ZGrassTop"); this.blockIcon = reg.registerIcon("MattCraft:ZGrassSide"); this.blockIcon = reg.registerIcon("MattCraft:ZDirtBlock"); } @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int i, int j) { if (i == 0) { return ZDirtBlock; } if (i == 1) { return ZGrassTop; } else { return ZGrassSide; } } }
April 17, 201312 yr Author I tried to make a block (grass), which has multiple textures. The block i made says "Missing Texture" all over it... Does anyone know how to make this? Here is my code: package mods.MattCraft.Common; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.Icon; import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class ZGrassBlock extends Block { private Icon ZGrassTop; private Icon ZGrassSide; private Icon ZDirtBlock; protected ZGrassBlock(int par1) { super(par1, Material.ground); this.setTickRandomly(true); this.setCreativeTab(CreativeTabs.tabBlock); } public int idDropped(int par1, Random par2Random, int par3) { return MattCraftMain.ZDirt.idDropped(0, par2Random, par3); } @SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister reg){ this.blockIcon = reg.registerIcon("MattCraft:ZGrassTop"); this.blockIcon = reg.registerIcon("MattCraft:ZGrassSide"); this.blockIcon = reg.registerIcon("MattCraft:ZDirtBlock"); } @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int i, int j) { if (i == 0) { return ZDirtBlock; } if (i == 1) { return ZGrassTop; } else { return ZGrassSide; } } }
April 17, 201312 yr return ZGrassSide; correct me if i am wrong but shouldnt it be a bit more secific?.. maybe like ZMod:ZGrassSide; [/code im not entirely sure but try this anywho. Use examples, i have aspergers. Examples make sense to me.
April 17, 201312 yr return ZGrassSide; correct me if i am wrong but shouldnt it be a bit more secific?.. maybe like ZMod:ZGrassSide; [/code im not entirely sure but try this anywho. Use examples, i have aspergers. Examples make sense to me.
April 17, 201312 yr you never set the texture ZGrassTop to anything. You set the blockIcon variable to 3 different things, meaning it will have the latest value you gave it. this.blockIcon = reg.registerIcon("MattCraft:ZGrassTop"); this.ZGrassTop= reg.registerIcon("MattCraft:ZGrassTop"); this.ZGrassSide= reg.registerIcon("MattCraft:ZGrassSide"); this.ZDirtBlock= reg.registerIcon("MattCraft:ZDirtBlock"); And it should work If you guys dont get it.. then well ya.. try harder...
April 17, 201312 yr you never set the texture ZGrassTop to anything. You set the blockIcon variable to 3 different things, meaning it will have the latest value you gave it. this.blockIcon = reg.registerIcon("MattCraft:ZGrassTop"); this.ZGrassTop= reg.registerIcon("MattCraft:ZGrassTop"); this.ZGrassSide= reg.registerIcon("MattCraft:ZGrassSide"); this.ZDirtBlock= reg.registerIcon("MattCraft:ZDirtBlock"); And it should work If you guys dont get it.. then well ya.. try harder...
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.