Posted May 15, 201510 yr So I am trying to get the texture on my custom block rendering file to work. It seems to place a typical purple and black checkered block where I have the block and changes some of the surrounding blocks to the textures I'm trying put on the custom block. Does anyone have any ideas why this is broken? Here's the coding: The Render Class, package com.littlepup.xcom_mod.renderers; import com.littlepup.xcom_mod.blocks.BlockMeldCanister; import com.littlepup.xcom_mod.blocks.BlocksMain; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; public class RendererMeldCanister implements ISimpleBlockRenderingHandler { public static int renderid = RenderingRegistry.getNextAvailableRenderId(); @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { } @Override public boolean renderWorldBlock(IBlockAccess blockaccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); //front foot renderer.setRenderBounds(0.40625D, 0.0D, 0.0625D, 0.59375D, 0.3125D, 0.125D); renderer.renderStandardBlock(block, x, y, z); //left foot renderer.setRenderBounds(0.875D, 0.0D, 0.6875D, 0.9735D, 0.3125D, 0.875D); renderer.renderStandardBlock(block, x, y, z); //right foot renderer.setRenderBounds(0.0625D, 0.0D, 0.6875D, 0.125D, 0.3125D, 0.875D); renderer.renderStandardBlock(block, x, y, z); //cannister body renderer.setRenderBounds(0.125D, 0.25D, 0.125D, 0.875D, 1.625D, 0.875D); renderer.renderStandardBlock(block, x, y, z); //top 1 renderer.setRenderBounds(0.1875D, 1.625D, 0.1875D, 0.8125D, 1.75D, 0.8125D); renderer.renderStandardBlock(block, x, y, z); //top 2 renderer.setRenderBounds(0.25D, 1.75D, 0.25D, 0.75D, 1.8125, 0.75D); renderer.renderStandardBlock(block, x, y, z); //top 3 renderer.setRenderBounds(0.375D, 1.8125D, 0.375D, 0.625D, 1.875D, 0.625D); renderer.renderStandardBlock(block, x, y, z); renderer.setOverrideBlockTexture(BlockMeldCanister.icon); return true; } @Override public boolean shouldRender3DInInventory(int modelId) { return false; } @Override public int getRenderId() { return renderid; } } The tile entity class, package com.littlepup.xcom_mod.tile_entities; import net.minecraft.tileentity.TileEntity; public class TileEntityMeldCanister extends TileEntity { private int counter; public boolean isPlayerNear() { counter++; if(counter % 20 == 0) { if(worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 200.0) != null) { return true; } else { return false; } } else { return false; } } public boolean startCountDown() { counter++; long start_time = worldObj.getTotalWorldTime(); if(counter == 20) { if(start_time == start_time + 600.0D) { return true; } else { return false; } } else { return false; } } { } @Override public void updateEntity() { if(isPlayerNear() == true) { startCountDown(); } else { } } } The block class, package com.littlepup.xcom_mod.blocks; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import com.littlepup.xcom_mod.XcomMain; import com.littlepup.xcom_mod.other.Reference; import com.littlepup.xcom_mod.tile_entities.TileEntityMeldCanister; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockMeldCanister extends BlockContainer { public static IIcon icon; BlockMeldCanister() { super(Material.iron); setBlockName("meld_canister"); setCreativeTab(XcomMain.XcomTab); setHardness(1.0F); setResistance(10.0F); } @Override public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { createNewTileEntity(world, metadata); return metadata; } @Override public boolean isNormalCube() { return false; } @Override public boolean isOpaqueCube() { return false; } @Override public boolean canDropFromExplosion(Explosion explosion) { return false; } @Override public boolean renderAsNormalBlock() { return false; } @Override public int getRenderType() { return com.littlepup.xcom_mod.renderers.RendererMeldCanister.renderid; } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconregister) { icon = iconregister.registerIcon(Reference.MODID + ":" + "meld_canister"); } public IIcon getMeldCanisterIcon() { return icon; } @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return null; } } Finally, the model class, package com.littlepup.xcom_mod.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelMeldCanister extends ModelBase { //fields ModelRenderer CanisterBody; ModelRenderer Foot1; ModelRenderer Foot2; ModelRenderer Foot3; ModelRenderer Top1; ModelRenderer Top2; ModelRenderer Top3; public ModelMeldCanister() { textureWidth = 64; textureHeight = 64; CanisterBody.mirror = true; CanisterBody = new ModelRenderer(this, 0, 0); CanisterBody.addBox(-6F, 0F, -6F, 12, 22, 12); CanisterBody.setRotationPoint(0F, -2F, 0F); CanisterBody.setTextureSize(64, 32); CanisterBody.mirror = true; setRotation(CanisterBody, 0F, 0F, 0F); CanisterBody.mirror = false; Foot1 = new ModelRenderer(this, 42, 36); Foot1.addBox(-1.5F, 0F, -1F, 3, 5, 1); Foot1.setRotationPoint(0F, 19F, -6F); Foot1.setTextureSize(64, 32); Foot1.mirror = true; setRotation(Foot1, 0F, 0F, 0F); Foot2 = new ModelRenderer(this, 42, 44); Foot2.addBox(0F, 0F, -1.5F, 1, 5, 3); Foot2.setRotationPoint(6F, 19F, 4F); Foot2.setTextureSize(64, 32); Foot2.mirror = true; setRotation(Foot2, 0F, 0F, 0F); Foot3 = new ModelRenderer(this, 54, 36); Foot3.addBox(-1F, 0F, -1.5F, 1, 5, 3); Foot3.setRotationPoint(-6F, 19F, 4F); Foot3.setTextureSize(64, 32); Foot3.mirror = true; setRotation(Foot3, 0F, 0F, 0F); Top1 = new ModelRenderer(this, 0, 36); Top1.addBox(-5F, 0F, -5F, 10, 2, 10); Top1.setRotationPoint(0F, -4F, 0F); Top1.setTextureSize(64, 32); Top1.mirror = true; setRotation(Top1, 0F, 0F, 0F); Top2 = new ModelRenderer(this, 0, 50); Top2.addBox(-4F, 0F, -4F, 8, 1, ; Top2.setRotationPoint(0F, -5F, 0F); Top2.setTextureSize(64, 32); Top2.mirror = true; setRotation(Top2, 0F, 0F, 0F); Top3 = new ModelRenderer(this, 37, 55); Top3.addBox(-3F, 0F, -3F, 6, 1, 6); Top3.setRotationPoint(0F, -6F, 0F); Top3.setTextureSize(64, 32); Top3.mirror = true; setRotation(Top3, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); CanisterBody.render(f5); Foot1.render(f5); Foot2.render(f5); Foot3.render(f5); Top1.render(f5); Top2.render(f5); Top3.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } Any help would be greatly appreciated. Edit: Try to ignore that emoticon in the model coding, I don't know how that got there. It isn't there in the files I made.
May 16, 201510 yr Author On the b), should I extend to a different model class or something else. On the c), how should I load the texture?
May 17, 201510 yr Author So just for clarification, I don't need to make a model, I don't need to use a separate method in the render class because renderStandardBlock does that for me, and I should be doing something else for creating a tile entity?
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.