Jump to content

Recommended Posts

Posted

I know this has probably been answered somewhere else, but I have done hours of research and cannot find a working solution. Here is the problem:

 

I made a custom bow, and a custom arrow, however the custom arrow is using the original arrow texture right now. But the problem is that when I shoot the arrow, I know it really shoots because it hurts mobs and I can pick it up, but it is invisible.

 

 

I messed around some. Now I have:

 

In my Entities in my main class file I have:

EntityRegistry.registerGlobalEntityID(EntityPebble.class, "Pebble", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntityPebble.class, "Pebble", 1, this, 128, 1, false);

 

 

In my rendering registry I put

RenderingRegistry.registerEntityRenderingHandler(EntityPebble.class, new RenderLiving(new ModelPebble(), 0F));

 

Which yields an

ebt.common.EntityPebble cannot be cast to net.minecraft.src.EntityLiving

error.

 

 

When I change

RenderingRegistry.registerEntityRenderingHandler(EntityPebble.class, new RenderLiving(new ModelPebble(), 0F));

 

to

RenderingRegistry.registerEntityRenderingHandler(EntityPebble.class, new ebt.client.render.RenderPebble());

 

I get a arrow like texture, but it says "missing".

 

To clarify I do NOT want a folded texture, I want a cube like texture, and that is what the ModelPebble file is set to be.

 

Thanks in advance, all help is appreciated.

Posted

I have it set to shoot a custom arrow and entity, but using the default arrow's texture. Could it be because two things are using the default texture? I don't exactly understand your question.

Posted

RenderPebble

 

package ebt.client.render;

import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.Render;
import net.minecraft.src.Tessellator;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import ebt.common.EntityPebble;
import ebt.common.ModelPebble;



public class RenderPebble extends Render
{
protected ModelBase ModelPShot;

public RenderPebble()
    {
        this.shadowSize = 0.1F;
        this.ModelPShot = new ModelPebble();
    }



    public void renderPShot(EntityPebble var1, double var2, double var4, double var6, float var8, float var9)
    {
        if (var1.prevRotationYaw != 0.0F || var1.prevRotationPitch != 0.0F)
        {
        	//this.modelPShot.render(var1, 0F, 0F, 0F, 11, 2, 2);
            this.loadTexture("/ebt.client/resources/Pebble.png");
            GL11.glPushMatrix();
            GL11.glTranslatef((float)var2, (float)var4, (float)var6);
            GL11.glRotatef(var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var9 - 90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var9, 0.0F, 0.0F, 1.0F);
            Tessellator var10 = Tessellator.instance;
            byte var11 = 0;
            float var12 = 0.0F;
            float var13 = 0.5F;
            float var14 = (float)(0 + var11 * 10) / 32.0F;
            float var15 = (float)(5 + var11 * 10) / 32.0F;
            float var16 = 0.0F;
            float var17 = 0.15625F;
            float var18 = (float)(5 + var11 * 10) / 32.0F;
            float var19 = (float)(10 + var11 * 10) / 32.0F;
            float var20 = 0.05625F;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);



            GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(var20, var20, var20);
            GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
            GL11.glNormal3f(var20, 0.0F, 0.0F);
            var10.startDrawingQuads();
            var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var18);
            var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var18);
            var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var19);
            var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var19);
            var10.draw();
            GL11.glNormal3f(-var20, 0.0F, 0.0F);
            var10.startDrawingQuads();
            var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var18);
            var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var18);
            var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var19);
            var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var19);
            var10.draw();

            for (int var23 = 0; var23 < 4; ++var23)
            {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
                GL11.glNormal3f(0.0F, 0.0F, var20);
                var10.startDrawingQuads();
                var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)var12, (double)var14);
                var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)var13, (double)var14);
                var10.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)var13, (double)var15);
                var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)var12, (double)var15);
                var10.draw();
            }

            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            GL11.glPopMatrix();
        }
    }
    
    public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9)
    {
        this.renderPShot((EntityPebble)var1, var2, var4, var6, var8, var9);
    }
}

Posted

I added this line of code in my clientproxy:

RenderingRegistry.instance().registerEntityRenderingHandler(EntityPebble.class, new RenderPebble());

 

This line of code in my main mod file:

EntityRegistry.registerModEntity(EntityPebble.class, "Pebble", 1, this, 250, 5, false);

 

Now the end of my main mod file looks like this:

//Entities//
EntityRegistry.registerGlobalEntityID(EntityPebble.class, "Pebble", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntityPebble.class, "Pebble", 1, this, 250, 5, false);		
    
//Rendering Registry//
RenderingRegistry.registerEntityRenderingHandler(EntityPebble.class, new ebt.client.render.RenderPebble());

 

I notice it isn't calling to my ModelPebble file, where is it supposed to do this?

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.