Advertisement
Arctic_Wolfy

CraftingRenderer.class #2

Feb 29th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.36 KB | None | 0 0
  1. package com.arctic.paperArmor.client;
  2.  
  3. import com.arctic.paperArmor.init.ModItems;
  4. import com.arctic.paperArmor.tileEntities.TECrafting;
  5. import net.minecraft.client.renderer.Tessellator;
  6. import net.minecraft.client.renderer.texture.TextureMap;
  7. import net.minecraft.init.Items;
  8. import net.minecraft.item.Item;
  9. import net.minecraft.item.ItemBlock;
  10. import net.minecraft.item.ItemStack;
  11. import net.minecraft.tileentity.TileEntity;
  12. import org.lwjgl.opengl.GL11;
  13.  
  14. public class CraftingRenderer extends TERendererBase{
  15.     @Override
  16.     public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
  17.         this.bindTexture(TextureMap.locationItemsTexture);
  18.  
  19.         Tessellator tessellator = Tessellator.instance;
  20.         GL11.glPushMatrix();
  21.         GL11.glTranslated(x, y, z);
  22.         tessellator.startDrawingQuads();
  23.  
  24.         Helper helper = new Helper();
  25.         helper.y2=0.1;
  26.  
  27.         helper.icon = ModItems.paperTile.getIconFromDamage(0);
  28.         helper.set();
  29.  
  30.         TECrafting craft = (TECrafting) tileEntity;
  31.         for (int i = 0; i < 3; i++) {
  32.             for (int j = 0; j < 3; j++) {
  33.                 ItemStack stack = craft.getStackInSlot(i + (j * 3));
  34.                 helper.x1 = ((double) i)/3D;
  35.                 helper.z1 = ((double) j)/3D;
  36.                 helper.x2 = ((double) i+1D)/3D;
  37.                 helper.z2 = ((double) j+1D)/3D;
  38.                 if (i==1&&j==0){
  39.                     helper.y2=0.05;
  40.                     helper.icon = Items.redstone.getIconFromDamage(0);
  41.                     helper.set();
  42.                     helper.drawPosY(tessellator);
  43.                     helper.y2=0.1;
  44.                 }
  45.                 if (stack!=null){
  46.                     Item item = stack.getItem();
  47.                     if (item instanceof ItemBlock){
  48.                         this.bindTexture(TextureMap.locationBlocksTexture);
  49.                         helper.icon = ((ItemBlock) item).field_150939_a.getIcon(0,0);
  50.                     } else {
  51.                         this.bindTexture(TextureMap.locationItemsTexture);
  52.                         helper.icon = stack.getItem().getIcon(stack, 0);
  53.                     }
  54.                     helper.set();
  55.                     helper.drawPosY(tessellator);
  56.                 }
  57.             }
  58.         }
  59.  
  60.  
  61.  
  62.         tessellator.draw();
  63.         GL11.glPopMatrix();
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement