Jump to content

[Solved] Entity is invisible (Render doen't work)


MaSch212

Recommended Posts

Hey Guys,

 

I want to make a bow with special Arrows. I already written everything for it and it works fine but the Arrow is invisible.

I searched for help but I don't know why the Arrow is not rendered.

Here is some code:

 

Main Class:

 

@Mod(modid="Marc's AdvancedIC2", name="AdvancedIC2", version="1.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=true)

public class AdvancedIC2 {
//Some Vars

@SidedProxy(clientSide="MyMod.client.ClientProxyMyMod", serverSide="MyMod.common.CommonProxyMyMod")
public static CommonProxyMyMod proxy;

@PreInit
public void PreInit(FMLPreInitializationEvent event)
{
	//Some new Sounds
	//Some Config-Stuff
}

@Init
public void Init(FMLInitializationEvent event)
{
	proxy.registerRenderThings();
	//Item Registry, Recipies, ...
}

}

 

 

CommonProxyMyMod:

 

public class CommonProxyMyMod {
public void registerRenderThings() { }
}

 

 

ClientProxyMyMod:

 

public class ClientProxyMyMod extends CommonProxyMyMod {
@Override
public void registerRenderThings()
{
	//Preload Textures (they work fine)
	EntityRegistry.registerGlobalEntityID(EntityLaserArrow.class, "LaserArrow", EntityRegistry.findGlobalUniqueEntityId());
	RenderingRegistry.registerEntityRenderingHandler(EntityLaserArrow.class, new RenderLaserArrow());
}
}

 

 

I first thought that my Render class is not working but I tested it with "System.out.println()" so that I can see if the "doRender" method is called any time. And the result was that the "doRender" Method never called.

 

 

Link to comment
Share on other sites

I made an entity recently too. Depending on what kind of entity you are making, the render parameters change. Try checking in the vanilla arrow files to see what it uses or look on the blaster rifle tutorial on the wiki for forge.

 

Yes I read the Tutorial on Forge Wiki and I've done everything.

And I copied the hole RenderArrow Class for testing but it is still not working.

Link to comment
Share on other sites

you have no EntityRegistry.registerModEntity

 

Yes but I have "EntityRegistry.registerGlobalEntityID".

I don't really know the differences between "registerGlobalEntityID" and "registerModEntity".

Do I have to write both in the ClientProxy?

Or do I have to put them in another class?

Link to comment
Share on other sites

Why do you register your entity client-side only? It needs to be registered for the server as well! Shove it out of your prxy directly in your main mod class.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Why do you register your entity client-side only? It needs to be registered for the server as well! Shove it out of your prxy directly in your main mod class.

 

Yes at first I put this into the Main class and then I saw a tutorial. They said that I have to put it into the ClientProxy. I didn't understand this xD

But this doesn't solve my problem :/

Link to comment
Share on other sites

Why do you register your entity client-side only? It needs to be registered for the server as well! Shove it out of your prxy directly in your main mod class.

 

Yes at first I put this into the Main class and then I saw a tutorial. They said that I have to put it into the ClientProxy. I didn't understand this xD

But this doesn't solve my problem :/

 

Can you post your render class?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Why do you register your entity client-side only? It needs to be registered for the server as well! Shove it out of your prxy directly in your main mod class.

 

Yes at first I put this into the Main class and then I saw a tutorial. They said that I have to put it into the ClientProxy. I didn't understand this xD

But this doesn't solve my problem :/

 

Can you post your render class?

 

@SideOnly(Side.CLIENT)
public class RenderLaserArrow extends Render
{
    public void renderArrow(EntityLaserArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
    {
        this.loadTexture("/AdvancedIC2/resources/laserArrows.png");
        GL11.glPushMatrix();
        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
        GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
        Tessellator var10 = Tessellator.instance;
        byte var11 = (byte)(par1EntityArrow.IsQuantum ? 1 : 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);
        float var21 = (float)par1EntityArrow.arrowShake - par9;

        if (var21 > 0.0F)
        {
            float var22 = -MathHelper.sin(var21 * 3.0F) * var21;
            GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F);
        }

        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();
    }

    @Override
    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    {
    	System.out.println("DoRender startet!");
        this.renderArrow((EntityLaserArrow)par1Entity, par2, par4, par6, par8, par9);
    }
}

 

Like I said - I copied the hole code of RenderArrow.

Link to comment
Share on other sites

you have no EntityRegistry.registerModEntity

 

Yes but I have "EntityRegistry.registerGlobalEntityID".

I don't really know the differences between "registerGlobalEntityID" and "registerModEntity".

Do I have to write both in the ClientProxy?

Or do I have to put them in another class?

You put registerModEntity in the same place as registerGlobalEntityID

 

registerGlobalEntityID gives the entity a unique id  (like in the older versions of minecraft if you pressed F3 you'dd see numbers above mobs heads)

registerModEntity actually tells the game their is an entity.

Legend of Zelda Mod[updated September 20th to 3.1.1]

Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0]

Fancy Cheeses[updated May 8th to 0.5.0]

Link to comment
Share on other sites

you have no EntityRegistry.registerModEntity

 

Yes but I have "EntityRegistry.registerGlobalEntityID".

I don't really know the differences between "registerGlobalEntityID" and "registerModEntity".

Do I have to write both in the ClientProxy?

Or do I have to put them in another class?

You put registerModEntity in the same place as registerGlobalEntityID

 

registerGlobalEntityID gives the entity a unique id  (like in the older versions of minecraft if you pressed F3 you'dd see numbers above mobs heads)

registerModEntity actually tells the game their is an entity.

 

O_O OK that was actually the solution. I now put both into the PreInit in my Main Class and now I see the Arrow.

That is confusing xD

 

Thank you all for your help :)

Link to comment
Share on other sites

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.