Finished (almost) everything !items

This commit is contained in:
Arcaratus 2015-07-30 14:52:39 -04:00
parent 8eed901fcb
commit a9507b3b68
145 changed files with 1261 additions and 2156 deletions

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.common.renderer.block;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicalCalcinator;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
@ -19,16 +20,15 @@ import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelAlchemicalCalcinator;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer
public class RenderAlchemicalCalcinator extends TileEntitySpecialRenderer
{
private final RenderItem customRenderItem;
private ModelAlchemicalCalcinator modelConduit = new ModelAlchemicalCalcinator();
private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png");
public RenderAlchemicCalcinator()
public RenderAlchemicalCalcinator()
{
customRenderItem = Minecraft.getMinecraft().getRenderItem();
}
@ -36,9 +36,9 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f, int i)
{
if (tileEntity instanceof TEAlchemicCalcinator)
if (tileEntity instanceof TEAlchemicalCalcinator)
{
TEAlchemicCalcinator tileAltar = (TEAlchemicCalcinator) tileEntity;
TEAlchemicalCalcinator tileAltar = (TEAlchemicalCalcinator) tileEntity;
GL11.glPushMatrix();
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);

View file

@ -0,0 +1,80 @@
package WayofTime.alchemicalWizardry.common.renderer.block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBloodAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
public class RenderAltar extends TileEntitySpecialRenderer
{
private ModelBloodAltar modelBloodAltar = new ModelBloodAltar();
private final RenderItem customRenderItem;
public RenderAltar()
{
customRenderItem = Minecraft.getMinecraft().getRenderItem();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f, int i)
{
modelBloodAltar.renderBloodAltar((TEAltar) tileEntity, d0, d1, d2);
modelBloodAltar.renderBloodLevel((TEAltar) tileEntity, d0, d1, d2);
if (tileEntity instanceof TEAltar)
{
TEAltar tileAltar = (TEAltar) tileEntity;
GL11.glPushMatrix();
if (tileAltar.getStackInSlot(0) != null)
{
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0));
float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0;
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorld());
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0));
float displacement = 0.2F;
if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
{
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F);
} else
{
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.6F, (float) d2 + 0.5F);
}
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
customRenderItem.func_175043_b(ghostEntityItem.getEntityItem()); //renderItemModel
}
GL11.glPopMatrix();
}
}
private float getGhostItemScaleFactor(ItemStack itemStack)
{
float scaleFactor = 1.0F;
if (itemStack != null)
{
if (itemStack.getItem() instanceof ItemBlock)
{
return 0.9f;
} else
{
return 0.65f;
}
}
return scaleFactor;
}
}

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.common.renderer.block;
import WayofTime.alchemicalWizardry.common.tileEntity.TEChemistrySet;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -7,21 +8,19 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.FMLClientHandler;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelWritingTable;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelChemistrySet;
public class RenderWritingTable extends TileEntitySpecialRenderer
public class RenderChemistrySet extends TileEntitySpecialRenderer
{
private ModelWritingTable modelWritingTable = new ModelWritingTable();
private ModelChemistrySet modelChemistrySet = new ModelChemistrySet();
private final RenderItem customRenderItem;
public RenderWritingTable()
public RenderChemistrySet()
{
customRenderItem = Minecraft.getMinecraft().getRenderItem();
}
@ -29,9 +28,9 @@ public class RenderWritingTable extends TileEntitySpecialRenderer
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f, int a)
{
if (tileEntity instanceof TEWritingTable)
if (tileEntity instanceof TEChemistrySet)
{
TEWritingTable tileAltar = (TEWritingTable) tileEntity;
TEChemistrySet tileAltar = (TEChemistrySet) tileEntity;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPushMatrix();
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
@ -39,7 +38,7 @@ public class RenderWritingTable extends TileEntitySpecialRenderer
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
this.modelWritingTable.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
this.modelChemistrySet.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
@ -164,102 +163,4 @@ public class RenderWritingTable extends TileEntitySpecialRenderer
return 0.0f;
}
}
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, EnumFacing forgeDirection)
{
if (ghostItemStack != null)
{
if (ghostItemStack.getItem() instanceof ItemBlock)
{
switch (forgeDirection)
{
case DOWN:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F);
return;
}
case UP:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F);
return;
}
case NORTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F);
return;
}
case SOUTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F);
return;
}
case EAST:
{
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
case WEST:
{
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
default:
{
}
}
} else
{
switch (forgeDirection)
{
case DOWN:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F);
return;
}
case UP:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F);
return;
}
case NORTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F);
return;
}
case SOUTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F);
return;
}
case EAST:
{
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
case WEST:
{
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
default:
{
}
}
}
}
}
}

View file

@ -1,7 +1,6 @@
package WayofTime.alchemicalWizardry.common.renderer.block;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.FMLClientHandler;
@ -27,7 +26,7 @@ public class RenderConduit extends TileEntitySpecialRenderer
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, tileConduit.getInputDirection(), tileConduit.getOutputDirection());
this.modelConduit.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, tileConduit.getInputDirection(), tileConduit.getOutputDirection());
GL11.glPopMatrix();
GL11.glPopMatrix();
}

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.common.renderer.block;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBelljar;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -15,7 +16,6 @@ import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelCrystalBelljar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
public class RenderCrystalBelljar extends TileEntitySpecialRenderer
{
@ -23,13 +23,12 @@ public class RenderCrystalBelljar extends TileEntitySpecialRenderer
private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f, int i)
{
if (tileEntity instanceof TEBellJar)
if (tileEntity instanceof TEBelljar)
{
TEBellJar tileAltar = (TEBellJar) tileEntity;
TEBelljar tileAltar = (TEBelljar) tileEntity;
GL11.glPushMatrix();
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/CrystalBelljar.png");
@ -57,15 +56,12 @@ public class RenderCrystalBelljar extends TileEntitySpecialRenderer
private void renderTankContents(double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity)
{
GL11.glPushMatrix();
float f1 = 1.0f;
Tessellator tessellator = Tessellator.getInstance();
this.bindTexture(resourceLocation);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
float f2 = 0;
float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthMask(false);

View file

@ -7,7 +7,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.FMLClientHandler;
@ -95,102 +94,4 @@ public class RenderPedestal extends TileEntitySpecialRenderer
return scaleFactor;
}
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, EnumFacing forgeDirection)
{
if (ghostItemStack != null)
{
if (ghostItemStack.getItem() instanceof ItemBlock)
{
switch (forgeDirection)
{
case DOWN:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F);
return;
}
case UP:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F);
return;
}
case NORTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F);
return;
}
case SOUTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F);
return;
}
case EAST:
{
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
case WEST:
{
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
default:
{
}
}
} else
{
switch (forgeDirection)
{
case DOWN:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F);
return;
}
case UP:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F);
return;
}
case NORTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F);
return;
}
case SOUTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F);
return;
}
case EAST:
{
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
case WEST:
{
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
default:
{
}
}
}
}
}
}

View file

@ -7,7 +7,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.FMLClientHandler;
@ -89,102 +88,4 @@ public class RenderPlinth extends TileEntitySpecialRenderer
return scaleFactor;
}
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, EnumFacing forgeDirection)
{
if (ghostItemStack != null)
{
if (ghostItemStack.getItem() instanceof ItemBlock)
{
switch (forgeDirection)
{
case DOWN:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F);
return;
}
case UP:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F);
return;
}
case NORTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F);
return;
}
case SOUTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F);
return;
}
case EAST:
{
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
case WEST:
{
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
default:
{
}
}
} else
{
switch (forgeDirection)
{
case DOWN:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F);
return;
}
case UP:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F);
return;
}
case NORTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F);
return;
}
case SOUTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F);
return;
}
case EAST:
{
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
case WEST:
{
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
default:
{
}
}
}
}
}
}

View file

@ -1,196 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Apr 9, 2014, 11:20:26 PM (GMT)]
*/
package WayofTime.alchemicalWizardry.common.renderer.block;
import org.lwjgl.opengl.ARBFragmentShader;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.ARBVertexShader;
import org.lwjgl.opengl.GL11;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public final class ShaderHelper
{
private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB;
private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB;
public static int beam = 0;
public static void initShaders()
{
beam = createProgram(null, "/assets/alchemicalwizardry/shaders/beam.frag");
}
public static void useShaderWithProps(int shader, Object... props)
{
ARBShaderObjects.glUseProgramObjectARB(shader);
if (shader != 0 && props.length % 2 == 0)
{
int propCount = props.length / 2;
for (int i = 0; i < propCount; i++)
{
String propName = (String) props[i * 2];
Object propVal = props[i * 2 + 1];
int uniform = ARBShaderObjects.glGetUniformLocationARB(shader, propName);
if (propVal instanceof Integer)
ARBShaderObjects.glUniform1iARB(uniform, (Integer) propVal);
if (propVal instanceof Float)
ARBShaderObjects.glUniform1fARB(uniform, (Float) propVal);
}
}
}
public static void useShader(int shader)
{
useShaderWithProps(shader);
}
public static void releaseShader()
{
useShader(0);
}
public static boolean useShaders()
{
return true;
}
// Most of the code taken from the LWJGL wiki
// http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL
private static int createProgram(String vert, String frag)
{
int vertId = 0, fragId = 0, program = 0;
if (vert != null)
vertId = createShader(vert, VERT);
if (frag != null)
fragId = createShader(frag, FRAG);
program = ARBShaderObjects.glCreateProgramObjectARB();
if (program == 0)
return 0;
if (vert != null)
ARBShaderObjects.glAttachObjectARB(program, vertId);
if (frag != null)
ARBShaderObjects.glAttachObjectARB(program, fragId);
ARBShaderObjects.glLinkProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE)
{
return 0;
}
ARBShaderObjects.glValidateProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE)
{
return 0;
}
return program;
}
private static int createShader(String filename, int shaderType)
{
int shader = 0;
try
{
shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
if (shader == 0)
return 0;
ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename));
ARBShaderObjects.glCompileShaderARB(shader);
if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE)
throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
return shader;
} catch (Exception e)
{
ARBShaderObjects.glDeleteObjectARB(shader);
e.printStackTrace();
return -1;
}
}
private static String getLogInfo(int obj)
{
return ARBShaderObjects.glGetInfoLogARB(obj, ARBShaderObjects.glGetObjectParameteriARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB));
}
private static String readFileAsString(String filename) throws Exception
{
StringBuilder source = new StringBuilder();
InputStream in = ShaderHelper.class.getResourceAsStream(filename);
Exception exception = null;
BufferedReader reader;
if (in == null)
return "";
try
{
reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
Exception innerExc = null;
try
{
String line;
while ((line = reader.readLine()) != null)
source.append(line).append('\n');
} catch (Exception exc)
{
exception = exc;
} finally
{
try
{
reader.close();
} catch (Exception exc)
{
if (innerExc == null)
innerExc = exc;
else exc.printStackTrace();
}
}
if (innerExc != null)
throw innerExc;
} catch (Exception exc)
{
exception = exc;
} finally
{
try
{
in.close();
} catch (Exception exc)
{
if (exception == null)
exception = exc;
else exc.printStackTrace();
}
if (exception != null)
throw exception;
}
return source.toString();
}
}

View file

@ -1,178 +0,0 @@
package WayofTime.alchemicalWizardry.common.renderer.block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBloodAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
public class TEAltarRenderer extends TileEntitySpecialRenderer
{
private ModelBloodAltar modelBloodAltar = new ModelBloodAltar();
private final RenderItem customRenderItem;
public TEAltarRenderer()
{
customRenderItem = Minecraft.getMinecraft().getRenderItem();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f, int i)
{
modelBloodAltar.renderBloodAltar((TEAltar) tileEntity, d0, d1, d2);
modelBloodAltar.renderBloodLevel((TEAltar) tileEntity, d0, d1, d2);
if (tileEntity instanceof TEAltar)
{
TEAltar tileAltar = (TEAltar) tileEntity;
GL11.glPushMatrix();
if (tileAltar.getStackInSlot(0) != null)
{
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0));
float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0;
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorld());
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0));
float displacement = 0.2F;
if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
{
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F);
} else
{
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.6F, (float) d2 + 0.5F);
}
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
customRenderItem.func_175043_b(ghostEntityItem.getEntityItem()); //renderItemModel
}
GL11.glPopMatrix();
}
}
private float getGhostItemScaleFactor(ItemStack itemStack)
{
float scaleFactor = 1.0F;
if (itemStack != null)
{
if (itemStack.getItem() instanceof ItemBlock)
{
return 0.9f;
} else
{
return 0.65f;
}
}
return scaleFactor;
}
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, EnumFacing forgeDirection)
{
if (ghostItemStack != null)
{
if (ghostItemStack.getItem() instanceof ItemBlock)
{
switch (forgeDirection)
{
case DOWN:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F);
return;
}
case UP:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F);
return;
}
case NORTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F);
return;
}
case SOUTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F);
return;
}
case EAST:
{
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
case WEST:
{
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
default:
{
return;
}
}
} else
{
switch (forgeDirection)
{
case DOWN:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F);
return;
}
case UP:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F);
return;
}
case NORTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F);
return;
}
case SOUTH:
{
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F);
return;
}
case EAST:
{
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
case WEST:
{
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
default:
{
return;
}
}
}
}
}
}

View file

@ -8,15 +8,15 @@ import net.minecraftforge.fml.client.FMLClientHandler;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelWritingTable;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelChemistrySet;
public class TEWritingTableItemRenderer implements IItemRenderer
public class TEChemistrySetItemRenderer implements IItemRenderer
{
private ModelWritingTable model;
private ModelChemistrySet model;
public TEWritingTableItemRenderer()
public TEChemistrySetItemRenderer()
{
model = new ModelWritingTable();
model = new ModelChemistrySet();
}
@Override