Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

 

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.

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.