LOTS of alchemy changes...
This commit is contained in:
parent
64ccc50698
commit
2b749000b6
99 changed files with 7488 additions and 659 deletions
|
@ -8,16 +8,54 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
|
||||
|
||||
public class BeamRenderer
|
||||
{
|
||||
private static final ResourceLocation field_110629_a = new ResourceLocation("textures/entity/beacon_beam.png");
|
||||
protected static TileEntityRendererDispatcher field_147501_a;
|
||||
|
||||
|
||||
public int xInit;
|
||||
public int yInit;
|
||||
public int zInit;
|
||||
|
||||
public int xFinal;
|
||||
public int yFinal;
|
||||
public int zFinal;
|
||||
|
||||
public int colourRed;
|
||||
public int colourGreen;
|
||||
public int colourBlue;
|
||||
public int colourIntensity;
|
||||
|
||||
public double size;
|
||||
|
||||
public void setInitialPosition(int x, int y, int z)
|
||||
{
|
||||
this.xInit = x;
|
||||
this.yInit = y;
|
||||
this.zInit = z;
|
||||
}
|
||||
|
||||
public void setColourAndFinalPosition(ColourAndCoords col)
|
||||
{
|
||||
this.colourRed = col.colourRed;
|
||||
this.colourGreen = col.colourGreen;
|
||||
this.colourBlue = col.colourBlue;
|
||||
this.colourIntensity = col.colourIntensity;
|
||||
|
||||
this.xFinal = col.xCoord;
|
||||
this.yFinal = col.yCoord;
|
||||
this.zFinal = col.zCoord;
|
||||
}
|
||||
|
||||
public void setSize(double size)
|
||||
{
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
protected static void bindTexture(ResourceLocation p_147499_1_)
|
||||
{
|
||||
TextureManager texturemanager = BeamRenderer.field_147501_a.field_147553_e;
|
||||
TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e;
|
||||
|
||||
if (texturemanager != null)
|
||||
{
|
||||
|
@ -25,14 +63,16 @@ public class BeamRenderer
|
|||
}
|
||||
}
|
||||
|
||||
public static void render()
|
||||
public void render(double d0, double d1, double d2)
|
||||
{
|
||||
double d0 = 0;
|
||||
double d1 = 0;
|
||||
double d2 = 0;
|
||||
|
||||
|
||||
float distance = 5; //Total distance
|
||||
int xDiff = this.xFinal - this.xInit;
|
||||
int yDiff = this.yFinal - this.yInit;
|
||||
int zDiff = this.zFinal - this.zInit;
|
||||
|
||||
float planarAngle = (float)(Math.atan2(-zDiff, xDiff) * 180d / Math.PI); //Radians
|
||||
float verticalAngle = (float)(Math.atan2(yDiff, Math.sqrt(xDiff*xDiff + zDiff+zDiff)) * 180d / Math.PI);
|
||||
|
||||
float distance = (float) Math.sqrt(xDiff*xDiff + yDiff*yDiff + zDiff*zDiff); //Total distance
|
||||
|
||||
GL11.glPushMatrix();
|
||||
float f1 = 1.0f;
|
||||
|
@ -51,11 +91,11 @@ public class BeamRenderer
|
|||
GL11.glDepthMask(false);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(255, 0, 0, 50);
|
||||
tessellator.setColorRGBA(colourRed, colourGreen, colourBlue, colourIntensity);
|
||||
//tessellator.setColorOpaque(255, 255, 255);
|
||||
|
||||
double inside = 0.45d-0.5d;
|
||||
double outside = 1.0d-0.45d-0.5d;
|
||||
double inside = -(this.size/2d);
|
||||
double outside = 1.0d-(0.50d - this.size/2d)-0.5d;
|
||||
|
||||
double d18 = inside;
|
||||
double d19 = inside;
|
||||
|
@ -73,8 +113,8 @@ public class BeamRenderer
|
|||
|
||||
GL11.glTranslated(d0+0.5, d1+0.5, d2+0.5);
|
||||
|
||||
GL11.glRotatef(45F, 0F, 1F, 0F); //Rotate on planar axis
|
||||
GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis
|
||||
GL11.glRotatef(planarAngle, 0F, 1F, 0F); //Rotate on planar axis
|
||||
GL11.glRotatef(verticalAngle, 0F, 0F, 1F); //Rotate vertical axis
|
||||
//GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically
|
||||
|
||||
double offset = 0;
|
||||
|
|
|
@ -0,0 +1,485 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.block;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
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;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer
|
||||
{
|
||||
private final RenderItem customRenderItem;
|
||||
private ModelAlchemicalCalcinator modelConduit = new ModelAlchemicalCalcinator();
|
||||
|
||||
private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png");
|
||||
|
||||
public RenderAlchemicCalcinator()
|
||||
{
|
||||
customRenderItem = new RenderItem()
|
||||
{
|
||||
@Override
|
||||
public boolean shouldBob()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
customRenderItem.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f)
|
||||
{
|
||||
if (tileEntity instanceof TEAlchemicCalcinator)
|
||||
{
|
||||
TEAlchemicCalcinator tileAltar = (TEAlchemicCalcinator) tileEntity;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/AlchemicalCalcinator.png");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
|
||||
//A reference to your Model file. Again, very important.
|
||||
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
//Tell it to stop rendering for both the PushMatrix's
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
// GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (tileAltar.getStackInSlot(1) != null)
|
||||
{
|
||||
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(1));
|
||||
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
|
||||
ghostEntityItem.hoverStart = 0.0F;
|
||||
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(1));
|
||||
//translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), d0, d1, d2, ForgeDirection.DOWN);
|
||||
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 + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f*2f);
|
||||
}
|
||||
|
||||
//GL11.glTranslatef((float) tileAltar.xCoord + 0.5F, (float) tileAltar.yCoord + 2.7F, (float) tileAltar.zCoord + 0.5F);
|
||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
|
||||
if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock))
|
||||
{
|
||||
GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F);
|
||||
}
|
||||
|
||||
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (tileAltar.getStackInSlot(0) != null)
|
||||
{
|
||||
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0));
|
||||
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
|
||||
ghostEntityItem.hoverStart = 0.0F;
|
||||
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0));
|
||||
//translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), d0, d1, d2, ForgeDirection.DOWN);
|
||||
float displacement = -0.5F;
|
||||
|
||||
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 + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f*2f);
|
||||
}
|
||||
|
||||
//GL11.glTranslatef((float) tileAltar.xCoord + 0.5F, (float) tileAltar.yCoord + 2.7F, (float) tileAltar.zCoord + 0.5F);
|
||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
|
||||
if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock))
|
||||
{
|
||||
GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F);
|
||||
}
|
||||
|
||||
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
ReagentContainerInfo[] info = tileAltar.getContainerInfo(ForgeDirection.UNKNOWN);
|
||||
if(info.length >= 1 && info[0] != null)
|
||||
{
|
||||
ReagentStack reagentStack = info[0].reagent;
|
||||
int capacity = info[0].capacity;
|
||||
if(reagentStack != null && reagentStack.reagent != null)
|
||||
{
|
||||
Reagent reagent = reagentStack.reagent;
|
||||
this.renderTankContents(d0, d1, d2, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for (int i = 0; i <= 1; i++)
|
||||
// {
|
||||
// GL11.glPushMatrix();
|
||||
//
|
||||
// if (tileAltar.getStackInSlot(i) != null)
|
||||
// {
|
||||
// float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(i));
|
||||
// float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||
// EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
|
||||
// ghostEntityItem.hoverStart = 0.0F;
|
||||
// ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(i));
|
||||
// //translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), d0, d1, d2, ForgeDirection.DOWN);
|
||||
// float displacementX = getXDisplacementForSlot(i);
|
||||
// float displacementY = getYDisplacementForSlot(i);
|
||||
// float displacementZ = getZDisplacementForSlot(i);
|
||||
//
|
||||
// if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
|
||||
// {
|
||||
// GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.7F, (float) d2 + 0.5F + displacementZ);
|
||||
// } else
|
||||
// {
|
||||
// GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.6F, (float) d2 + 0.5F + displacementZ);
|
||||
// }
|
||||
//
|
||||
// //GL11.glTranslatef((float) tileAltar.xCoord + 0.5F, (float) tileAltar.yCoord + 2.7F, (float) tileAltar.zCoord + 0.5F);
|
||||
// GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
// GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||
// customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
// }
|
||||
//
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
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.instance;
|
||||
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);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(colourRed, colourGreen, colourBlue, colourIntensity);
|
||||
|
||||
GL11.glTranslated(x+0.5, y+0.5, z+0.5);
|
||||
//GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis
|
||||
//GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically
|
||||
|
||||
tessellator.setBrightness(240);
|
||||
|
||||
double x1 = -7d/16d;
|
||||
double x2 = 7d/16d;
|
||||
double y1 = 1d/16d;
|
||||
double y2 = 5d/16d;
|
||||
double z1 = -7d/16d;
|
||||
double z2 = 7d/16d;
|
||||
|
||||
double resx1 = 0.0d;
|
||||
double resx2 = 0.0d;
|
||||
double resy1 = 1.0d;
|
||||
double resy2 = 1.0d;
|
||||
|
||||
tessellator.addVertexWithUV(x1, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z1, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x1, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y1, z2, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x2, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx1, resy2);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private float getGhostItemScaleFactor(ItemStack itemStack)
|
||||
{
|
||||
float scaleFactor = 1.5F;
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
switch (customRenderItem.getMiniBlockCount(itemStack,(byte)1))
|
||||
{
|
||||
case 1:
|
||||
return 0.90F * scaleFactor;
|
||||
|
||||
case 2:
|
||||
return 0.90F * scaleFactor;
|
||||
|
||||
case 3:
|
||||
return 0.90F * scaleFactor;
|
||||
|
||||
case 4:
|
||||
return 0.90F * scaleFactor;
|
||||
|
||||
case 5:
|
||||
return 0.80F * scaleFactor;
|
||||
|
||||
default:
|
||||
return 0.90F * scaleFactor;
|
||||
}
|
||||
} else
|
||||
{
|
||||
switch (customRenderItem.getMiniItemCount(itemStack,(byte)1))
|
||||
{
|
||||
case 1:
|
||||
return 0.65F * scaleFactor;
|
||||
|
||||
case 2:
|
||||
return 0.65F * scaleFactor;
|
||||
|
||||
case 3:
|
||||
return 0.65F * scaleFactor;
|
||||
|
||||
case 4:
|
||||
return 0.65F * scaleFactor;
|
||||
|
||||
default:
|
||||
return 0.65F * scaleFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return scaleFactor;
|
||||
}
|
||||
|
||||
private float getXDisplacementForSlot(int slot)
|
||||
{
|
||||
switch (slot)
|
||||
{
|
||||
case 0:
|
||||
return 0.0f;
|
||||
|
||||
case 1:
|
||||
return -0.375f;
|
||||
|
||||
case 2:
|
||||
return -0.125f;
|
||||
|
||||
case 3:
|
||||
return 0.3125f;
|
||||
|
||||
case 4:
|
||||
return 0.3125f;
|
||||
|
||||
case 5:
|
||||
return -0.125f;
|
||||
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
private float getYDisplacementForSlot(int slot)
|
||||
{
|
||||
switch (slot)
|
||||
{
|
||||
case 0:
|
||||
return 0.4f;
|
||||
|
||||
case 1:
|
||||
return -0.35f;
|
||||
|
||||
case 6:
|
||||
return 0.4f;
|
||||
|
||||
default:
|
||||
return -0.35f;
|
||||
}
|
||||
}
|
||||
|
||||
private float getZDisplacementForSlot(int slot)
|
||||
{
|
||||
switch (slot)
|
||||
{
|
||||
case 0:
|
||||
return 0.0f;
|
||||
|
||||
case 1:
|
||||
return 0.0f;
|
||||
|
||||
case 2:
|
||||
return 0.375f;
|
||||
|
||||
case 3:
|
||||
return 0.25f;
|
||||
|
||||
case 4:
|
||||
return -0.25f;
|
||||
|
||||
case 5:
|
||||
return -0.375f;
|
||||
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection 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;
|
||||
}
|
||||
|
||||
case UNKNOWN:
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
case UNKNOWN:
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.block;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
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.renderer.model.ModelCrystalBelljar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RenderCrystalBelljar extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelCrystalBelljar modelConduit = new ModelCrystalBelljar();
|
||||
|
||||
private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png");
|
||||
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f)
|
||||
{
|
||||
if (tileEntity instanceof TEBellJar)
|
||||
{
|
||||
TEBellJar tileAltar = (TEBellJar) tileEntity;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
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");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
|
||||
//A reference to your Model file. Again, very important.
|
||||
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
//Tell it to stop rendering for both the PushMatrix's
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
// GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
|
||||
|
||||
|
||||
ReagentContainerInfo[] info = tileAltar.getContainerInfo(ForgeDirection.UNKNOWN);
|
||||
if(info.length >= 1 && info[0] != null)
|
||||
{
|
||||
ReagentStack reagentStack = info[0].reagent;
|
||||
int capacity = info[0].capacity;
|
||||
if(reagentStack != null && reagentStack.reagent != null)
|
||||
{
|
||||
Reagent reagent = reagentStack.reagent;
|
||||
this.renderTankContents(d0, d1, d2, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity);
|
||||
}
|
||||
}
|
||||
|
||||
// this.renderTankContents(d0, d1, d2, 255, 0, 0, 200);
|
||||
|
||||
|
||||
|
||||
|
||||
// for (int i = 0; i <= 1; i++)
|
||||
// {
|
||||
// GL11.glPushMatrix();
|
||||
//
|
||||
// if (tileAltar.getStackInSlot(i) != null)
|
||||
// {
|
||||
// float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(i));
|
||||
// float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||
// EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
|
||||
// ghostEntityItem.hoverStart = 0.0F;
|
||||
// ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(i));
|
||||
// //translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), d0, d1, d2, ForgeDirection.DOWN);
|
||||
// float displacementX = getXDisplacementForSlot(i);
|
||||
// float displacementY = getYDisplacementForSlot(i);
|
||||
// float displacementZ = getZDisplacementForSlot(i);
|
||||
//
|
||||
// if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
|
||||
// {
|
||||
// GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.7F, (float) d2 + 0.5F + displacementZ);
|
||||
// } else
|
||||
// {
|
||||
// GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.6F, (float) d2 + 0.5F + displacementZ);
|
||||
// }
|
||||
//
|
||||
// //GL11.glTranslatef((float) tileAltar.xCoord + 0.5F, (float) tileAltar.yCoord + 2.7F, (float) tileAltar.zCoord + 0.5F);
|
||||
// GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
// GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||
// customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
// }
|
||||
//
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
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.instance;
|
||||
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);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(colourRed, colourGreen, colourBlue, colourIntensity);
|
||||
|
||||
GL11.glTranslated(x+0.5, y+0.5, z+0.5);
|
||||
//GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis
|
||||
//GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically
|
||||
|
||||
tessellator.setBrightness(240);
|
||||
|
||||
double x1 = -4d/16d;
|
||||
double x2 = 4d/16d;
|
||||
double y1 = -6d/16d;
|
||||
double y2 = 4d/16d;
|
||||
double z1 = -4d/16d;
|
||||
double z2 = 4d/16d;
|
||||
|
||||
double resx1 = 0.0d;
|
||||
double resx2 = 0.0d;
|
||||
double resy1 = 1.0d;
|
||||
double resy2 = 1.0d;
|
||||
|
||||
tessellator.addVertexWithUV(x1, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z1, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x1, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y1, z2, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x2, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx1, resy2);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@ public class RenderPedestal extends TileEntitySpecialRenderer
|
|||
{
|
||||
TEPedestal tileAltar = (TEPedestal) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ public class RenderPedestal extends TileEntitySpecialRenderer
|
|||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class RenderPlinth extends TileEntitySpecialRenderer
|
|||
{
|
||||
TEPlinth tileAltar = (TEPlinth) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -8,19 +8,24 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.renderer.BeamRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RenderReagentConduit extends TileEntitySpecialRenderer
|
||||
{
|
||||
private static final ResourceLocation field_110629_a = new ResourceLocation("alchemicalwizardry:textures/models/TransCircle.png");
|
||||
private static final ResourceLocation field_110629_a = new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f)
|
||||
{
|
||||
if (tileEntity instanceof TEReagentConduit)
|
||||
{
|
||||
int renderCount = ((TEReagentConduit)tileEntity).renderCount;
|
||||
float key1 = (tileEntity.xCoord*54f - tileEntity.yCoord*38.72f + tileEntity.zCoord*10.432f);
|
||||
float key2 = (tileEntity.xCoord*21.43f - tileEntity.yCoord*9.96f + tileEntity.zCoord*12.8f);
|
||||
|
||||
Int3 colourMap = ((TEReagentConduit) tileEntity).getColour();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
float f1 = 1.0f;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
@ -38,14 +43,14 @@ public class RenderReagentConduit extends TileEntitySpecialRenderer
|
|||
GL11.glDepthMask(false);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(0, 0, 255, 90);
|
||||
tessellator.setColorRGBA(colourMap.xCoord, colourMap.yCoord, colourMap.zCoord, 200);
|
||||
//tessellator.setColorOpaque(255, 255, 255);
|
||||
|
||||
GL11.glTranslated(d0+0.5, d1+0.5, d2+0.5);
|
||||
|
||||
GL11.glRotatef(tileEntity.getWorldObj().getWorldTime()/3.0f, 0F, 1F, 0F); //Rotate on planar axis
|
||||
//GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis
|
||||
//GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically
|
||||
GL11.glRotatef(renderCount + key1, 0F, 0F, 1F); //Rotate vertical axis
|
||||
GL11.glRotatef(renderCount*2f + key2, 1F, 0F, 0F); //Rotate cylindrically
|
||||
|
||||
double offset = 0;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSpellEffectBlock extends TileEntitySpecialRenderer
|
|||
{
|
||||
TESpellEffectBlock tileSpellBlock = (TESpellEffectBlock) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSpellEnhancementBlock extends TileEntitySpecialRenderer
|
|||
{
|
||||
TESpellEnhancementBlock tileSpellBlock = (TESpellEnhancementBlock) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSpellModifierBlock extends TileEntitySpecialRenderer
|
|||
{
|
||||
TESpellModifierBlock tileSpellBlock = (TESpellModifierBlock) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSpellParadigmBlock extends TileEntitySpecialRenderer
|
|||
{
|
||||
TESpellParadigmBlock tileSpellBlock = (TESpellParadigmBlock) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -21,11 +21,6 @@ public class RenderWritingTable extends TileEntitySpecialRenderer
|
|||
{
|
||||
private ModelWritingTable modelWritingTable = new ModelWritingTable();
|
||||
private final RenderItem customRenderItem;
|
||||
// private final RenderItem customRenderItem1;
|
||||
// private final RenderItem customRenderItem2;
|
||||
// private final RenderItem customRenderItem3;
|
||||
// private final RenderItem customRenderItem4;
|
||||
// private final RenderItem customRenderItem5;
|
||||
|
||||
public RenderWritingTable()
|
||||
{
|
||||
|
@ -47,7 +42,7 @@ public class RenderWritingTable extends TileEntitySpecialRenderer
|
|||
{
|
||||
TEWritingTable tileAltar = (TEWritingTable) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/WritingTable.png");
|
||||
|
|
|
@ -42,7 +42,7 @@ public class TEAltarRenderer extends TileEntitySpecialRenderer
|
|||
{
|
||||
TEAltar tileAltar = (TEAltar) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.block.itemRender;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelAlchemicalCalcinator;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class TEAlchemicalCalcinatorItemRenderer implements IItemRenderer
|
||||
{
|
||||
private ModelAlchemicalCalcinator modelConduit = new ModelAlchemicalCalcinator();
|
||||
|
||||
private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Block block = ModBlocks.blockAlchemicCalcinator;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/AlchemicalCalcinator.png");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
|
||||
//A reference to your Model file. Again, very important.
|
||||
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
//Tell it to stop rendering for both the PushMatrix's
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IItemRenderer implementation *
|
||||
*/
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
return true;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,9 +2,11 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender;
|
|||
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBloodAltar;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TEAltarItemRenderer implements IItemRenderer
|
||||
|
@ -38,30 +40,25 @@ public class TEAltarItemRenderer implements IItemRenderer
|
|||
// TODO Auto-generated method stub
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
{
|
||||
renderBloodAltar(0f, 0f, 0f, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
case EQUIPPED:
|
||||
{
|
||||
renderBloodAltar(0f, 0f, 0f, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
case INVENTORY:
|
||||
{
|
||||
renderBloodAltar(0f, -0.25f, 0f, scale);
|
||||
return;
|
||||
}
|
||||
case ENTITY:
|
||||
renderBloodAltar((RenderBlocks) data[0], item, 0, 0, 0, scale);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderBloodAltar((RenderBlocks) data[0], item, 0, 0, 0.5f, scale);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderBloodAltar((RenderBlocks) data[0], item, +0.5f, 0.5f, +0.5f, scale);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderBloodAltar((RenderBlocks) data[0], item, -0.5f, -0.75f, -0.5f, scale);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBloodAltar(float x, float y, float z, float scale)
|
||||
private void renderBloodAltar(RenderBlocks render, ItemStack item, float x, float y, float z, float scale)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
// Disable Lighting Calculations
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.block.itemRender;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelCrystalBelljar;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class TEBellJarItemRenderer implements IItemRenderer
|
||||
{
|
||||
private ModelCrystalBelljar modelConduit = new ModelCrystalBelljar();
|
||||
|
||||
private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/CrystalBelljar.png");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
|
||||
//A reference to your Model file. Again, very important.
|
||||
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
//Tell it to stop rendering for both the PushMatrix's
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IItemRenderer implementation *
|
||||
*/
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
return true;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@ public class TEConduitItemRenderer implements IItemRenderer
|
|||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
@ -92,4 +93,4 @@ public class TEConduitItemRenderer implements IItemRenderer
|
|||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelAlchemicalCalcinator extends ModelBase
|
||||
{
|
||||
//fields
|
||||
ModelRenderer top1;
|
||||
ModelRenderer top2;
|
||||
ModelRenderer top3;
|
||||
ModelRenderer top4;
|
||||
ModelRenderer tank;
|
||||
ModelRenderer centreCollumn;
|
||||
ModelRenderer furnaceShape;
|
||||
ModelRenderer glassWindow;
|
||||
ModelRenderer Shape1;
|
||||
ModelRenderer Shape2;
|
||||
ModelRenderer Shape3;
|
||||
ModelRenderer Shape4;
|
||||
ModelRenderer Shape5;
|
||||
|
||||
public ModelAlchemicalCalcinator()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
top1 = new ModelRenderer(this, 0, 34);
|
||||
top1.addBox(4F, -8F, -8F, 4, 3, 16);
|
||||
top1.setRotationPoint(0F, 16F, 0F);
|
||||
top1.setTextureSize(128, 128);
|
||||
top1.mirror = true;
|
||||
setRotation(top1, 0F, 0F, 0F);
|
||||
top2 = new ModelRenderer(this, 41, 34);
|
||||
top2.addBox(-8F, -8F, -8F, 4, 3, 16);
|
||||
top2.setRotationPoint(0F, 16F, 0F);
|
||||
top2.setTextureSize(128, 128);
|
||||
top2.mirror = true;
|
||||
setRotation(top2, 0F, 0F, 0F);
|
||||
top3 = new ModelRenderer(this, 25, 55);
|
||||
top3.addBox(-4F, -8F, 4F, 8, 3, 4);
|
||||
top3.setRotationPoint(0F, 16F, 0F);
|
||||
top3.setTextureSize(128, 128);
|
||||
top3.mirror = true;
|
||||
setRotation(top3, 0F, 0F, 0F);
|
||||
top4 = new ModelRenderer(this, 0, 55);
|
||||
top4.addBox(-4F, -8F, -8F, 8, 3, 4);
|
||||
top4.setRotationPoint(0F, 16F, 0F);
|
||||
top4.setTextureSize(128, 128);
|
||||
top4.mirror = true;
|
||||
setRotation(top4, 0F, 0F, 0F);
|
||||
tank = new ModelRenderer(this, 0, 0);
|
||||
tank.addBox(-8F, -5F, -8F, 16, 4, 16);
|
||||
tank.setRotationPoint(0F, 16F, 0F);
|
||||
tank.setTextureSize(128, 128);
|
||||
tank.mirror = true;
|
||||
setRotation(tank, 0F, 0F, 0F);
|
||||
centreCollumn = new ModelRenderer(this, 0, 21);
|
||||
centreCollumn.addBox(-4F, -5F, -4F, 8, 4, 8);
|
||||
centreCollumn.setRotationPoint(0F, 16F, 0F);
|
||||
centreCollumn.setTextureSize(128, 128);
|
||||
centreCollumn.mirror = true;
|
||||
setRotation(centreCollumn, 0F, 0F, 0F);
|
||||
furnaceShape = new ModelRenderer(this, 0, 63);
|
||||
furnaceShape.addBox(-8F, -1F, -8F, 16, 5, 16);
|
||||
furnaceShape.setRotationPoint(0F, 16F, 0F);
|
||||
furnaceShape.setTextureSize(128, 128);
|
||||
furnaceShape.mirror = true;
|
||||
setRotation(furnaceShape, 0F, 0F, 0F);
|
||||
glassWindow = new ModelRenderer(this, 0, 85);
|
||||
glassWindow.addBox(-4F, -8F, -4F, 8, 0, 8);
|
||||
glassWindow.setRotationPoint(0F, 16F, 0F);
|
||||
glassWindow.setTextureSize(128, 128);
|
||||
glassWindow.mirror = true;
|
||||
setRotation(glassWindow, 0F, 0F, 0F);
|
||||
Shape1 = new ModelRenderer(this, 0, 94);
|
||||
Shape1.addBox(-8F, 4F, -8F, 4, 4, 4);
|
||||
Shape1.setRotationPoint(0F, 16F, 0F);
|
||||
Shape1.setTextureSize(128, 128);
|
||||
Shape1.mirror = true;
|
||||
setRotation(Shape1, 0F, 0F, 0F);
|
||||
Shape2 = new ModelRenderer(this, 0, 103);
|
||||
Shape2.addBox(-4F, 6F, -4F, 8, 1, 8);
|
||||
Shape2.setRotationPoint(0F, 16F, 0F);
|
||||
Shape2.setTextureSize(128, 128);
|
||||
Shape2.mirror = true;
|
||||
setRotation(Shape2, 0F, 0F, 0F);
|
||||
Shape3 = new ModelRenderer(this, 0, 94);
|
||||
Shape3.addBox(4F, 4F, -8F, 4, 4, 4);
|
||||
Shape3.setRotationPoint(0F, 16F, 0F);
|
||||
Shape3.setTextureSize(128, 128);
|
||||
Shape3.mirror = true;
|
||||
setRotation(Shape3, 0F, 0F, 0F);
|
||||
Shape4 = new ModelRenderer(this, 0, 94);
|
||||
Shape4.addBox(-8F, 4F, 4F, 4, 4, 4);
|
||||
Shape4.setRotationPoint(0F, 16F, 0F);
|
||||
Shape4.setTextureSize(128, 128);
|
||||
Shape4.mirror = true;
|
||||
setRotation(Shape4, 0F, 0F, 0F);
|
||||
Shape5 = new ModelRenderer(this, 0, 94);
|
||||
Shape5.addBox(4F, 4F, 4F, 4, 4, 4);
|
||||
Shape5.setRotationPoint(0F, 16F, 0F);
|
||||
Shape5.setTextureSize(128, 128);
|
||||
Shape5.mirror = true;
|
||||
setRotation(Shape5, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
top1.render(f5);
|
||||
top2.render(f5);
|
||||
top3.render(f5);
|
||||
top4.render(f5);
|
||||
tank.render(f5);
|
||||
centreCollumn.render(f5);
|
||||
furnaceShape.render(f5);
|
||||
glassWindow.render(f5);
|
||||
Shape1.render(f5);
|
||||
Shape2.render(f5);
|
||||
Shape3.render(f5);
|
||||
Shape4.render(f5);
|
||||
Shape5.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelCrystalBelljar extends ModelBase
|
||||
{
|
||||
//fields
|
||||
ModelRenderer handle1;
|
||||
ModelRenderer handle2;
|
||||
ModelRenderer jar1;
|
||||
ModelRenderer woodBottom;
|
||||
ModelRenderer jar2;
|
||||
ModelRenderer jar3;
|
||||
ModelRenderer jar4;
|
||||
ModelRenderer jar5;
|
||||
|
||||
public ModelCrystalBelljar()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 64;
|
||||
|
||||
handle1 = new ModelRenderer(this, 0, 17);
|
||||
handle1.addBox(-2F, -7F, -2F, 4, 1, 4);
|
||||
handle1.setRotationPoint(0F, 16F, 0F);
|
||||
handle1.setTextureSize(128, 64);
|
||||
handle1.mirror = true;
|
||||
setRotation(handle1, 0F, 0F, 0F);
|
||||
handle2 = new ModelRenderer(this, 0, 23);
|
||||
handle2.addBox(-1F, -6F, -1F, 2, 1, 2);
|
||||
handle2.setRotationPoint(0F, 16F, 0F);
|
||||
handle2.setTextureSize(128, 64);
|
||||
handle2.mirror = true;
|
||||
setRotation(handle2, 0F, 0F, 0F);
|
||||
jar1 = new ModelRenderer(this, 0, 27);
|
||||
jar1.addBox(-4F, -5F, -4F, 8, 1, 8);
|
||||
jar1.setRotationPoint(0F, 16F, 0F);
|
||||
jar1.setTextureSize(128, 64);
|
||||
jar1.mirror = true;
|
||||
setRotation(jar1, 0F, 0F, 0F);
|
||||
woodBottom = new ModelRenderer(this, 0, 0);
|
||||
woodBottom.addBox(-7F, 6F, -7F, 14, 2, 14);
|
||||
woodBottom.setRotationPoint(0F, 16F, 0F);
|
||||
woodBottom.setTextureSize(128, 64);
|
||||
woodBottom.mirror = true;
|
||||
setRotation(woodBottom, 0F, 0F, 0F);
|
||||
jar2 = new ModelRenderer(this, 0, 38);
|
||||
jar2.addBox(-5F, -4F, 4F, 10, 10, 1);
|
||||
jar2.setRotationPoint(0F, 16F, 0F);
|
||||
jar2.setTextureSize(128, 64);
|
||||
jar2.mirror = true;
|
||||
setRotation(jar2, 0F, 0F, 0F);
|
||||
jar3 = new ModelRenderer(this, 46, 38);
|
||||
jar3.addBox(4F, -4F, -4F, 1, 10, 8);
|
||||
jar3.setRotationPoint(0F, 16F, 0F);
|
||||
jar3.setTextureSize(128, 64);
|
||||
jar3.mirror = true;
|
||||
setRotation(jar3, 0F, 0F, 0F);
|
||||
jar4 = new ModelRenderer(this, 23, 38);
|
||||
jar4.addBox(-5F, -4F, -5F, 10, 10, 1);
|
||||
jar4.setRotationPoint(0F, 16F, 0F);
|
||||
jar4.setTextureSize(128, 64);
|
||||
jar4.mirror = true;
|
||||
setRotation(jar4, 0F, 0F, 0F);
|
||||
jar5 = new ModelRenderer(this, 65, 38);
|
||||
jar5.addBox(-5F, -4F, -4F, 1, 10, 8);
|
||||
jar5.setRotationPoint(0F, 16F, 0F);
|
||||
jar5.setTextureSize(128, 64);
|
||||
jar5.mirror = true;
|
||||
setRotation(jar5, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
handle1.render(f5);
|
||||
handle2.render(f5);
|
||||
jar1.render(f5);
|
||||
woodBottom.render(f5);
|
||||
jar2.render(f5);
|
||||
jar3.render(f5);
|
||||
jar4.render(f5);
|
||||
jar5.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue