Jump to content

ResourceLocation does not work. Please help


SmartNTech

Recommended Posts

 

Hello. I've started with Minecraft modding. Now I'm going to make my first public mod. It's a spell mod. Now I'm in the render class of a flash spell. However, Minecraft does not recognize the texture or the ResourceLocation. Here is the code of the render class:

 

package de.smartntech.orbis.renderer;

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

import com.sun.xml.internal.stream.Entity;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import de.smartntech.orbis.entitys.EntityLightning;
import de.smartntech.orbis.main.Orbis;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.util.ResourceLocation;

@SideOnly(Side.CLIENT)
public class LightningRenderer extends Render{

    

private static final ResourceLocation texture = new ResourceLocation(Orbis.MODID+":textures/entity/lightning.png");
    


    public void doRender(EntityLightning entity, double x, double y, double z, float f_0, float f_1)
    {
        this.getEntityTexture(new ResourceLocation(Orbis.MODID + ":textures/entity/lightning.png"));
        this.bindEntityTexture(entity);
        GL11.glPushMatrix();
        GL11.glTranslatef((float)x, (float)y, (float)z);
        GL11.glRotatef(270F - entity.rotationYaw, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-1*entity.rotationPitch, 0.0F, 0.0F, 1.0F);
        Tessellator tessellator = Tessellator.instance;
        
        float f10 = 0.05625F;
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
        
        
        double size = 16D * entity.length;

        for (int i = 0; i < 4; ++i)
        {
            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glNormal3f(0.0F, 0.0F, f10);
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(0.0D, -2.0D, 0.0D, (double)0, (double)0);
            tessellator.addVertexWithUV(size, -2.0D, 0.0D, entity.length, (double)0);
            tessellator.addVertexWithUV(size, 2.0D, 0.0D, entity.length, (double)1);
            tessellator.addVertexWithUV(0.0D, 2.0D, 0.0D, (double)0, (double)1);
            tessellator.draw();
        }

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
    
    
    protected ResourceLocation getEntityTexture(ResourceLocation resourceLocation)
    {
        return texture;
    }

  
    protected ResourceLocation getEntityTexture(Entity p_110775_1_)
    {
        this.getEntityTexture(new ResourceLocation(Orbis.MODID + ":textures/entity/lightning.png"));
        return this.getEntityTexture((Entity)p_110775_1_);
    }
    
    public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
    {
        this.getEntityTexture(new ResourceLocation(Orbis.MODID + ":textures/entity/lightning.png"));
        this.doRender((Entity)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
    }

    @Override
    public void doRender(net.minecraft.entity.Entity arg0, double arg1, double arg2, double arg3, float arg4,
            float arg5) {
        this.getEntityTexture(new ResourceLocation(Orbis.MODID + ":textures/entity/lightning.png"));
        
    }

    @Override
    protected ResourceLocation getEntityTexture(net.minecraft.entity.Entity arg0) {
        this.getEntityTexture(new ResourceLocation(Orbis.MODID + ":textures/entity/lightning.png"));
        return texture;
    }
}


Please Help me. PS; Sorry for my bad English.

Link to comment
Share on other sites

Wrong subforum.

 

52 minutes ago, SmartNTech said:

import com.sun.xml.internal.stream.Entity;

Wrong import.

 

52 minutes ago, SmartNTech said:

            tessellator.addVertexWithUV

Wrong version(aka 1.7.10 is no longer supported on this forum)

Edited by V0idWa1k3r
Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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