Jump to content

Recommended Posts

Posted

Hi!

 

I created some spikes with a Tile Entity to render them with a special Model, but the Block is just rendered as a transparent cube. What have I done wrong?

 

source:

 

ModBlockSpikes:

package mod.minecraft.blocks;

import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class ModBlockSpikes extends ModBlock {

public ModBlockSpikes(int ID, Material material, boolean setCreativeTab) {
	super(ID, material, setCreativeTab);
}

public ModBlockSpikes(int ID, Material material) {
	super(ID, material);
}

@Override
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
	par5Entity.attackEntityFrom(DamageSource.cactus, 1);
}

@Override
public int getMobilityFlag() {
	return 0;
}

    @Override
    public TileEntity createTileEntity(World world, int Metadata) {
            return new TileEntitySpikes();
    }
   
    @Override
    public int getRenderType() {
            return -1;
    }
   
    @Override
    public boolean isOpaqueCube() {
            return false;
    }
   
    public boolean renderAsNormalBlock() {
            return false;
    }
}

ModBlock: (You don't really need to look at this, the block is correctly registered)

package mod.minecraft.blocks;

import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mod.Resources;
import mod.minecraft.items.ModItem;
import net.minecraft.block.Block;
import net.minecraft.block.StepSound;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.world.World;

public class ModBlock extends Block{

public static ModBlockSpikes spikes;

public static void init(int ID)
{
	spikes			= ((ModBlockSpikes)(new ModBlockSpikes(ID, Material.iron)._setUp("spikes", 5, 9, soundMetalFootstep)._setCreativeTab(Resources.TAB_WEAPONS)));
}

//=============================================================================================
//=============================================================================================

/**
 * Creates a Block and places it in the {@link Resources.DEFAULT_TAB} of the Mod
 * @param ID
 * @param material
 */
public ModBlock(int ID, Material material) {
	super(ID, material);
	this._setCreativeTab(Resources.DEFAULT_TAB);
}

/**
 * Creates a Block and places it in the {@link Resources.DEFAULT_TAB} of the Mod if {@code setCreativeTab} is true
 * @param ID
 * @param material
 * @param setCreativeTab
 */
public ModBlock(int ID, Material material, boolean setCreativeTab){
	super(ID, material);
	if (setCreativeTab)
		this._setCreativeTab(Resources.DEFAULT_TAB);		
}

/**
 * Sets the sound when stepping over the block
 * @param sound
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setStepSound(StepSound sound) {
	return (ModBlock) super.setStepSound(sound);
}

/**
 * Sets the light opacity of the Block.
 * @param opacity
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setLightOpacity(int opacity) {
	return (ModBlock) super.setLightOpacity(opacity);
}

/**
 * Sets the light the Block emits.
 * @param lightEmittance
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setLightValue(float lightEmittance) {
	return (ModBlock) super.setLightValue(lightEmittance);
}

/**
 * Sets how resistant the Block is to Explosions
 * @param resistance
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setResistance(float resistance) {
	return (ModBlock) super.setResistance(resistance);
}

/**
 * Sets how long you need to punch the Block till it breakes.
 * @param hardness
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setHardness(float hardness) {
	return (ModBlock) super.setHardness(hardness);
}

/**
 * Makes this Block unbreakable. (Only for Bedrock)
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setBlockUnbreakable() {
	return (ModBlock) super.setBlockUnbreakable();
}

/**
 * Sets the name to call the Block internally.
 * @param unlocalizedName
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setUnlocalizedName(String unlocalizedName) {
	return (ModBlock) super.setUnlocalizedName(unlocalizedName);
}

/**
 * Sets the CreativeTab to display the Block on.
 * @param creativeTab
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setCreativeTab(CreativeTabs creativeTab) {
	return (ModBlock) super.setCreativeTab(creativeTab);
}

/**
 * Registers the Block to the Game. Must be done after setting the unlocalized Name.
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _register(){
	GameRegistry.registerBlock(this, this.getUnlocalizedName());
	return this;
}

/**
 * Sets the Texture of the Block. The Texture will be the unlocalized Name.
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setDefaultTexture(){
	_setTexture(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
	return this;
}

/**
 * Sets the Texture of the Block.
 * @param textureName
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setTexture(String textureName) {
	this.setTextureName(Resources.MOD_ID.toLowerCase() + ":" + textureName);
	return this;
}

/**
 * Does multiple settings to the Block:
 * {@link #_setUnlocalizedName(String)}; {@link #_setHardness(float)}; {@link #_setResistance(float)}; {@link #_setStepSound(StepSound)}; 
 * {@link #_setDefaultTexture()} and {@link #_register()} 
 * @param unlocalizedName Name of the Block.
 * @param hardness How much time it needs to break the Block
 * @param resistance How resistant is the Block to explosions
 * @param stepSound Sound of stepping on the Block.
 * @return Returns the Object for convenience in constructing.
 */
public ModBlock _setUp(String unlocalizedName, float hardness, float resistance, StepSound stepSound)
{
	_setUnlocalizedName(unlocalizedName);
	_setHardness(hardness);
	_setResistance(resistance);
	_setStepSound(stepSound);
	_setDefaultTexture();
	_register();
	return this;
}

}

TileEntitySpikes:

package mod.minecraft.blocks;

import net.minecraft.tileentity.TileEntity;

public class TileEntitySpikes extends TileEntity 
{

}

RenderBlockSpikes:

package mod.minecraft.block.renderer;

import mod.Resources;
import mod.minecraft.blocks.models.ModBlockSpikesModel;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class RenderBlockSpikes extends TileEntitySpecialRenderer {
    
    //The model of your block
    private final ModBlockSpikesModel model;
   
    public RenderBlockSpikes() {
            this.model = new ModBlockSpikesModel();
    }
   
    private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
            int meta = world.getBlockMetadata(x, y, z);
            GL11.glPushMatrix();
            GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
            GL11.glPopMatrix();
            System.out.println("CALLED");
    }
   
    @Override
    public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
            GL11.glPushMatrix();
            GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
            this.bindTexture(new ResourceLocation("weaponcraft:textures/blocks/SpikesModel.png"));
            GL11.glPushMatrix();
            GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
            this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            GL11.glPopMatrix();
            GL11.glPopMatrix();
            System.out.println("CALLED");
    }

    //Set the lighting stuff, so it changes it's brightness properly.      
    private void adjustLightFixture(World world, int i, int j, int k, Block block) {
            Tessellator tess = Tessellator.instance;
            float brightness = block.getBlockBrightness(world, i, j, k);
            int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
            int modulousModifier = skyLight % 65536;
            int divModifier = skyLight / 65536;
            tess.setColorOpaque_F(brightness, brightness, brightness);
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,  (float) modulousModifier,  divModifier);
            System.out.println("CALLED");
    }
}

The Model:

package mod.minecraft.blocks.models;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModBlockSpikesModel extends ModelBase
{
  //fields
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    ModelRenderer Shape5;
    ModelRenderer Shape6;
    ModelRenderer Shape7;
    ModelRenderer Shape8;
    ModelRenderer Shape12;
    ModelRenderer Shape13;
    ModelRenderer Shape14;
    ModelRenderer Shape15;
    ModelRenderer Shape16;
    ModelRenderer Shape17;
    ModelRenderer Shape18;
    ModelRenderer Shape22;
    ModelRenderer Shape23;
    ModelRenderer Shape24;
    ModelRenderer Shape25;
    ModelRenderer Shape26;
    ModelRenderer Shape27;
    ModelRenderer Shape28;
    ModelRenderer Shape32;
    ModelRenderer Shape33;
    ModelRenderer Shape34;
    ModelRenderer Shape35;
    ModelRenderer Shape36;
    ModelRenderer Shape37;
    ModelRenderer Shape38;
    ModelRenderer Shape42;
    ModelRenderer Shape43;
    ModelRenderer Shape44;
    ModelRenderer Shape45;
    ModelRenderer Shape46;
    ModelRenderer Shape47;
    ModelRenderer Shape48;
    ModelRenderer Shape52;
    ModelRenderer Shape53;
    ModelRenderer Shape54;
    ModelRenderer Shape55;
    ModelRenderer Shape56;
    ModelRenderer Shape57;
    ModelRenderer Shape58;
    ModelRenderer Shape62;
    ModelRenderer Shape63;
    ModelRenderer Shape64;
    ModelRenderer Shape65;
    ModelRenderer Shape66;
    ModelRenderer Shape67;
    ModelRenderer Shape68;
  
  public ModBlockSpikesModel()
  {
    textureWidth = 64;
    textureHeight = 64;
    
      Shape1 = new ModelRenderer(this, 0, 3);
      Shape1.addBox(0F, 0F, 0F, 16, 1, 16);
      Shape1.setRotationPoint(-8F, 0F, -8F);
      Shape1.setTextureSize(64, 64);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 0, 0);
      Shape2.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape2.setRotationPoint(-6.466667F, -2F, -6.466667F);
      Shape2.setTextureSize(64, 64);
      Shape2.mirror = true;
      setRotation(Shape2, -0.0174533F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 0, 0);
      Shape3.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape3.setRotationPoint(-4.466667F, -2F, -6.466667F);
      Shape3.setTextureSize(64, 64);
      Shape3.mirror = true;
      setRotation(Shape3, -0.0174533F, 0F, 0F);
      Shape4 = new ModelRenderer(this, 0, 0);
      Shape4.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape4.setRotationPoint(-2.466667F, -2F, -6.466667F);
      Shape4.setTextureSize(64, 64);
      Shape4.mirror = true;
      setRotation(Shape4, -0.0174533F, 0F, 0F);
      Shape5 = new ModelRenderer(this, 0, 0);
      Shape5.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape5.setRotationPoint(-0.4666667F, -2F, -6.466667F);
      Shape5.setTextureSize(64, 64);
      Shape5.mirror = true;
      setRotation(Shape5, -0.0174533F, 0F, 0F);
      Shape6 = new ModelRenderer(this, 0, 0);
      Shape6.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape6.setRotationPoint(1.533333F, -2F, -6.466667F);
      Shape6.setTextureSize(64, 64);
      Shape6.mirror = true;
      setRotation(Shape6, -0.0174533F, 0F, 0F);
      Shape7 = new ModelRenderer(this, 0, 0);
      Shape7.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape7.setRotationPoint(3.533333F, -2F, -6.466667F);
      Shape7.setTextureSize(64, 64);
      Shape7.mirror = true;
      setRotation(Shape7, -0.0174533F, 0F, 0F);
      Shape8 = new ModelRenderer(this, 0, 0);
      Shape8.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape8.setRotationPoint(5.533333F, -2F, -6.466667F);
      Shape8.setTextureSize(64, 64);
      Shape8.mirror = true;
      setRotation(Shape8, -0.0174533F, 0F, 0F);
      Shape12 = new ModelRenderer(this, 0, 0);
      Shape12.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape12.setRotationPoint(-6.466667F, -2F, 5.533333F);
      Shape12.setTextureSize(64, 64);
      Shape12.mirror = true;
      setRotation(Shape12, -0.0174533F, 0F, 0F);
      Shape13 = new ModelRenderer(this, 0, 0);
      Shape13.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape13.setRotationPoint(-4.466667F, -2F, 5.533333F);
      Shape13.setTextureSize(64, 64);
      Shape13.mirror = true;
      setRotation(Shape13, -0.0174533F, 0F, 0F);
      Shape14 = new ModelRenderer(this, 0, 0);
      Shape14.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape14.setRotationPoint(-2.466667F, -2F, 5.533333F);
      Shape14.setTextureSize(64, 64);
      Shape14.mirror = true;
      setRotation(Shape14, -0.0174533F, 0F, 0F);
      Shape15 = new ModelRenderer(this, 0, 0);
      Shape15.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape15.setRotationPoint(-0.4666667F, -2F, 5.533333F);
      Shape15.setTextureSize(64, 64);
      Shape15.mirror = true;
      setRotation(Shape15, -0.0174533F, 0F, 0F);
      Shape16 = new ModelRenderer(this, 0, 0);
      Shape16.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape16.setRotationPoint(1.533333F, -2F, 5.533333F);
      Shape16.setTextureSize(64, 64);
      Shape16.mirror = true;
      setRotation(Shape16, -0.0174533F, 0F, 0F);
      Shape17 = new ModelRenderer(this, 0, 0);
      Shape17.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape17.setRotationPoint(3.533333F, -2F, 5.533333F);
      Shape17.setTextureSize(64, 64);
      Shape17.mirror = true;
      setRotation(Shape17, -0.0174533F, 0F, 0F);
      Shape18 = new ModelRenderer(this, 0, 0);
      Shape18.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape18.setRotationPoint(5.533333F, -2F, 5.533333F);
      Shape18.setTextureSize(64, 64);
      Shape18.mirror = true;
      setRotation(Shape18, -0.0174533F, 0F, 0F);
      Shape22 = new ModelRenderer(this, 0, 0);
      Shape22.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape22.setRotationPoint(-6.466667F, -2F, 3.533333F);
      Shape22.setTextureSize(64, 64);
      Shape22.mirror = true;
      setRotation(Shape22, -0.0174533F, 0F, 0F);
      Shape23 = new ModelRenderer(this, 0, 0);
      Shape23.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape23.setRotationPoint(-4.466667F, -2F, 3.533333F);
      Shape23.setTextureSize(64, 64);
      Shape23.mirror = true;
      setRotation(Shape23, -0.0174533F, 0F, 0F);
      Shape24 = new ModelRenderer(this, 0, 0);
      Shape24.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape24.setRotationPoint(-2.466667F, -2F, 3.533333F);
      Shape24.setTextureSize(64, 64);
      Shape24.mirror = true;
      setRotation(Shape24, -0.0174533F, 0F, 0F);
      Shape25 = new ModelRenderer(this, 0, 0);
      Shape25.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape25.setRotationPoint(-0.4666667F, -2F, 3.533333F);
      Shape25.setTextureSize(64, 64);
      Shape25.mirror = true;
      setRotation(Shape25, -0.0174533F, 0F, 0F);
      Shape26 = new ModelRenderer(this, 0, 0);
      Shape26.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape26.setRotationPoint(1.533333F, -2F, 3.533333F);
      Shape26.setTextureSize(64, 64);
      Shape26.mirror = true;
      setRotation(Shape26, -0.0174533F, 0F, 0F);
      Shape27 = new ModelRenderer(this, 0, 0);
      Shape27.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape27.setRotationPoint(3.533333F, -2F, 3.533333F);
      Shape27.setTextureSize(64, 64);
      Shape27.mirror = true;
      setRotation(Shape27, -0.0174533F, 0F, 0F);
      Shape28 = new ModelRenderer(this, 0, 0);
      Shape28.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape28.setRotationPoint(5.533333F, -2F, 3.533333F);
      Shape28.setTextureSize(64, 64);
      Shape28.mirror = true;
      setRotation(Shape28, -0.0174533F, 0F, 0F);
      Shape32 = new ModelRenderer(this, 0, 0);
      Shape32.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape32.setRotationPoint(-6.466667F, -2F, 1.533333F);
      Shape32.setTextureSize(64, 64);
      Shape32.mirror = true;
      setRotation(Shape32, -0.0174533F, 0F, 0F);
      Shape33 = new ModelRenderer(this, 0, 0);
      Shape33.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape33.setRotationPoint(-4.466667F, -2F, 1.533333F);
      Shape33.setTextureSize(64, 64);
      Shape33.mirror = true;
      setRotation(Shape33, -0.0174533F, 0F, 0F);
      Shape34 = new ModelRenderer(this, 0, 0);
      Shape34.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape34.setRotationPoint(-2.466667F, -2F, 1.533333F);
      Shape34.setTextureSize(64, 64);
      Shape34.mirror = true;
      setRotation(Shape34, -0.0174533F, 0F, 0F);
      Shape35 = new ModelRenderer(this, 0, 0);
      Shape35.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape35.setRotationPoint(-0.4666667F, -2F, 1.533333F);
      Shape35.setTextureSize(64, 64);
      Shape35.mirror = true;
      setRotation(Shape35, -0.0174533F, 0F, 0F);
      Shape36 = new ModelRenderer(this, 0, 0);
      Shape36.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape36.setRotationPoint(1.533333F, -2F, 1.533333F);
      Shape36.setTextureSize(64, 64);
      Shape36.mirror = true;
      setRotation(Shape36, -0.0174533F, 0F, 0F);
      Shape37 = new ModelRenderer(this, 0, 0);
      Shape37.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape37.setRotationPoint(3.533333F, -2F, 1.533333F);
      Shape37.setTextureSize(64, 64);
      Shape37.mirror = true;
      setRotation(Shape37, -0.0174533F, 0F, 0F);
      Shape38 = new ModelRenderer(this, 0, 0);
      Shape38.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape38.setRotationPoint(5.533333F, -2F, 1.533333F);
      Shape38.setTextureSize(64, 64);
      Shape38.mirror = true;
      setRotation(Shape38, -0.0174533F, 0F, 0F);
      Shape42 = new ModelRenderer(this, 0, 0);
      Shape42.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape42.setRotationPoint(-6.466667F, -2F, -0.4666667F);
      Shape42.setTextureSize(64, 64);
      Shape42.mirror = true;
      setRotation(Shape42, -0.0174533F, 0F, 0F);
      Shape43 = new ModelRenderer(this, 0, 0);
      Shape43.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape43.setRotationPoint(-4.466667F, -2F, -0.4666667F);
      Shape43.setTextureSize(64, 64);
      Shape43.mirror = true;
      setRotation(Shape43, -0.0174533F, 0F, 0F);
      Shape44 = new ModelRenderer(this, 0, 0);
      Shape44.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape44.setRotationPoint(-2.466667F, -2F, -0.4666667F);
      Shape44.setTextureSize(64, 64);
      Shape44.mirror = true;
      setRotation(Shape44, -0.0174533F, 0F, 0F);
      Shape45 = new ModelRenderer(this, 0, 0);
      Shape45.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape45.setRotationPoint(-0.4666667F, -2F, -0.4666667F);
      Shape45.setTextureSize(64, 64);
      Shape45.mirror = true;
      setRotation(Shape45, -0.0174533F, 0F, 0F);
      Shape46 = new ModelRenderer(this, 0, 0);
      Shape46.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape46.setRotationPoint(1.533333F, -2F, -0.4666667F);
      Shape46.setTextureSize(64, 64);
      Shape46.mirror = true;
      setRotation(Shape46, -0.0174533F, 0F, 0F);
      Shape47 = new ModelRenderer(this, 0, 0);
      Shape47.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape47.setRotationPoint(3.533333F, -2F, -0.4666667F);
      Shape47.setTextureSize(64, 64);
      Shape47.mirror = true;
      setRotation(Shape47, -0.0174533F, 0F, 0F);
      Shape48 = new ModelRenderer(this, 0, 0);
      Shape48.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape48.setRotationPoint(5.533333F, -2F, -0.4666667F);
      Shape48.setTextureSize(64, 64);
      Shape48.mirror = true;
      setRotation(Shape48, -0.0174533F, 0F, 0F);
      Shape52 = new ModelRenderer(this, 0, 0);
      Shape52.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape52.setRotationPoint(-6.466667F, -2F, -2.466667F);
      Shape52.setTextureSize(64, 64);
      Shape52.mirror = true;
      setRotation(Shape52, -0.0174533F, 0F, 0F);
      Shape53 = new ModelRenderer(this, 0, 0);
      Shape53.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape53.setRotationPoint(-4.466667F, -2F, -2.466667F);
      Shape53.setTextureSize(64, 64);
      Shape53.mirror = true;
      setRotation(Shape53, -0.0174533F, 0F, 0F);
      Shape54 = new ModelRenderer(this, 0, 0);
      Shape54.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape54.setRotationPoint(-2.466667F, -2F, -2.466667F);
      Shape54.setTextureSize(64, 64);
      Shape54.mirror = true;
      setRotation(Shape54, -0.0174533F, 0F, 0F);
      Shape55 = new ModelRenderer(this, 0, 0);
      Shape55.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape55.setRotationPoint(-0.4666667F, -2F, -2.466667F);
      Shape55.setTextureSize(64, 64);
      Shape55.mirror = true;
      setRotation(Shape55, -0.0174533F, 0F, 0F);
      Shape56 = new ModelRenderer(this, 0, 0);
      Shape56.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape56.setRotationPoint(1.533333F, -2F, -2.466667F);
      Shape56.setTextureSize(64, 64);
      Shape56.mirror = true;
      setRotation(Shape56, -0.0174533F, 0F, 0F);
      Shape57 = new ModelRenderer(this, 0, 0);
      Shape57.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape57.setRotationPoint(3.533333F, -2F, -2.466667F);
      Shape57.setTextureSize(64, 64);
      Shape57.mirror = true;
      setRotation(Shape57, -0.0174533F, 0F, 0F);
      Shape58 = new ModelRenderer(this, 0, 0);
      Shape58.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape58.setRotationPoint(5.533333F, -2F, -2.466667F);
      Shape58.setTextureSize(64, 64);
      Shape58.mirror = true;
      setRotation(Shape58, -0.0174533F, 0F, 0F);
      Shape62 = new ModelRenderer(this, 0, 0);
      Shape62.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape62.setRotationPoint(-6.466667F, -2F, -4.466667F);
      Shape62.setTextureSize(64, 64);
      Shape62.mirror = true;
      setRotation(Shape62, -0.0174533F, 0F, 0F);
      Shape63 = new ModelRenderer(this, 0, 0);
      Shape63.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape63.setRotationPoint(-4.466667F, -2F, -4.466667F);
      Shape63.setTextureSize(64, 64);
      Shape63.mirror = true;
      setRotation(Shape63, -0.0174533F, 0F, 0F);
      Shape64 = new ModelRenderer(this, 0, 0);
      Shape64.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape64.setRotationPoint(-2.466667F, -2F, -4.466667F);
      Shape64.setTextureSize(64, 64);
      Shape64.mirror = true;
      setRotation(Shape64, -0.0174533F, 0F, 0F);
      Shape65 = new ModelRenderer(this, 0, 0);
      Shape65.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape65.setRotationPoint(-0.4666667F, -2F, -4.466667F);
      Shape65.setTextureSize(64, 64);
      Shape65.mirror = true;
      setRotation(Shape65, -0.0174533F, 0F, 0F);
      Shape66 = new ModelRenderer(this, 0, 0);
      Shape66.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape66.setRotationPoint(1.533333F, -2F, -4.466667F);
      Shape66.setTextureSize(64, 64);
      Shape66.mirror = true;
      setRotation(Shape66, -0.0174533F, 0F, 0F);
      Shape67 = new ModelRenderer(this, 0, 0);
      Shape67.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape67.setRotationPoint(3.533333F, -2F, -4.466667F);
      Shape67.setTextureSize(64, 64);
      Shape67.mirror = true;
      setRotation(Shape67, -0.0174533F, 0F, 0F);
      Shape68 = new ModelRenderer(this, 0, 0);
      Shape68.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape68.setRotationPoint(5.533333F, -2F, -4.466667F);
      Shape68.setTextureSize(64, 64);
      Shape68.mirror = true;
      setRotation(Shape68, -0.0174533F, 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);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.render(f5);
    Shape12.render(f5);
    Shape13.render(f5);
    Shape14.render(f5);
    Shape15.render(f5);
    Shape16.render(f5);
    Shape17.render(f5);
    Shape18.render(f5);
    Shape22.render(f5);
    Shape23.render(f5);
    Shape24.render(f5);
    Shape25.render(f5);
    Shape26.render(f5);
    Shape27.render(f5);
    Shape28.render(f5);
    Shape32.render(f5);
    Shape33.render(f5);
    Shape34.render(f5);
    Shape35.render(f5);
    Shape36.render(f5);
    Shape37.render(f5);
    Shape38.render(f5);
    Shape42.render(f5);
    Shape43.render(f5);
    Shape44.render(f5);
    Shape45.render(f5);
    Shape46.render(f5);
    Shape47.render(f5);
    Shape48.render(f5);
    Shape52.render(f5);
    Shape53.render(f5);
    Shape54.render(f5);
    Shape55.render(f5);
    Shape56.render(f5);
    Shape57.render(f5);
    Shape58.render(f5);
    Shape62.render(f5);
    Shape63.render(f5);
    Shape64.render(f5);
    Shape65.render(f5);
    Shape66.render(f5);
    Shape67.render(f5);
    Shape68.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);
  }

}

And Last but not least the Initialization:

Load Method:

public static void init()
{
	ModBlock.init(Configurations.BlockStartID);
	ModItem.init(Configurations.ItemStartID);

	GameRegistry.registerTileEntity(TileEntitySpikes.class, "Spikes");
                proxy.registerRenderers();
         }

Client Proxy:

public class ClientProxy extends CommonProxy
{
@Override
public void registerRenderers() {
	ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySpikes.class, new RenderBlockSpikes());
}
}

 

 

 

I hope anybody can help me with this problem!

 

(If I missed some code you need to understand, please write!)

Posted

What exactly is this suppose to do ?

 

GL11.glPushMatrix();
GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
GL11.glPopMatrix();

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

Hi

 

I don't know the answer but I'd suggest it should be pretty easy to figure out with a few well-placed breakpoints-

eg is the renderer called at all?  if not why not?

is it rendering at the correct x,y,z location? what happens if you replace your render with a test object that you know renders properly?

 

-TGG

 

 

 

Posted

Hi

 

I don't know the answer but I'd suggest it should be pretty easy to figure out with a few well-placed breakpoints-

eg is the renderer called at all?  if not why not?

is it rendering at the correct x,y,z location? what happens if you replace your render with a test object that you know renders properly?

 

-TGG

I've added "System.out.println("CALLED");" at dome locations. (See code in the first post)

The Renderer isn't called at all...

Bit I think, I have initialized everything correctly!

Posted

In the ClientProxy class, try adding a String (can be anything, as long as it's unique) between the "TileEntitySpikes.class" and "new RenderBlockSpikes()". It solved it for me.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Hi

 

I'd suggest:

 

Is the ClientProxy.registerRenderers() called?

 

If so, consider a breakpoint in TileEntityRenderer.renderTileEntityAt() at this line-

        TileEntitySpecialRenderer tileentityspecialrenderer = this.getSpecialRendererForEntity(par1TileEntity);

then trace into getSpecialRendererForEntity and see why your par1TileEntity doesn't match any of the entries in specialRendererMap

 

-TGG

Posted

OK, I've now found my mistake:

I have forgotten this lines of code:

@Override
public boolean hasTileEntity(int meta) {
	return true;
}

Now it renders correctly, but I cant destroy the Block anymore. It shows no Bounding Box. What is now wrong?

 

EDIT Sorry, my mistake! The Block is rendered one Block too high and I didn't see the box. All's OK now. Thank you!

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.