Jump to content

[1.7.10] How do I load textures for a modeled block? [SOLVED]


ThePhysician2000

Recommended Posts

So I have my modeled block, and I was wondering how do I load a texture-mapped skin for a modeled block?

Here is the screenshot of the block:

http://imgur.com/GlTG20D

It doesn't use Tessellators, and I was hoping that I could load textures similar to chests, but couldn't find a single tutorial that worked. Any idea how to do this?

Link to comment
Share on other sites

Is that techne or wavefront? Seems Techne-like.

 

Wavefront is a simple matter of creating a new resourcelocation and binding the texture before rendering the model.

You can find an tutorial here:

http://www.minecraftforge.net/wiki/Using_wavefront_model

 

If it is techne:

In techne:

http://www.minecraftforge.net/wiki/Modelling_in_Techne

http://pixelmon.wikia.com/wiki/Using_Texture_Maps_In_Techne

And code:

http://www.minecraftforge.net/wiki/Using_Your_Techne_Model

 

Link to comment
Share on other sites

Is that techne or wavefront? Seems Techne-like.

 

Wavefront is a simple matter of creating a new resourcelocation and binding the texture before rendering the model.

You can find an tutorial here:

http://www.minecraftforge.net/wiki/Using_wavefront_model

 

If it is techne:

In techne:

http://www.minecraftforge.net/wiki/Modelling_in_Techne

http://pixelmon.wikia.com/wiki/Using_Texture_Maps_In_Techne

And code:

http://www.minecraftforge.net/wiki/Using_Your_Techne_Model

Yes it is Techne, but so far neither of those methods worked.

Link to comment
Share on other sites

Post your code.

 

Here is (or at least, what I am lead to believe is) the code you want.

 

TileEntity(block):

 

package net.thephysician2000sfurniture;

 

import java.util.Set;

 

import org.lwjgl.opengl.GL11;

 

import net.minecraft.entity.Entity;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.ResourceLocation;

import net.minecraft.world.World;

 

public class TileEntityTableOne extends TileEntity{

 

public final ResourceLocation table_oak = new ResourceLocation(MainClass.MODID, "textures/model/table_oak.png");

{

 

this.bindTexture(table_oak);

}

private void bindTexture(ResourceLocation table_oak) {

table_oak = new ResourceLocation(MainClass.MODID, "textures/model/table_oak.png");

}

 

}

 

 

TileEntityRenderer(block):

 

 

package net.thephysician2000sfurniture;

 

import net.minecraft.block.Block;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.OpenGlHelper;

import net.minecraft.client.renderer.Tessellator;

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

import net.minecraft.entity.Entity;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.ResourceLocation;

import net.minecraft.world.World;

 

import org.lwjgl.opengl.GL11;

 

 

public class TileEntityTableOneRender extends TileEntitySpecialRenderer {

 

    private final Table model;

    private int textureWidth = 64;

    private int textureHight = 32;

   

    public TileEntityTableOneRender() {

            this.model = new Table();

    }

   

    private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {

            int meta = world.getBlockMetadata(x, y, z);

            GL11.glPushMatrix();

            GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);

            GL11.glPopMatrix();

    }

 

 

    @Override

    public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {

        GL11.glPushMatrix();

        GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);

        GL11.glPushMatrix();

        GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

        this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

        GL11.glPopMatrix();

        GL11.glPopMatrix();

    }

}

 

 

Link to comment
Share on other sites

Below the glTranslatef, add the following:

 

ResourceLocation table_oak = new ResourceLocation(MainClass.MODID, "textures/model/table_oak.png");
Minecraft.getMinecraft().renderEngine.bindTexture(table_oak);

 

You do not need any code in the actual TileEntity.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

Below the glTranslatef, add the following:

 

ResourceLocation table_oak = new ResourceLocation(MainClass.MODID, "textures/model/table_oak.png");
Minecraft.getMinecraft().renderEngine.bindTexture(table_oak);

 

You do not need any code in the actual TileEntity.

 

Thanks, but it didn't work.

Link to comment
Share on other sites

hi

 

post your error log?

(Look for "using missing texture, unable to load")

 

-TGG

 

Took a look, and this is what you get when you place the block in the world:

 

 

[20:11:32] [server thread/INFO]: ForgeDevName joined the game

[20:11:34] [server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 2013ms behind, skipping 40 tick(s)

[20:11:37] [Client thread/WARN]: Failed to load texture: thephysician2000sfurnituremod:textures/model/table_oak.png

java.io.FileNotFoundException: thephysician2000sfurnituremod:textures/model/table_oak.png

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:71) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:35) ~[simpleTexture.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:45) [TextureManager.class:?]

at thephysician2000sfurniture.TileEntityTableOneRender.renderTileEntityAt(TileEntityTableOneRender.java:39) [TileEntityTableOneRender.class:?]

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141) [TileEntityRendererDispatcher.class:?]

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126) [TileEntityRendererDispatcher.class:?]

at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:545) [RenderGlobal.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1308) [EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1099) [EntityRenderer.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1066) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]

at GradleStart.bounce(GradleStart.java:107) [start/:?]

at GradleStart.startClient(GradleStart.java:100) [start/:?]

at GradleStart.main(GradleStart.java:55) [start/:?]

 

 

 

I've highlighted what I think is the problem. And, yes, the file is there.

Link to comment
Share on other sites

Found the problem. Your modid is thephysician2000sfurnituremod, but your assets directory is thephysician2000sfurniture. Rename the directory to thephysician2000sfurnituremod, or change your modid to thephysician2000sfurniture.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

Found the problem. Your modid is thephysician2000sfurnituremod, but your assets directory is thephysician2000sfurniture. Rename the directory to thephysician2000sfurnituremod, or change your modid to thephysician2000sfurniture.

 

Changed the MODID, and it worked! Thank you very much! :D

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.



×
×
  • Create New...

Important Information

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