Jump to content

Why does this generic Renderer doesn't work?


ItsAMysteriousYT

Recommended Posts

Im working on an easier method to render tileentities so i have a generic renderer like this:

 

 

package itsamysterious.mods.reallifemod.core.rendering.tileEntitys;

 

import static org.lwjgl.opengl.GL11.GL_ALPHA_TEST;

import static org.lwjgl.opengl.GL11.GL_CULL_FACE;

import static org.lwjgl.opengl.GL11.glDisable;

import static org.lwjgl.opengl.GL11.glEnable;

import static org.lwjgl.opengl.GL11.glPopMatrix;

import static org.lwjgl.opengl.GL11.glPushMatrix;

import static org.lwjgl.opengl.GL11.glRotatef;

import static org.lwjgl.opengl.GL11.glTranslatef;

import itsamysterious.mods.reallifemod.client.forgeobjmodelported.AdvancedModelLoader;

import itsamysterious.mods.reallifemod.client.forgeobjmodelported.IModelCustom;

import itsamysterious.mods.reallifemod.core.tiles.RLMTileEntity;

import itsamysterious.mods.reallifemod.init.Reference;

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

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.ResourceLocation;

 

public class GenericFurnitureRenderer extends TileEntitySpecialRenderer{

public static  Class<? extends RLMTileEntity> theClass;

private IModelCustom model;

private ResourceLocation texture;

 

public GenericFurnitureRenderer(Class<? extends RLMTileEntity> class1, String modelLoc, String textureLoc) {

theClass = class1;

texture = new ResourceLocation(Reference.ID+":textures/"+textureLoc);

model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.ID+":models/"+modelLoc));

}

 

@Override

public void renderTileEntityAt(TileEntity tile, double x,

double y, double z, float p_180535_8_, int p_180535_9_) {

if(tile.getClass().equals(theClass)){

RLMTileEntity theTile = (RLMTileEntity) tile;

{

glPushMatrix();

        glDisable(GL_CULL_FACE);

        glEnable(GL_ALPHA_TEST);

       

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

glRotatef(theTile.getBlockMetadata() * 90, 0.0F, 1.0F, 0.0F);

if(theTile.getBlockMetadata()*90==180||theTile.getBlockMetadata()*90==0){

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

 

}

        bindTexture(texture);

        model.renderAll();

        glPopMatrix();

}

}

}

 

 

}

 

 

 

 

Can anybody tell me why it does not workj?

 

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.