Jump to content

Recommended Posts

Posted

I have a block with a custom model, and when I hit the block the particles are purple and black checkers.  The texture renders just fine on my block.  I saw the methods addBlockHitEffects and addBlockBreakEffects, do those control the texture?  Also, I saw in my console it says:

2013-08-08 17:33:00 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_3921_null.png

which leads me into my second topic: I get this error message:

2013-08-08 17:33:01 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: civil war:textures/items/*item name*.png

This error prints even though my textures load just fine.  Does anybody know how to fix either or both of these problems?  Thanks

 

Ninjapancakes87

Posted

The first error message comes from func_111023_E() in Block. Make sure that field_111026_f isn't null.

The second comes from you initializing your block too soon.

 

Posted

The first error message comes from func_111023_E() in Block. Make sure that field_111026_f isn't null.

The second comes from you initializing your block too soon.

I called func111022_d to set field_111026_f, and that fixed that error message.  As for initializing my block too soon, I thought with the new @EventHandler notation you were supposed to initialize blocks and items in your PreInit stage (or so the javadocs say)

Posted

Do you use a TileEntityRenderer or a BlockRenderer  ?

Did you change some methods regarding rendering and icons in your block class ?

Yes I have a TileEntityRenderer and a BlockRenderer.  In my TileEntityRenderer is my code for rendering the block, and in the BlockRenderer is for rendering the block as 3D in my inventory, in my hand, on the ground, etc.  Does the model being 3D affect that?

Posted

Usually you only use one of them. Can you post both code ?

TileEntityRenderer:

package ninjapancakes87.civilwar.block.cannon;

import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import ninjapancakes87.civilwar.Extras;

import org.lwjgl.opengl.GL11;

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

@SideOnly(Side.CLIENT)
public class TileEntityCannonRenderer extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation(Extras.sb + "cannon.png");
    /** The cannon model */
    private Cannon model;
    
    /** Instance of renderManager, super one is not visible*/
    protected RenderManager renderManager;

    public TileEntityCannonRenderer()
    {
    	this.model = new Cannon();
    }
    /**
     * Used for rendering the tile entity
     * @param tileentity is the tile entity you are using
     * @param d0 used for translation on the X axis
     * @param d1 used for translation on the Y axis
     * @param d2 used for translation on the Z axis
     * @param f is not used for anything (at least in mine).
     */
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
	TileEntityCannon cannonTE = (TileEntityCannon)tileentity;
	GL11.glPushMatrix();
	GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
	GL11.glScalef(1.0F, -1F, -1F);
	short scale = getScale(cannonTE.getRotation());
        GL11.glRotatef(scale, 0.0F, 1.0F, 0.0F);
	GL11.glRotatef(90, 0, 1.0F, 0);
	this.func_110628_a(texture);
	this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
	GL11.glPopMatrix(); 
}
public short getScale(byte rotation){
	short scale = 0;
	if(rotation == 2){
            scale = 0;
        }

        if(rotation == 3){
            scale = 180;
        }

        if(rotation == 4){
            scale = -90;
        }

        if(rotation == 5){
            scale = 90;
        }
        return scale;
}
public void rotate(short scale){
	GL11.glPushMatrix();
	GL11.glRotatef(scale, 0, 1, 0);
	GL11.glRotatef(90, 0, 1.0F, 0);
	GL11.glPopMatrix();
}

}

CannonRender:

package ninjapancakes87.civilwar.block.cannon;

import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import ninjapancakes87.civilwar.Extras;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.FMLClientHandler;

//@SideOnly(Side.CLIENT)
public class CannonRender implements IItemRenderer {

private static final ResourceLocation texture = new ResourceLocation(Extras.sb + "cannon.png");

protected RenderManager renderManager;

    private Cannon model;

    public CannonRender() {

        model = new Cannon();
    }

    @Override
    public boolean handleRenderType(ItemStack item, ItemRenderType type) {

        return true;
    }

    @Override
    public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {

        return true;
    }

    @Override
    public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    	switch (type) {
            case ENTITY: {
                renderCannon(-0.5F, 0.0F, 0.5F, 0.25F, 0F, 0F, 0F, 0F, 0);
                return;
            }
            case EQUIPPED: {
                renderCannon(1.0F, 5.1F, 3.0F, 0.25F, 180F, 0F, 0F, 0F, 0);
                return;
            }
            case EQUIPPED_FIRST_PERSON: {
                renderCannon(0.0F, 6.0F, 0.0F, 0.25F, -90F, -110F, 0F, 90F, 1);
                return;
            }
            case INVENTORY: {
                renderCannon(-1.0F, 2.2F, -0.1F, 0.23F, 180F, 0F, 0F, 0F, 0);
                return;
            }
            default:
                return;
        }
    }

    private void renderCannon(float x, float y, float z, float scale, float rotate, float r1, float r2, float r3, float a) {

        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_LIGHTING);

        // Scale, Translate, Rotate
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(x, y, z);
        GL11.glRotatef(rotate, r1, r2, r3);
        if( a == 1){
        	GL11.glRotatef(rotate, r1, r2, r3);
        }

        // Bind texture
        //this.renderManager.renderEngine.func_110577_a(texture);
        FMLClientHandler.instance().getClient().renderEngine.func_110577_a(texture);

        // Render
        
        model.render((Entity)null,0.0F, 0.0F, 0.0F, 0.0F, 0.0F, scale);

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }

}

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.