Guest User

WaffleMakerRenderer.java

a guest
Dec 26th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1. package com.chef.mod.renderer;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4.  
  5. import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  6. import net.minecraft.tileentity.TileEntity;
  7. import net.minecraft.util.ResourceLocation;
  8.  
  9. import com.chef.mod.Debugger;
  10. import com.chef.mod.Reference;
  11. import com.chef.mod.model.ModelWaffleMaker;
  12.  
  13. public class WaffleMakerRenderer extends TileEntitySpecialRenderer {
  14.  
  15.     private static final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID + ":" + "textures/model/ModelWaffleMakerFrontOff.png");
  16.  
  17.     private ModelWaffleMaker model;
  18.  
  19.     public WaffleMakerRenderer() {
  20.  
  21.         this.model = new ModelWaffleMaker();
  22.  
  23.     }
  24.  
  25.     @Override
  26.     public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
  27.        
  28.         int dir = tileentity.getBlockMetadata();
  29.         Debugger.log(dir);
  30.        
  31.         GL11.glPushMatrix();
  32.             GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
  33.  
  34.             if (dir == 5) {
  35.                
  36.                 //East
  37.                 GL11.glRotatef(180, 1F, 0F, 0F);
  38.                
  39.             } else if (dir == 4) {
  40.                
  41.                 //West
  42.                 GL11.glRotatef(180, 1F, 0F, 1F);
  43.                
  44.             } else if (dir == 3) {
  45.                
  46.                 //South
  47.                 GL11.glRotatef(180, 1F, 0F, 0F);
  48.                
  49.             } else if (dir == 2) {
  50.                
  51.                 //North
  52.                 GL11.glRotatef(180, 0F, 0F, 1F);
  53.                
  54.             }
  55.  
  56.        
  57.             this.bindTexture(texture);
  58.        
  59.             GL11.glPushMatrix();
  60.                 this.model.renderModel(0.0625F);
  61.             GL11.glPopMatrix();
  62.         GL11.glPopMatrix();
  63.  
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment