Jump to content

Recommended Posts

Posted

Hi, my model I imported is just black and not using my texture.

 

t3MC0aw.png

 

Model

 

 

package tattyseal.e.plane;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.model.AdvancedModelLoader;

import net.minecraftforge.client.model.IModelCustom;

 

import org.lwjgl.opengl.GL11;

 

import cpw.mods.fml.client.FMLClientHandler;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

@SideOnly(Side.CLIENT)

public class ModelPlane extends ModelBase

{

    private IModelCustom modelTutBox;

   

    public ModelPlane()

    {

        modelTutBox = AdvancedModelLoader.loadModel("/assets/ee/models/Plane.obj");

    }

   

    public void renderAll()

    {

        modelTutBox.renderAll();

    }

   

    public void render(TilePlane box, double x, double y, double z)

    {

        // Push a blank matrix onto the stack

        GL11.glPushMatrix();

           

        // Move the object into the correct position on the block (because the OBJ's origin is the center of the object)

        GL11.glTranslatef((float)x + 0.5f, (float)y + 1f, (float)z + 0.5f);

   

        // Scale our object to about half-size in all directions (the OBJ file is a little large)

        GL11.glScalef(0.25f, 0.25f, 0.25f);

   

        //GL11.gl

       

        // Bind the texture, so that OpenGL properly textures our block.

        FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("ee", "models/biplane.png"));

   

        // Render the object, using modelTutBox.renderAll();

        this.renderAll();

   

        // Pop this matrix from the stack.

        GL11.glPopMatrix();

    }

}

 

 

 

Renderer

 

 

package tattyseal.e.plane;

 

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

import net.minecraft.tileentity.TileEntity;

 

public class TilePlaneRender extends TileEntitySpecialRenderer

{

    private ModelPlane modelTutBox = new ModelPlane();

   

    @Override

    public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)

    {

        modelTutBox.render((TilePlane)tileEntity, x, y, z);

    }

}

 

 

Posted

I'm just taking a guess here. But should there be a leading slash in the file path for this line?

 

// Bind the texture, so that OpenGL properly textures our block.
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("ee", "models/biplane.png"));

 

Shouldn't it be this instead?

 

// Bind the texture, so that OpenGL properly textures our block.
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("ee", "/models/biplane.png"));

 

Like I said I know very little about OpenGL but its a guess.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Posted

I'm just taking a guess here. But should there be a leading slash in the file path for this line?

 

// Bind the texture, so that OpenGL properly textures our block.
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("ee", "models/biplane.png"));

 

Shouldn't it be this instead?

 

// Bind the texture, so that OpenGL properly textures our block.
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("ee", "/models/biplane.png"));

 

Like I said I know very little about OpenGL but its a guess.

 

Umm.. I am sorry, but no. And also, that is MINECRAFT code not OpenGL code! ResourceLocations are just returning Icons in the end anyway I think... I am not entirely sure. But anyway. The extra slash is not needed.

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

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.