From 4f7ad220df0438b6f3382110577b53f29da46453 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 15:50:07 -0400 Subject: Update of all changes --- .../TileEntityJewelrsCraftingTableRender.java | 259 +++++++++++---------- 1 file changed, 141 insertions(+), 118 deletions(-) mode change 100644 => 100755 src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java (limited to 'src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java') diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java old mode 100644 new mode 100755 index 02b12aa..a62d21d --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.tileentity.renders; import org.lwjgl.opengl.GL11; + import darkknight.jewelrycraft.model.ModelJewlersCraftingBench; import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable; import darkknight.jewelrycraft.util.Variables; @@ -16,122 +17,144 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRenderer -{ - ModelJewlersCraftingBench modelTable = new ModelJewlersCraftingBench(); - String texture = "textures/tileentities/JewelrsCraftingBench.png"; - - /** - * @param te - * @param x - * @param y - * @param z - * @param scale - */ - @Override - public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); - ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture); - Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture); - TileEntityJewelrsCraftingTable jt = (TileEntityJewelrsCraftingTable)te; - GL11.glPushMatrix(); - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - try{ - int block = te.getBlockMetadata(); - if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); - else if (block == 2){ - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); - }else if (block == 3){ - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); - } - } - catch(Exception e){} - modelTable.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - if (jt != null){ - if (jt.hasJewelry && jt.jewelry.getIconIndex() != null && jt.jewelry.getIconIndex().getIconName() != ""){ - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.jewelry); - entityitem.getEntityItem().stackSize = 1; - entityitem.hoverStart = 0.0F; - GL11.glRotatef(180F, 1F, 0F, 0F); - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(0.55F, -1.5F, -0.45F); - GL11.glRotatef(jt.angle, 0F, 1F, 0F); - if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - else{ - GL11.glRotatef(180F, 0F, 1F, 0F); - RenderManager.instance.options.fancyGraphics = true; - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - RenderManager.instance.options.fancyGraphics = false; - } - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - if (jt.hasEndItem && jt.endItem.getIconIndex().getIconName() != ""){ - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.endItem); - entityitem.getEntityItem().stackSize = 1; - entityitem.hoverStart = 0.0F; - GL11.glRotatef(180F, 1F, 0F, 0F); - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(0.0F, -1.6F, 0.6F); - GL11.glRotatef(jt.angle, 0F, 1F, 0F); - if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - else{ - GL11.glRotatef(180F, 0F, 1F, 0F); - RenderManager.instance.options.fancyGraphics = true; - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - RenderManager.instance.options.fancyGraphics = false; - } - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - if (jt.hasGem && jt.gem.getIconIndex().getIconName() != ""){ - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.gem); - entityitem.getEntityItem().stackSize = 1; - entityitem.hoverStart = 0.0F; - GL11.glRotatef(180F, 1F, 0F, 0F); - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(-0.55F, -1.5F, -0.45F); - GL11.glRotatef(jt.angle, 0F, 1F, 0F); - if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - else{ - GL11.glRotatef(180F, 0F, 1F, 0F); - RenderManager.instance.options.fancyGraphics = true; - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - RenderManager.instance.options.fancyGraphics = false; - } - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - } - GL11.glPopMatrix(); - GL11.glPopMatrix(); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param block - */ - public void adjustLightFixture(World world, int i, int j, int k, Block block) - { - Tessellator tess = Tessellator.instance; - float brightness = block.getLightOpacity(world, i, j, k); - int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); - int modulousModifier = skyLight % 65536; - int divModifier = skyLight / 65536; - tess.setColorOpaque_F(brightness, brightness, brightness); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier); - } +public class TileEntityJewelrsCraftingTableRender + extends TileEntitySpecialRenderer { + ModelJewlersCraftingBench modelTable = + new ModelJewlersCraftingBench(); + String texture = + "textures/tileentities/JewelrsCraftingBench.png"; + + /** + * @param te + * @param x + * @param y + * @param z + * @param scale + */ + @Override + public void renderTileEntityAt(TileEntity te, double x, double y, + double z, float scale) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, + (float) z + 0.5F); + ResourceLocation blockTexture = + new ResourceLocation(Variables.MODID, texture); + Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture); + TileEntityJewelrsCraftingTable jt = + (TileEntityJewelrsCraftingTable) te; + GL11.glPushMatrix(); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + try { + int block = te.getBlockMetadata(); + if (block == 1) + GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); + else if (block == 2) { + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); + } else if (block == 3) { + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); + } + } catch (Exception e) { + } + modelTable.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, + 0.0625F); + if (jt != null) { + if (jt.hasJewelry && jt.jewelry.getIconIndex() != null + && jt.jewelry.getIconIndex().getIconName() != "") { + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + EntityItem entityitem = new EntityItem(te.getWorldObj(), + 0.0D, 0.0D, 0.0D, jt.jewelry); + entityitem.getEntityItem().stackSize = 1; + entityitem.hoverStart = 0.0F; + GL11.glRotatef(180F, 1F, 0F, 0F); + GL11.glScalef(0.5F, 0.5F, 0.5F); + GL11.glTranslatef(0.55F, -1.5F, -0.45F); + GL11.glRotatef(jt.angle, 0F, 1F, 0F); + if (RenderManager.instance.options.fancyGraphics) + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + else { + GL11.glRotatef(180F, 0F, 1F, 0F); + RenderManager.instance.options.fancyGraphics = true; + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + RenderManager.instance.options.fancyGraphics = false; + } + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + if (jt.hasEndItem + && jt.endItem.getIconIndex().getIconName() != "") { + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + EntityItem entityitem = new EntityItem(te.getWorldObj(), + 0.0D, 0.0D, 0.0D, jt.endItem); + entityitem.getEntityItem().stackSize = 1; + entityitem.hoverStart = 0.0F; + GL11.glRotatef(180F, 1F, 0F, 0F); + GL11.glScalef(0.5F, 0.5F, 0.5F); + GL11.glTranslatef(0.0F, -1.6F, 0.6F); + GL11.glRotatef(jt.angle, 0F, 1F, 0F); + if (RenderManager.instance.options.fancyGraphics) + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + else { + GL11.glRotatef(180F, 0F, 1F, 0F); + RenderManager.instance.options.fancyGraphics = true; + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + RenderManager.instance.options.fancyGraphics = false; + } + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + if (jt.hasGem && jt.gem.getIconIndex().getIconName() != "") { + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + EntityItem entityitem = new EntityItem(te.getWorldObj(), + 0.0D, 0.0D, 0.0D, jt.gem); + entityitem.getEntityItem().stackSize = 1; + entityitem.hoverStart = 0.0F; + GL11.glRotatef(180F, 1F, 0F, 0F); + GL11.glScalef(0.5F, 0.5F, 0.5F); + GL11.glTranslatef(-0.55F, -1.5F, -0.45F); + GL11.glRotatef(jt.angle, 0F, 1F, 0F); + if (RenderManager.instance.options.fancyGraphics) + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + else { + GL11.glRotatef(180F, 0F, 1F, 0F); + RenderManager.instance.options.fancyGraphics = true; + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + RenderManager.instance.options.fancyGraphics = false; + } + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + } + GL11.glPopMatrix(); + GL11.glPopMatrix(); + } + + /** + * @param world + * @param i + * @param j + * @param k + * @param block + */ + public void adjustLightFixture(World world, int i, int j, int k, + Block block) { + Tessellator tess = Tessellator.instance; + float brightness = block.getLightOpacity(world, i, j, k); + int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); + int modulousModifier = skyLight % 65536; + int divModifier = skyLight / 65536; + tess.setColorOpaque_F(brightness, brightness, brightness); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, + modulousModifier, divModifier); + } } -- cgit v1.2.3