Jump to content

[1.6.4]Custom models and inventory display, whats the right way?


Recommended Posts

Posted

Hi all,

 

Ive been having issues with displaying custom 3d models in the inventory, ive got them working fine (I say fine, but techne like to over rotate, which is annoying) in the world but the moment I try to add an item renderer I get a crash, I think I know why but EVERY thread I find with the same issue nobody posts what the solution was and for those where I think ive worked it out myself the solution doesnt work, so I ask:

 

What is the correct way of rendering custom block models as items, so the item displays the same in the inventory when you are using a dummy tile entity for the block that obviousy contains no world info so doesnt end up doing this:

 

java.lang.NullPointerException
2014-01-28 10:25:13 [iNFO] [sTDERR] 	at net.minecraft.tileentity.TileEntity.getBlockType(TileEntity.java:224)
2014-01-28 10:25:13 [iNFO] [sTDERR] 	at net.minecraft.tileentity.TileEntity.func_85027_a(TileEntity.java:283)
2014-01-28 10:25:13 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.tileentity.TileEntityRenderer.renderTileEntityAt(TileEntityRenderer.java:178)
2014-01-28 10:25:13 [iNFO] [sTDERR] 	at spawnCrystalsProto.ItemCrystalRenderer.renderItem(ItemCrystalRenderer.java:29)

 

I have tried:

 

public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
        TileEntityRenderer.instance.renderTileEntityAt(new TileEntityCrystal(), 0.0D, 0.0D, 0.0D, 0.0f);
    }

In an item renderer class but then the crash points to that line.

 

ive also tried:

 

public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) 
{
	TileEntityRenderer entityRenderer = TileEntityRenderer.instance;
        if (modelID == spawnCrystalsProto.Crystal.getRenderType()) {
            entityRenderer.renderTileEntityAt(crystal, POSITION_FIX, POSITION_FIX, POSITION_FIX, 0.0F);
        } 
}

In a blockitemrenderhandler and again it points to the same line. Ive tired implementing "IItemRenderer" and "ISimpleBlockRenderingHandler" (as im using a TE thought this was the one to go for).

 

Help me forgeyonekenobi youre my only hope.

 

edit - oh and I have checked for world != null in my renderer for "adjustLightFixture".

Posted

If a block is in the inventory, it's actually not a block anymore. It's an ItemBlock, and a ItemBlock doesn't have TileEntity, and your passing a TileEntity to a ItemBlock which causes it to crash.

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

Does your TileEntitySpecialRender use any of the arguments passed from the renderTileEntityAt method? If so, what arguments? If it doesn't use the tileentity argument, you can safely pass null to the TileEntity argument from the renderItem method. It should look something like this:

public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
        TileEntityRenderer.instance.renderTileEntityAt(null, 0.0D, 0.0D, 0.0D, 0.0f);
    }

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

ok so doing this:

 

public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    TileEntityRenderer.instance.renderTileEntityAt(null, 0.0D, 0.0D, 0.0D, 0.0f);
}

 

measn that no TE is passed to my renderer, which means I cannot get the block metadata to work out which model to show.

 

My TESR currently looks like this:

 

public TileEntityCrystalRenderer() {
this.model = new ModelMymodell();
}
                
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) 
{            	
    int blockmeta = te.getBlockMetadata();
    this.model.meta = blockmeta;
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    ResourceLocation textures = (new ResourceLocation("mymod:textures/blocks/texture.png")); 
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);

    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    GL11.glEnable(GL11.GL_BLEND);
    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

Posted

try rendering it with a default metadata, so try something like this:

public TileEntityCrystalRenderer() {
this.model = new ModelMymodell();
}
                
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) 
{            	
    //int blockmeta = te.getBlockMetadata();
    //this.model.meta = blockmeta;
    this.model.meta = 0;
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    ResourceLocation textures = (new ResourceLocation("mymod:textures/blocks/texture.png")); 
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);

    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    GL11.glEnable(GL11.GL_BLEND);
    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

That should make your model always render with metadata = 0. Tell me if this works out;

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

But that would stop the in world block representaion of the models working correctly. Theres a metadata block containing 5 meta blocks, the model class has ALL of the shapes needed for rendering all of the blocks I just disable some shapes based on the metadata passed in. Now I could just have 1 of the models for the Item render yes (just check if te is null and set the meta) but id rather each item block show the correct model for its meta...if this isnt possible and I need to split the model into multiple classes thats not an issue just not what I had in mind for this.

Posted

Dude, why does your item code need to call TileEntityRenderer.renderTileEntityAt at all?

 

Why not just call an appropriate rendering method in your TileEntitySpecialRenderer?

 

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) 
{            	
    int blockmeta = te.getBlockMetadata();
    renderParticularModel(blockmeta, x, y, z, scale);
}

public void renderParticularModel(int meta, double x, double y, double z, float scale)
{
    this.model.meta = meta;
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    ResourceLocation textures = (new ResourceLocation("mymod:textures/blocks/texture.png")); 
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);

    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    GL11.glEnable(GL11.GL_BLEND);
    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

and in your Item renderer

 

public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) 
{
myTESR.renderParticularModel(XPOS, YPOS, ZPOS, metadata);
        } 
}

 

(Haven't tried to compile this stub, but you get the idea I mean?)

 

-TGG

Posted

I think im being rather dense here but how can I pass a Metadata value when I have no block in my itemrenderer.

 

this:

 

public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)

{

    TESR.renderParticularModel("WHAT GOES HERE", 0.5F, 0.5F, 0.5F, metadata);

    }

 

I have no reference to a meta of any kind here as far as I can tell. Block doesnt contain one....

Posted

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Does my block have to extend block container? or can it simply extend block. There are reasons for me not extending BlockContainer and I will explain if its required it could be ive got this very wrong.

 

Anyways using your code Draco im getting an NPE due to BlockCrystal.instance.blockID being null in:

 

TileEntitySpecialRenderer render = new TileEntityCrystalRenderer();

MinecraftForgeClient.registerItemRenderer(BlockCrystal.instance.blockID, new ItemCrystalRenderer(render, new TileEntityCrystal()));

 

when registering it in my client proxy.

Posted

Hi

 

If you are using an IBSRH then it gives you the metadata in the parameter list

 

    public abstract void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer);

 

If you're using a different Item renderer:

An Item in your inventory is actually an ItemStack.  An ItemStack has a "damage" value which is used instead of metadata (say - for coloured wool).  So you use the ItemStack.getDisplayDamage() as your "metadata"

 

A bit more info here

http://greyminecraftcoder.blogspot.com.au/2013/12/items.html

 

-TGG

Posted

Ok im getting confused now theres seems to be multiple ways of doing this and I think im mixing them together. Let me clear things up for a sec and explain what im doing:

 

I have a crystal Block that "grows" it is the return in getPlantID in an Iplantable seed (think this was why I didnt use BlockContainer, been a while since I made that change, maybe something to do with ticking randomly...). The block has 5 metadata subblocks, theres is 1 model that contains all the shapes for all of the subblocks. The Block implements a Tile Entity thats blank (as in the class is empty pretty much).

 

My Model class:

 

package spawnCrystalsProto;

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

public class ModelCrystal extends ModelBase
{
int meta = 0;
  //fields
    ModelRenderer MainCrystal;
    
    ModelRenderer MainCrystal1;
    ModelRenderer OffShoot11;
    ModelRenderer OffShoot12;
    ModelRenderer OffShoot13;
    
    ModelRenderer MainCrystal2;
    ModelRenderer OffShoot21;
    ModelRenderer OffShoot22;
    ModelRenderer OffShoot23;
    
    ModelRenderer MainCrystal3;
    ModelRenderer OffShoot31;
    ModelRenderer OffShoot32;
    ModelRenderer OffShoot33;
    
    ModelRenderer MainCrystal4;
    ModelRenderer OffShoot41;
    ModelRenderer OffShoot42;
    ModelRenderer OffShoot43;
    
  
  public ModelCrystal()
  {
    textureWidth = 32;
    textureHeight = 32;
    
      MainCrystal = new ModelRenderer(this, 0, 0);
      MainCrystal.addBox(0F, 0F, 0F, 1, 2, 1);
      MainCrystal.setRotationPoint(0F, 22.2F, 0F);
      MainCrystal.setTextureSize(32, 32);
      MainCrystal.mirror = true;
      setRotation(MainCrystal, 0F, 0F, 0.3346075F);
      
      MainCrystal1 = new ModelRenderer(this, 0, 0);
      MainCrystal1.addBox(0F, 0F, 0F, 2, 5, 2);
      MainCrystal1.setRotationPoint(0F, 19.5F, -1F);
      MainCrystal1.setTextureSize(32, 32);
      MainCrystal1.mirror = true;
      setRotation(MainCrystal1, 0F, 0F, 0.3346075F);
      OffShoot11 = new ModelRenderer(this, 8, 0);
      OffShoot11.addBox(0F, 0F, 0F, 1, 2, 1);
      OffShoot11.setRotationPoint(1F, 22.6F, 1F);
      OffShoot11.setTextureSize(32, 32);
      OffShoot11.mirror = true;
      setRotation(OffShoot11, 0F, -0.9807508F, 0.4833219F);
      OffShoot12 = new ModelRenderer(this, 8, 0);
      OffShoot12.addBox(0F, 0F, 0F, 1, 2, 1);
      OffShoot12.setRotationPoint(0F, 22.3F, -1.5F);
      OffShoot12.setTextureSize(32, 32);
      OffShoot12.mirror = true;
      setRotation(OffShoot12, 0F, 1.226894F, 0.3717861F);
      OffShoot13 = new ModelRenderer(this, 8, 0);
      OffShoot13.addBox(0F, 0F, 0F, 1, 2, 1);
      OffShoot13.setRotationPoint(-1.5F, 22.3F, 1F);
      OffShoot13.setTextureSize(32, 32);
      OffShoot13.mirror = true;
      setRotation(OffShoot13, 0F, -2.546735F, 0.4461433F);
      
      MainCrystal2 = new ModelRenderer(this, 0, 0);
      MainCrystal2.addBox(0F, 0F, 0F, 3, 7, 3);
      MainCrystal2.setRotationPoint(0F, 17.5F, -1F);
      MainCrystal2.setTextureSize(32, 32);
      MainCrystal2.mirror = true;
      setRotation(MainCrystal2, 0F, 0F, 0.3346075F);
      OffShoot21 = new ModelRenderer(this, 12, 0);
      OffShoot21.addBox(0F, 0F, 0F, 2, 3, 2);
      OffShoot21.setRotationPoint(2F, 21.6F, 2F);
      OffShoot21.setTextureSize(32, 32);
      OffShoot21.mirror = true;
      setRotation(OffShoot21, 0F, -0.8922867F, 0.6320364F);
      OffShoot22 = new ModelRenderer(this, 12, 0);
      OffShoot22.addBox(0F, 0F, 0F, 2, 3, 2);
      OffShoot22.setRotationPoint(0F, 21.3F, -1.833333F);
      OffShoot22.setTextureSize(32, 32);
      OffShoot22.mirror = true;
      setRotation(OffShoot22, 0F, 1.226894F, 0.3717861F);
      OffShoot23 = new ModelRenderer(this, 12, 0);
      OffShoot23.addBox(0F, 0F, 0F, 2, 3, 2);
      OffShoot23.setRotationPoint(-2F, 21.3F, 1F);
      OffShoot23.setTextureSize(32, 32);
      OffShoot23.mirror = true;
      setRotation(OffShoot23, 0F, -2.899932F, 0.3717861F);
      
      MainCrystal3 = new ModelRenderer(this, 0, 0);
      MainCrystal3.addBox(0F, 0F, 0F, 4, 9, 4);
      MainCrystal3.setRotationPoint(0F, 15.6F, -2F);
      MainCrystal3.setTextureSize(32, 32);
      MainCrystal3.mirror = true;
      setRotation(MainCrystal3, 0F, 0F, 0.3346075F);
      OffShoot31 = new ModelRenderer(this, 12, 0);
      OffShoot31.addBox(0F, 0F, 0F, 2, 3, 2);
      OffShoot31.setRotationPoint(3F, 21.6F, 1F);
      OffShoot31.setTextureSize(32, 32);
      OffShoot31.mirror = true;
      setRotation(OffShoot31, 0F, -0.4833219F, 0.6320364F);
      OffShoot32 = new ModelRenderer(this, 12, 0);
      OffShoot32.addBox(0F, 0F, 0F, 2, 3, 2);
      OffShoot32.setRotationPoint(0F, 21.3F, -2.833333F);
      OffShoot32.setTextureSize(32, 32);
      OffShoot32.mirror = true;
      setRotation(OffShoot32, 0F, 1.226894F, 0.3717861F);
      OffShoot33 = new ModelRenderer(this, 12, 0);
      OffShoot33.addBox(0F, 0F, 0F, 2, 3, 2);
      OffShoot33.setRotationPoint(-3F, 21.3F, 1F);
      OffShoot33.setTextureSize(32, 32);
      OffShoot33.mirror = true;
      setRotation(OffShoot33, 0F, -2.899932F, 0.3717861F);
      
      MainCrystal4 = new ModelRenderer(this, 0, 0);
      MainCrystal4.addBox(0F, 0F, 0F, 5, 11, 5);
      MainCrystal4.setRotationPoint(0F, 13.7F, -2F);
      MainCrystal4.setTextureSize(32, 32);
      MainCrystal4.mirror = true;
      setRotation(MainCrystal4, 0F, 0F, 0.3346075F);
      OffShoot41 = new ModelRenderer(this, 12, 0);
      OffShoot41.addBox(0F, 0F, 0F, 2, 4, 2);
      OffShoot41.setRotationPoint(4F, 20.6F, 1F);
      OffShoot41.setTextureSize(32, 32);
      OffShoot41.mirror = true;
      setRotation(OffShoot41, 0F, -0.4833219F, 0.6320364F);
      OffShoot42 = new ModelRenderer(this, 12, 0);
      OffShoot42.addBox(0F, 0F, 0F, 2, 4, 2);
      OffShoot42.setRotationPoint(0F, 20.3F, -2.833333F);
      OffShoot42.setTextureSize(32, 32);
      OffShoot42.mirror = true;
      setRotation(OffShoot42, 0F, 1.226894F, 0.3717861F);
      OffShoot43 = new ModelRenderer(this, 12, 0);
      OffShoot43.addBox(0F, 0F, 0F, 2, 4, 2);
      OffShoot43.setRotationPoint(-4F, 20.3F, 1F);
      OffShoot43.setTextureSize(32, 32);
      OffShoot43.mirror = true;
      setRotation(OffShoot43, 0F, -2.899932F, 0.3717861F);
  }
  
  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);

    if(meta == 0)
    {
    	MainCrystal.render(f5);
    }
    if(meta == 1)
    {
    MainCrystal1.render(f5);
    OffShoot11.render(f5);
    OffShoot12.render(f5);
    OffShoot13.render(f5);
    }
    if(meta == 2)
    {
    MainCrystal2.render(f5);
    OffShoot21.render(f5);
    OffShoot22.render(f5);
    OffShoot23.render(f5);
    }
    if(meta == 3)
    {
    MainCrystal3.render(f5);
    OffShoot31.render(f5);
    OffShoot32.render(f5);
    OffShoot33.render(f5);
    }
    if(meta == 4)
    {
    MainCrystal4.render(f5);
    OffShoot41.render(f5);
    OffShoot42.render(f5);
    OffShoot43.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);
  }

}

 

 

My TESR:

 

package spawnCrystalsProto;

import org.lwjgl.opengl.GL11;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
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;

public class TileEntityCrystalRenderer extends TileEntitySpecialRenderer {
        
        private final ModelCrystal model;
        
        public TileEntityCrystalRenderer() {
                this.model = new ModelCrystal();
        }
        
        public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)  
        {            	
            int blockmeta = te.getBlockMetadata();
            renderParticularModel(blockmeta, x, y, z, scale);
        }

        public void renderParticularModel(int meta, double x, double y, double z, float scale)
        {
            this.model.meta = meta;
            GL11.glPushMatrix();
            GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
            ResourceLocation textures = (new ResourceLocation("mymod:textures/blocks/texture.png")); 
            Minecraft.getMinecraft().renderEngine.bindTexture(textures);

            GL11.glPushMatrix();
            GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            GL11.glDisable(GL11.GL_BLEND);

            GL11.glPopMatrix();
            GL11.glPopMatrix();
        }
       
        private void adjustLightFixture(World world, int i, int j, int k, Block block) 
        {
        	if(world !=null)
        	{
                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);
        	}
        }
}

 

 

So with this setup as it is, what do I implement now to make Item rendering work correctly.

 

Posted

Hi

 

Since you seem to know how to use ISimpleBlockRenderingHandler (true?), I would use that.

 

@Override

public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {

  TileEntitySpecialRenderer tileentityspecialrenderer = this.getSpecialRendererForClass(TileEntityCrystal.class);

  if (tileentityspecialrenderer instanceof TileEntityCrystalRenderer) {  // it should be, but doesn't hurt to make sure

    TileEntityCrystalRenderer tileEntityCrystalRenderer = (TileEntityCrystalRenderer)tileentityspecialrenderer;

    tileentityspecialrenderer.renderParticularModel(metadata, 0.0f, 0.0f, 0.0f, 1.0f);

  }

}

 

-TGG

Posted

ok so still a little lost here it seems, I can see what getSpecialRendererForClass does but it errors for me constantly, I mean It looks like I need to override it but not done this bit before, looking into it....

Posted
Does my block have to extend block container? or can it simply extend block. There are reasons for me not extending BlockContainer and I will explain if its required it could be ive got this very wrong.

 

If you're using a TileEntitySpecialRenderer to render a TileEntity, then your block should extend BlockContainer.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

So im still in the same boat in that:

 

getSpecialRendererForClass

 

is erroring and I cannot for the life of me figure out the solution, I know I need that method in this ISimpleBlockRenderingHandler class but what goes in it, nothing I try works, I dont want to be spoon fed here but theres something about this that just isnt clicking with me.

Posted

getSpecialRendererForClass

 

is erroring

 

What is the error?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well it doesnt exist in the class so "this." wont work based on the code supplied above, but I cant see how to override it correctly, im sure im missing something very simple here.

Posted

Well it doesnt exist in the class so "this." wont work based on the code supplied above, but I cant see how to override it correctly, im sure im missing something very simple here.

 

I don't think TheGreyGhost was correct with his code.

 

This is why I supplied my perfectly good working code.

https://github.com/Draco18s/Artifacts/blob/master/draco18s/artifacts/client/ItemRenderPedestal.java

 

And the client proxy:

TileEntitySpecialRenderer render = new PedestalRenderer();
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayPedestal.class, render);
MinecraftForgeClient.registerItemRenderer(BlockPedestal.instance.blockID, new ItemRenderPedestal(render, new TileEntityDisplayPedestal()));

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

and now im back to NPE on:

 

MinecraftForgeClient.registerItemRenderer(BlockCrystal.instance.blockID, new RenderItemBlockCrystal(render, new TileEntityCrystal()));

 

Ive managed to get my block to be a block container without breaking anything it seems so ive added:

 

public static BlockContainer instance;

 

but as above still no dice...what am I missing?

Posted
so ive added:

 

public static BlockContainer instance;

 

but as above still no dice...what am I missing?

 

Did you set it to anything?  Mind, you are probably not storing your block instances in your block class, but in your main class.  Whip out that brain of yours and figure out what should be there* based on your own project.

 

*

BlockCrystal.instance.blockID

  This bit.  Replace this bit.  You're storing your block references somewhere, yeah?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

ok yes i was being a dullard there, got that bit sorted and im now getting to the renderer but im back to where i started in terms of the problem, te.getblockdata in the renderTileEntityAt method returns null. How do I get the block metadata from a non world block?

 

Edit - OK in the end I seem to have fallen back on the simplistic way of doing this, in renderItem and doing the whole case switch on ENTITY EQUIPPED_FIRST_PERSON INVENTORY etc.. means fiddling with the rotation and translates but hey it works.

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.