package com.yolp900.itsjustacharm.client.render; import com.yolp900.itsjustacharm.ItsJustaCharm; import com.yolp900.itsjustacharm.api.affinities.IAffinity; import com.yolp900.itsjustacharm.common.tileEntities.TileEntityConstructionTable; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class TESRConstructionTable extends TileEntitySpecialRenderer<TileEntityConstructionTable> { private static Minecraft minecraft; private EntityPlayer player; private static final double period = 24 * Math.PI; @Override public void renderTileEntityAt(TileEntityConstructionTable constructionTable, double x, double y, double z, float partialTicks, int destroyStage) { minecraft = ItsJustaCharm.proxy.getMinecraft(); player = ItsJustaCharm.proxy.getClientPlayer(); /* IAffinity affinityMain = constructionTable.getAffinityMain(); IAffinity affinitySec = constructionTable.getAffinitySec(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); if (affinityMain != null) { renderMainAffinity(affinityMain, constructionTable.getWorld()); } if (affinitySec != null) { renderSecAffinity(affinitySec, constructionTable.getWorld()); } GlStateManager.popMatrix(); */ } private void renderMainAffinity(IAffinity affinity, World world) { } private void renderSecAffinity(IAffinity affinity, World world) { } private void renderAffinity(ItemStack affinity) { RenderItem itemRenderer = minecraft.getRenderItem(); if (affinity != null) { double local = (period * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); float hoverHeight = (float) ((0.4 * (Math.sin(local))) / 8); GlStateManager.translate(0.5F, 1.2F + hoverHeight, 0.5F); EntityItem entityItem = new EntityItem(getWorld(), 0, 0, 0, affinity); entityItem.getEntityItem().stackSize = 1; entityItem.hoverStart = 0.0F; GlStateManager.pushMatrix(); GlStateManager.disableLighting(); float rotation = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.pushAttrib(); RenderHelper.enableStandardItemLighting(); itemRenderer.renderItem(entityItem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED); RenderHelper.disableStandardItemLighting(); GlStateManager.popAttrib(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); GlStateManager.translate(0.0F, -hoverHeight, 0.0F); } } }