Guest User

Renderer

a guest
Jun 6th, 2015
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.76 KB | None | 0 0
  1. package net.roadcraft.mod.renderer;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4.  
  5. import net.minecraft.block.Block;
  6. import net.minecraft.client.renderer.OpenGlHelper;
  7. import net.minecraft.client.renderer.Tessellator;
  8. import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  9. import net.minecraft.tileentity.TileEntity;
  10. import net.minecraft.util.ResourceLocation;
  11. import net.minecraft.world.World;
  12. import net.roadcraft.mod.Roadcraft;
  13. import net.roadcraft.mod.model.ModelRoadSignPostBase;
  14. import net.roadcraft.mod.tileentity.TileEntityRoadSignPostBase;
  15.  
  16. public class RenderRoadSignPostBase extends TileEntitySpecialRenderer {
  17.  
  18.     private static ResourceLocation texture = new ResourceLocation(Roadcraft.MODID + ":" + "textures/model/RoadSignPostBase.png");
  19.    
  20.     private ModelRoadSignPostBase model;
  21.    
  22.     public RenderRoadSignPostBase() {
  23.         this.model = new ModelRoadSignPostBase();
  24.        
  25.        
  26.     }
  27.     @Override
  28.     public void renderTileEntityAt(TileEntity tilentity, double x, double y, double z, float f) {
  29.         GL11.glPushMatrix();
  30.             GL11.glTranslatef((float)x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
  31.             GL11.glRotatef(180, 0F, 0F, 1F);
  32.             this.bindTexture(texture);
  33.             GL11.glPushMatrix();
  34.                 this.model.renderModel(0.0625F);
  35.             GL11.glPopMatrix();
  36.        
  37.        
  38.         GL11.glPopMatrix();
  39.                    
  40.     }
  41.    
  42.     public void renderBlockYour(TileEntityRoadSignPostBase tl, World world, int i, int j, int k, Block block) {
  43.         Tessellator tessellator = Tessellator.instance;
  44.        
  45.          
  46.         int dir = world.getBlockMetadata(i, j, k);
  47.        
  48.         GL11.glPushMatrix();
  49.          GL11.glTranslatef(0.5F, 0, 0.5F);
  50.          GL11.glRotatef(dir * (-90F), 0F, 1F, 0F);
  51.          GL11.glTranslatef(-0.5F, 0, -0.5F);
  52.        
  53.  
  54.         GL11.glPopMatrix();
  55.        
  56.     }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment