1.6.2 test - Finished liquids, added connected textures on glass

This commit is contained in:
mDiyo committed 2013-07-26 21:18:53 -07:00
1 parent 40c6f445a2
commit a80fcbce86
704 files changed
+60909

No files matched your search

+151
View File
@@ -0,0 +1,151 @@
package tconstruct.client;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class CustomBowRenderer implements IItemRenderer
{
Minecraft mc = Minecraft.getMinecraft();
private RenderBlocks renderBlocksInstance = new RenderBlocks();
@Override
public boolean handleRenderType (ItemStack item, ItemRenderType type)
{
return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON;
}
@Override
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
{
EntityLivingBase living = (EntityLivingBase) data[1];
ItemRenderer renderer = RenderManager.instance.itemRenderer;
for (int i = 0; i < item.getItem().getRenderPasses(item.getItemDamage()) + 1; i++)
renderItem(living, item, i, type);
}
public void renderItem (EntityLivingBase living, ItemStack stack, int renderPass, ItemRenderType type)
{
GL11.glPushMatrix();
Block block = null;
if (stack.getItem() instanceof ItemBlock && stack.itemID < Block.blocksList.length)
{
block = Block.blocksList[stack.itemID];
}
Icon icon = null; //living.getItemIcon(stack, renderPass);
if (living instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) living;
if (player.getItemInUse() != null)
icon = stack.getItem().getIcon(stack, renderPass, player, player.getItemInUse(), player.getItemInUseCount());
else
icon = living.getItemIcon(stack, renderPass);
}
else
{
icon = living.getItemIcon(stack, renderPass);
}
if (icon == null)
{
GL11.glPopMatrix();
return;
}
/*if (stack.getItemSpriteNumber() == 0)
{
this.mc.renderEngine.bindTexture("/terrain.png");
}
else
{
this.mc.renderEngine.bindTexture("/gui/items.png");
}*/
TextureManager texturemanager = this.mc.func_110434_K();
texturemanager.func_110577_a(texturemanager.func_130087_a(stack.getItemSpriteNumber()));
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
GL11.glTranslatef(0.6F, 0.5F, 0.5F);
}
else
{
GL11.glRotatef(180.0F, 0F, 0F, 1.0F);
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.75F);
GL11.glTranslatef(-0.6F, -0.25F, 1.0F);
GL11.glScalef(1.75F, 1.75F, 1.75F);
}
Tessellator tessellator = Tessellator.instance;
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float f4 = 0.0F;
float f5 = 0.3F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(-f4, -f5, 0.0F);
float f6 = 1.5F;
GL11.glScalef(f6, f6, f6);
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getOriginX(), icon.getOriginY(), 0.0625F);
/*if (stack != null && stack.hasEffect() && renderPass == 0)
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
this.mc.renderEngine.bindTexture("%blur%/misc/glint.png");
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f7 = 0.76F;
GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f8 = 0.125F;
GL11.glScalef(f8, f8, f8);
float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f9, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f8, f8, f8);
f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f9, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}*/
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
+283
View File
@@ -0,0 +1,283 @@
package tconstruct.client;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.InputStream;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
/**
*
* @author TheObliterator
*
* A class to create and draw true type
* fonts onto the Minecraft game engine.
*/
public class CustomFont
{
private int texID;
private int[] xPos;
private int[] yPos;
private int startChar;
private int endChar;
private FontMetrics metrics;
/**
* Instantiates the font, filling in default start
* and end character parameters.
*
* 'new CustomFont(ModLoader.getMinecraftInstance(),
* "Arial", 12);
*
* @param mc The Minecraft instance for the font to be bound to.
* @param fontName The name of the font to be drawn.
* @param size The size of the font to be drawn.
*/
public CustomFont(Minecraft mc, Object font, int size)
{
this(mc, font, size, 0, 4000);
}
/**
* Instantiates the font, pre-rendering a sprite
* font image by using a true type font on a
* bitmap. Then allocating that bitmap to the
* Minecraft rendering engine for later use.
*
* 'new CustomFont(ModLoader.getMinecraftInstance(),
* "Arial", 12, 32, 126);'
*
* @param mc The Minecraft instance for the font to be bound to.
* @param fontName The name of the font to be drawn.
* @param size The size of the font to be drawn.
* @param startChar The starting ASCII character id to be drawable. (Default 32)
* @param endChar The ending ASCII character id to be drawable. (Default 126)
*/
public CustomFont(Minecraft mc, Object font, int size, int startChar, int endChar)
{
this.startChar = startChar;
this.endChar = endChar;
xPos = new int[endChar - startChar];
yPos = new int[endChar - startChar];
// Create a bitmap and fill it with a transparent color as well
// as obtain a Graphics instance which can be drawn on.
// NOTE: It is CRUICIAL that the size of the image is 256x256, if
// it is not the Minecraft engine will not draw it properly.
BufferedImage img = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
Graphics g = img.getGraphics();
try
{
if (font instanceof String)
{
String fontName = (String) font;
if (fontName.contains("/"))
g.setFont(Font.createFont(Font.TRUETYPE_FONT, new File(fontName)).deriveFont((float) size));
else
g.setFont(new Font(fontName, 0, size));
}
else if (font instanceof InputStream)
{
g.setFont(Font.createFont(Font.TRUETYPE_FONT, (InputStream) font).deriveFont((float) size));
}
else if (font instanceof File)
{
g.setFont(Font.createFont(Font.TRUETYPE_FONT, (File) font).deriveFont((float) size));
}
}
catch (Exception e)
{
e.printStackTrace();
}
g.setColor(new Color(255, 255, 255, 0));
g.fillRect(0, 0, 256, 256);
g.setColor(Color.white);
metrics = g.getFontMetrics();
// Draw the specified range of characters onto
// the new bitmap, spacing according to the font
// widths. Also allocating positions of characters
// on the bitmap to two arrays which will be used
// later when drawing.
int x = 2;
int y = 2;
for (int i = startChar; i < endChar; i++)
{
g.drawString("" + ((char) i), x, y + g.getFontMetrics().getAscent());
xPos[i - startChar] = x;
yPos[i - startChar] = y - metrics.getMaxDescent();
x += metrics.stringWidth("" + (char) i) + 2;
if (x >= 250 - metrics.getMaxAdvance())
{
x = 2;
y += metrics.getMaxAscent() + metrics.getMaxDescent() + size / 2;
}
}
// Render the finished bitmap into the Minecraft
// graphics engine.
// Sadly broken by 1.6
//texID = mc.renderEngine.allocateAndSetupTexture(img);
}
/**
* Draws a given string with an automatically
* calculated shadow below it.
* @param gui The gui/subclass to be drawn on
* @param text The string to be drawn
* @param x The x position to start drawing
* @param y The y position to start drawing
* @param color The color of the non-shadowed text (Hex)
*/
public void drawStringS (Gui gui, String text, int x, int y, int color)
{
int l = color & 0xff000000;
int shade = (color & 0xfcfcfc) >> 2;
shade += l;
drawString(gui, text, x + 1, y + 1, shade);
drawString(gui, text, x, y, color);
}
/**
* Draws a given string onto a gui/subclass.
* @param gui The gui/subclass to be drawn on
* @param text The string to be drawn
* @param x The x position to start drawing
* @param y The y position to start drawing
* @param color The color of the non-shadowed text (Hex)
*/
public void drawString (Gui gui, String text, int x, int y, int color)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, texID);
float red = (float) (color >> 16 & 0xff) / 255F;
float green = (float) (color >> 8 & 0xff) / 255F;
float blue = (float) (color & 0xff) / 255F;
float alpha = (float) (color >> 24 & 0xff) / 255F;
GL11.glColor4f(red, green, blue, alpha);
int startX = x;
for (int i = 0; i < text.length(); i++)
{
char c = text.charAt(i);
if (c == '\\')
{
char type = text.charAt(i + 1);
if (type == 'n')
{
y += metrics.getAscent() + 2;
x = startX;
}
i++;
continue;
}
drawChar(gui, c, x, y);
x += metrics.getStringBounds("" + c, null).getWidth();
}
}
/**
* Returns the created FontMetrics
* which is used to retrive various
* information about the True Type Font
* @return FontMetrics of the created font.
*/
public FontMetrics getMetrics ()
{
return metrics;
}
/**
* Gets the drawing width of a given
* string of string.
* @param text The string to be measured
* @return The width of the given string.
*/
public int getStringWidth (String text)
{
return (int) getBounds(text).getWidth();
}
/**
* Gets the drawing height of a given
* string of string.
* @param text The string to be measured
* @return The height of the given string.
*/
public int getStringHeight (String text)
{
return (int) getBounds(text).getHeight();
}
/**
* A method that returns a Rectangle that
* contains the width and height demensions
* of the given string.
* @param text The string to be measured
* @return Rectangle containing width and height that
* the text will consume when drawn.
*/
private Rectangle getBounds (String text)
{
int w = 0;
int h = 0;
int tw = 0;
for (int i = 0; i < text.length(); i++)
{
char c = text.charAt(i);
if (c == '\\')
{
char type = text.charAt(i + 1);
if (type == 'n')
{
h += metrics.getAscent() + 2;
if (tw > w)
w = tw;
tw = 0;
}
i++;
continue;
}
tw += metrics.stringWidth("" + c);
}
if (tw > w)
w = tw;
h += metrics.getAscent();
return new Rectangle(0, 0, w, h);
}
/**
* Private drawing method used within other
* drawing methods.
*/
private void drawChar (Gui gui, char c, int x, int y)
{
Rectangle2D bounds = metrics.getStringBounds("" + c, null);
drawTexturedModalRect(x, y, xPos[(byte) c - startChar], yPos[(byte) c - startChar], (int) bounds.getWidth(), (int) bounds.getHeight() + metrics.getMaxDescent());
}
public void drawTexturedModalRect (int x, int y, int u, int v, int width, int height)
{
float offsetWidth = 0.00390625F;
float offsetHeight = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((x + 0), (y + height), 0, ((u + 0) * offsetWidth), ((v + height) * offsetHeight));
tessellator.addVertexWithUV((x + width), (y + height), 0, ((u + width) * offsetWidth), ((v + height) * offsetHeight));
tessellator.addVertexWithUV((x + width), (y + 0), 0, ((u + width) * offsetWidth), ((v + 0) * offsetHeight));
tessellator.addVertexWithUV((x + 0), (y + 0), 0, ((u + 0) * offsetWidth), ((v + 0) * offsetHeight));
tessellator.draw();
}
}
+669
View File
@@ -0,0 +1,669 @@
package tconstruct.client;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.client.block.SmallFontRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderItemCopy extends Render
{
private static final ResourceLocation field_110798_h = new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
public boolean renderWithColor = true;
/** Defines the zLevel of rendering of item on GUI. */
public float zLevel;
public static boolean renderInFrame;
public RenderItemCopy()
{
this.shadowSize = 0.15F;
this.shadowOpaque = 0.75F;
}
/**
* Renders the item
*/
public void doRenderItem (EntityItem par1EntityItem, double par2, double par4, double par6, float par8, float par9)
{
this.func_110777_b(par1EntityItem);
this.random.setSeed(187L);
ItemStack itemstack = par1EntityItem.getEntityItem();
if (itemstack.getItem() != null)
{
GL11.glPushMatrix();
float f2 = shouldBob() ? MathHelper.sin(((float) par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F;
float f3 = (((float) par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI);
byte b0 = getMiniBlockCount(itemstack);
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float f4;
float f5;
float f6;
int i;
Block block = null;
if (itemstack.itemID < Block.blocksList.length)
{
block = Block.blocksList[itemstack.itemID];
}
if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks))
{
;
}
else if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
if (renderInFrame)
{
GL11.glScalef(1.25F, 1.25F, 1.25F);
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
float f7 = 0.25F;
int j = block.getRenderType();
if (j == 1 || j == 19 || j == 12 || j == 2)
{
f7 = 0.5F;
}
GL11.glScalef(f7, f7, f7);
for (i = 0; i < b0; ++i)
{
GL11.glPushMatrix();
if (i > 0)
{
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
GL11.glTranslatef(f5, f4, f6);
}
f5 = 1.0F;
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
GL11.glPopMatrix();
}
}
else
{
float f8;
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
{
if (renderInFrame)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
{
this.random.setSeed(187L);
Icon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
if (this.renderWithColor)
{
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
f5 = (float) (i >> 16 & 255) / 255.0F;
f4 = (float) (i >> 8 & 255) / 255.0F;
f6 = (float) (i & 255) / 255.0F;
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
}
else
{
this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
}
}
}
else
{
if (renderInFrame)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
Icon icon1 = itemstack.getIconIndex();
if (this.renderWithColor)
{
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
f8 = (float) (l >> 16 & 255) / 255.0F;
float f9 = (float) (l >> 8 & 255) / 255.0F;
f5 = (float) (l & 255) / 255.0F;
f4 = 1.0F;
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
}
else
{
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
}
}
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
protected ResourceLocation func_110796_a (EntityItem par1EntityItem)
{
return this.renderManager.renderEngine.func_130087_a(par1EntityItem.getEntityItem().getItemSpriteNumber());
}
/**
* Renders a dropped item
*/
private void renderDroppedItem (EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
{
renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0);
}
private void renderDroppedItem (EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
{
Tessellator tessellator = Tessellator.instance;
if (par2Icon == null)
{
TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
ResourceLocation resourcelocation = texturemanager.func_130087_a(par1EntityItem.getEntityItem().getItemSpriteNumber());
par2Icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
}
float f4 = ((Icon) par2Icon).getMinU();
float f5 = ((Icon) par2Icon).getMaxU();
float f6 = ((Icon) par2Icon).getMinV();
float f7 = ((Icon) par2Icon).getMaxV();
float f8 = 1.0F;
float f9 = 0.5F;
float f10 = 0.25F;
float f11;
if (this.renderManager.options.fancyGraphics)
{
GL11.glPushMatrix();
if (renderInFrame)
{
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
}
else
{
GL11.glRotatef((((float) par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
float f12 = 0.0625F;
f11 = 0.021875F;
ItemStack itemstack = par1EntityItem.getEntityItem();
int j = itemstack.stackSize;
byte b0 = getMiniItemCount(itemstack);
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
for (int k = 0; k < b0; ++k)
{
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
if (k > 0 && shouldSpreadItems())
{
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
GL11.glTranslatef(x, y, f12 + f11);
}
else
{
GL11.glTranslatef(0f, 0f, f12 + f11);
}
if (itemstack.getItemSpriteNumber() == 0)
{
this.func_110776_a(TextureMap.field_110575_b);
}
else
{
this.func_110776_a(TextureMap.field_110576_c);
}
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getOriginX(), ((Icon) par2Icon).getOriginY(), f12);
if (itemstack.hasEffect(pass))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
this.renderManager.renderEngine.func_110577_a(field_110798_h);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f13 = 0.76F;
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f14 = 0.125F;
GL11.glScalef(f14, f14, f14);
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f15, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f14, f14, f14);
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f15, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
GL11.glPopMatrix();
}
else
{
for (int l = 0; l < par3; ++l)
{
GL11.glPushMatrix();
if (l > 0)
{
f11 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
float f16 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
float f17 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
GL11.glTranslatef(f11, f16, f17);
}
if (!renderInFrame)
{
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
}
GL11.glColor4f(par5, par6, par7, 1.0F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double) (0.0F - f9), (double) (0.0F - f10), 0.0D, (double) f4, (double) f7);
tessellator.addVertexWithUV((double) (f8 - f9), (double) (0.0F - f10), 0.0D, (double) f5, (double) f7);
tessellator.addVertexWithUV((double) (f8 - f9), (double) (1.0F - f10), 0.0D, (double) f5, (double) f6);
tessellator.addVertexWithUV((double) (0.0F - f9), (double) (1.0F - f10), 0.0D, (double) f4, (double) f6);
tessellator.draw();
GL11.glPopMatrix();
}
}
}
/**
* Renders the item's icon or block into the UI at the specified position.
*/
public void renderItemIntoGUI (SmallFontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
}
public void renderItemIntoGUI (SmallFontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
{
int k = par3ItemStack.itemID;
int l = par3ItemStack.getItemDamage();
Object object = par3ItemStack.getIconIndex();
float f;
int i1;
float f1;
float f2;
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
{
par2TextureManager.func_110577_a(TextureMap.field_110575_b);
GL11.glPushMatrix();
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
GL11.glScalef(10.0F, 10.0F, 10.0F);
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
GL11.glScalef(1.0F, 1.0F, -1.0F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f = (float) (i1 >> 16 & 255) / 255.0F;
f1 = (float) (i1 >> 8 & 255) / 255.0F;
f2 = (float) (i1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f, f1, f2, 1.0F);
}
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
this.itemRenderBlocks.useInventoryTint = this.renderWithColor;
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
this.itemRenderBlocks.useInventoryTint = true;
GL11.glPopMatrix();
}
else if (Item.itemsList[k].requiresMultipleRenderPasses())
{
GL11.glDisable(GL11.GL_LIGHTING);
for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
{
par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1);
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
f1 = (float) (k1 >> 16 & 255) / 255.0F;
f2 = (float) (k1 >> 8 & 255) / 255.0F;
float f3 = (float) (k1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f1, f2, f3, 1.0F);
}
this.renderIcon(par4, par5, icon, 16, 16);
if (par3ItemStack.hasEffect(j1))
{
renderEffect(par2TextureManager, par4, par5);
}
}
GL11.glEnable(GL11.GL_LIGHTING);
}
else
{
GL11.glDisable(GL11.GL_LIGHTING);
ResourceLocation resourcelocation = par2TextureManager.func_130087_a(par3ItemStack.getItemSpriteNumber());
par2TextureManager.func_110577_a(resourcelocation);
if (object == null)
{
object = ((TextureMap) Minecraft.getMinecraft().func_110434_K().func_110581_b(resourcelocation)).func_110572_b("missingno");
}
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f = (float) (i1 >> 16 & 255) / 255.0F;
f1 = (float) (i1 >> 8 & 255) / 255.0F;
f2 = (float) (i1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f, f1, f2, 1.0F);
}
this.renderIcon(par4, par5, (Icon) object, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
if (par3ItemStack.hasEffect(0))
{
renderEffect(par2TextureManager, par4, par5);
}
}
GL11.glEnable(GL11.GL_CULL_FACE);
}
private void renderEffect (TextureManager manager, int x, int y)
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
manager.func_110577_a(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
/**
* Render the item's icon or block into the GUI, including the glint effect.
*/
public void renderItemAndEffectIntoGUI (SmallFontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
if (par3ItemStack != null)
{
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
{
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
}
/* Modders must handle this themselves if they use custom renderers!
if (par3ItemStack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
par2TextureManager.func_110577_a(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
*/
}
}
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
{
for (int j1 = 0; j1 < 2; ++j1)
{
if (j1 == 0)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
if (j1 == 1)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
float f = 0.00390625F;
float f1 = 0.00390625F;
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
float f3 = 0.0F;
Tessellator tessellator = Tessellator.instance;
float f4 = 4.0F;
if (j1 == 1)
{
f4 = -1.0F;
}
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
(double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
tessellator.draw();
}
}
/**
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
* specified position.
*/
public void renderItemOverlayIntoGUI (SmallFontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
}
public void renderItemOverlayIntoGUI (SmallFontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
{
if (par3ItemStack != null)
{
if (par3ItemStack.stackSize > 1 || par6Str != null)
{
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
if (par3ItemStack.isItemDamaged())
{
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator tessellator = Tessellator.instance;
int i1 = 255 - l << 16 | l << 8;
int j1 = (255 - l) / 4 << 16 | 16128;
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}
/**
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
* tessellator, x, y, width, height, color
*/
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
{
par1Tessellator.startDrawingQuads();
par1Tessellator.setColorOpaque_I(par6);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
par1Tessellator.draw();
}
public void renderIcon (int par1, int par2, Icon par3Icon, int par4, int par5)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
tessellator.draw();
}
protected ResourceLocation func_110775_a (Entity par1Entity)
{
return this.func_110796_a((EntityItem) par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderItem((EntityItem) par1Entity, par2, par4, par6, par8, par9);
}
/**
* Items should spread out when rendered in 3d?
* @return
*/
public boolean shouldSpreadItems ()
{
return true;
}
/**
* Items should have a bob effect
* @return
*/
public boolean shouldBob ()
{
return true;
}
public byte getMiniBlockCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 5)
ret = 3;
if (stack.stackSize > 20)
ret = 4;
if (stack.stackSize > 40)
ret = 5;
return ret;
}
/**
* Allows for a subclass to override how many rendered items appear in a
* "mini item 3d stack"
* @param stack
* @return
*/
public byte getMiniItemCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 15)
ret = 3;
if (stack.stackSize > 31)
ret = 4;
return ret;
}
}
+43
View File
@@ -0,0 +1,43 @@
package tconstruct.client;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class SuperSoakerRender implements IItemRenderer
{
@Override
public boolean handleRenderType (ItemStack item, ItemRenderType type)
{
return type != ItemRenderType.INVENTORY;
}
@Override
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
{
if (type == ItemRenderType.EQUIPPED)
renderEquippedItem(item, (RenderBlocks) data[0], (EntityLiving) data[1]);
if (type == ItemRenderType.ENTITY)
renderEntityItem(item, (RenderBlocks) data[0], (EntityItem) data[1]);
}
void renderEquippedItem (ItemStack item, RenderBlocks renderBlocks, EntityLiving entityLiving)
{
}
void renderEntityItem (ItemStack item, RenderBlocks renderBlocks, EntityItem entityItem)
{
}
}
+187
View File
@@ -0,0 +1,187 @@
package tconstruct.client;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLiving;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import tconstruct.TConstruct;
import tconstruct.blocks.LiquidMetalFinite;
import tconstruct.client.armor.WingModel;
import tconstruct.common.TContent;
import tconstruct.util.player.TPlayerStats;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class TClientEvents
{
Minecraft mc = Minecraft.getMinecraft();
/*@ForgeSubscribe
public void interact (PlayerInteractEvent event)
{
if (event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote)
{
System.out.println("Fired");
List<Skill> skills = TProxyClient.skillList;
if (skills.size() > 0)
{
Skill walls = TConstruct.playerTracker.getPlayerStats(event.entityPlayer.username).skillList.get(0);
walls.rightClickActivate(event.entityPlayer, event.entityPlayer.worldObj);
}
}
}*/
/* Sounds */
/*@ForgeSubscribe
public void onSound (SoundLoadEvent event)
{
try
{
event.manager.soundPoolSounds.addSound("sounds/frypan_hit.ogg", TConstruct.class.getResource("/sounds/frypan_hit.ogg"));
event.manager.soundPoolSounds.addSound("sounds/little_saw.ogg", TConstruct.class.getResource("/sounds/little_saw.ogg"));
event.manager.soundPoolSounds.addSound("sounds/launcher_clank.ogg", TConstruct.class.getResource("/sounds/launcher_clank.ogg"));
System.out.println("[TConstruct] Successfully loaded sounds.");
}
catch (Exception e)
{
System.err.println("[TConstruct] Failed to register one or more sounds");
}
}*/
/* Liquids */
@ForgeSubscribe
public void postStitch (TextureStitchEvent.Post event)
{
for (int i = 0; i < TContent.fluids.length; i++)
{
if (TContent.fluidBlocks[i] instanceof LiquidMetalFinite)
{
LiquidMetalFinite block = (LiquidMetalFinite) TContent.fluidBlocks[i];
TContent.fluids[i].setIcons(block.stillIcon, block.flowIcon);
}
Fluid lava = FluidRegistry.getFluid("lava");
lava.setIcons(Block.lavaStill.getIcon(0, 0), Block.lavaStill.getIcon(2, 0));
Fluid lavawater = FluidRegistry.getFluid("water");
lava.setIcons(Block.waterStill.getIcon(0, 0), Block.waterStill.getIcon(2, 0));
}
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/newhearts.png");
/* HUD */
@ForgeSubscribe
public void renderHealthbar (RenderGameOverlayEvent.Post event)
{
ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
int scaledWidth = scaledresolution.getScaledWidth();
int scaledHeight = scaledresolution.getScaledHeight();
int xBasePos = scaledWidth / 2 - 91;
int yBasePos = scaledHeight - 39;
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(mc.thePlayer.username);
PotionEffect potion = mc.thePlayer.getActivePotionEffect(Potion.wither);
if (potion != null)
return;
potion = mc.thePlayer.getActivePotionEffect(Potion.poison);
if (potion != null)
return;
/*if (event.type == RenderGameOverlayEvent.ElementType.HEALTH)
{
this.mc.func_110434_K().func_110577_a(background);
int hp = mc.thePlayer.getHealth();
for (int iter = 0; iter < hp / 20; iter++)
{
int renderHearts = (hp - 20 * (iter + 1)) / 2;
if (renderHearts > 10)
renderHearts = 10;
for (int i = 0; i < renderHearts; i++)
{
this.drawTexturedModalRect(xBasePos + 8 * i, yBasePos, 0 + 18 * iter, 0, 8, 8);
}
if (hp % 2 == 1 && renderHearts < 10)
{
this.drawTexturedModalRect(xBasePos + 8 * renderHearts, yBasePos, 9 + 18 * iter, 0, 8, 8);
}
}
this.mc.renderEngine.bindTexture("/gui/icons.png");
}*/
/*if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR)
{
if (stats.skillList == null)
return;
int amount = 0;
GL11.glScalef(1/16f, 1/16f, 1/16f);
for (Skill skill : stats.skillList)
{
if (!skill.getActive())
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0F);
this.mc.renderEngine.bindTexture(skill.getTextureFile(scaledresolution.getScaleFactor()));
this.drawTexturedModalRect((2+amount*18)*16, 32, 0, 0, 256, 256);
amount++;
}
GL11.glScalef(16f, 16f, 16f);
}*/
}
public void drawTexturedModalRect (int par1, int par2, int par3, int par4, int par5, int par6)
{
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par6), (double) this.zLevel, (double) ((float) (par3 + 0) * f), (double) ((float) (par4 + par6) * f1));
tessellator.addVertexWithUV((double) (par1 + par5), (double) (par2 + par6), (double) this.zLevel, (double) ((float) (par3 + par5) * f), (double) ((float) (par4 + par6) * f1));
tessellator.addVertexWithUV((double) (par1 + par5), (double) (par2 + 0), (double) this.zLevel, (double) ((float) (par3 + par5) * f), (double) ((float) (par4 + 0) * f1));
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) ((float) (par3 + 0) * f), (double) ((float) (par4 + 0) * f1));
tessellator.draw();
}
double zLevel = 0;
/* Armor */
ModelBiped model = new ModelBiped(5f);
WingModel wings = new WingModel();
/*static
{
model.bipedHead.showModel = false;
}*/
private float interpolateRotation (float par1, float par2, float par3)
{
float f3;
for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F)
{
;
}
while (f3 >= 180.0F)
{
f3 -= 360.0F;
}
return par1 + par3 * f3;
}
protected float handleRotationFloat (EntityLiving par1EntityLiving, float par2)
{
return (float) par1EntityLiving.ticksExisted + par2;
}
}
+88
View File
@@ -0,0 +1,88 @@
package tconstruct.client;
import java.util.EnumSet;
import tconstruct.common.TContent;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
public class TClientTickHandler implements ITickHandler
{
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player;
int zLevel = 0;
int ticks = 0;
@Override
public void tickEnd (EnumSet<TickType> type, Object... tickData)
{
TContent.oreBerry.setGraphicsLevel(Block.leaves.graphicsLevel);
TContent.oreBerrySecond.setGraphicsLevel(Block.leaves.graphicsLevel);
/*player = mc.thePlayer;
if (player == null || player.capabilities.isCreativeMode)
return;
ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
int scaledWidth = scaledresolution.getScaledWidth();
int scaledHeight = scaledresolution.getScaledHeight();
int xBasePos = scaledWidth / 2 - 91;
int yBasePos = scaledHeight - 39;
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/newhearts.png");
int hp = player.getHealth();
for (int iter = 0; iter < hp / 20; iter++)
{
int renderHearts = (hp - 20*(iter+1)) / 2;
if (renderHearts > 10)
renderHearts = 10;
for (int i = 0; i < renderHearts; i++)
{
this.drawTexturedModalRect(xBasePos + 8*i, yBasePos, 0 + 18*iter, 0, 8, 8);
}
if (hp % 2 == 1 && renderHearts < 10)
{
this.drawTexturedModalRect(xBasePos + 8*renderHearts, yBasePos, 9 + 18*iter, 0, 8, 8);
}
}*/
}
@Override
public EnumSet<TickType> ticks ()
{
return EnumSet.of(TickType.RENDER);
//return EnumSet.of(TickType.PLAYER);
}
public void drawTexturedModalRect (int par1, int par2, int par3, int par4, int par5, int par6)
{
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par6), (double) this.zLevel, (double) ((float) (par3 + 0) * f), (double) ((float) (par4 + par6) * f1));
tessellator.addVertexWithUV((double) (par1 + par5), (double) (par2 + par6), (double) this.zLevel, (double) ((float) (par3 + par5) * f), (double) ((float) (par4 + par6) * f1));
tessellator.addVertexWithUV((double) (par1 + par5), (double) (par2 + 0), (double) this.zLevel, (double) ((float) (par3 + par5) * f), (double) ((float) (par4 + 0) * f1));
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) ((float) (par3 + 0) * f), (double) ((float) (par4 + 0) * f1));
tessellator.draw();
}
@Override
public void tickStart (EnumSet<TickType> type, Object... tickData)
{
// TODO Auto-generated method stub
}
@Override
public String getLabel ()
{
// TODO Auto-generated method stub
return null;
}
}
+297
View File
@@ -0,0 +1,297 @@
package tconstruct.client;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.EnumSet;
import tconstruct.TConstruct;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.network.PacketDispatcher;
public class TControls extends TKeyHandler
{
//static KeyBinding grabKey = new KeyBinding("key.grab", 29);
//static KeyBinding stiltsKey = new KeyBinding("key.stilts", 46);
public static KeyBinding armorKey = new KeyBinding("key.tarmor", 24);
/*public static KeyBinding skillOne = new KeyBinding("key.skill.one", 44);
public static KeyBinding skillTwo = new KeyBinding("key.skill.two", 45);
public static KeyBinding skillThree = new KeyBinding("key.skill.three", 46);
public static KeyBinding skillFour = new KeyBinding("key.skill.four", 47);
public static KeyBinding skillFive = new KeyBinding("key.skill.five", 48);*/
static KeyBinding jumpKey;
static KeyBinding invKey;
static Minecraft mc;
boolean jumping;
boolean doubleJump = true;
boolean climbing = false;
boolean onGround = false;
boolean onStilts = false;
int currentTab = 1;
//boolean onStilts = false;
public TControls()
{
super(new KeyBinding[] { armorKey /*, skillOne, skillTwo, skillThree, skillFour, skillFive*/}, new boolean[] { false /*, false, false, false, false, false*/}, getVanillaKeyBindings(),
new boolean[] { false, false });
//System.out.println("Controls registered");Natura
}
private static KeyBinding[] getVanillaKeyBindings ()
{
mc = Minecraft.getMinecraft();
jumpKey = mc.gameSettings.keyBindJump;
invKey = mc.gameSettings.keyBindInventory;
return new KeyBinding[] { jumpKey, invKey };
}
@Override
public String getLabel ()
{
return null;
}
@Override
public void keyDown (EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat)
{
if (tickEnd && mc.theWorld != null)
{
if (kb == armorKey && mc.currentScreen == null) //Extended Armor
{
openArmorGui();//mc.thePlayer.username);
}
if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// && !mc.playerController.isInCreativeMode())
{
TProxyClient.addTabsToInventory((GuiContainer) mc.currentScreen);
}
/*if (kb == skillOne)
{
sendSkillkey(mc.thePlayer, (byte) 0);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
}
if (kb == skillTwo)
{
sendSkillkey(mc.thePlayer, (byte) 1);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
}
if (kb == skillThree)
{
sendSkillkey(mc.thePlayer, (byte) 2);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
}
if (kb == skillFour)
{
sendSkillkey(mc.thePlayer, (byte) 3);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
}
if (kb == skillFive)
{
sendSkillkey(mc.thePlayer, (byte) 4);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
}*/
/*if (kb == jumpKey) //Double jump
{
if (jumping && !doubleJump)
{
//if (player == null)
//player = mc.thePlayer;
mc.thePlayer.motionY = 0.42D;
mc.thePlayer.fallDistance = 0;
if (mc.thePlayer.isPotionActive(Potion.jump))
{
mc.thePlayer.motionY += (double) ((float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);
}
doubleJump = true;
resetFallDamage(mc.thePlayer.username);
}
if (!jumping)
jumping = mc.thePlayer.isAirBorne;
}*/
}
/*else if (kb == stiltsKey) //Stilts
{
float size = 1.8F;
if (!onStilts)
size = 0.8F;
TConstruct.playerTracker.updateSize(mc.thePlayer.username, size);
onStilts = !onStilts;
//updateServer(mc.thePlayer.username, (byte) 11);
if (onStilts)
{
onStilts = false;
}
else
{
onStilts = true;
}
}*/
}
@Override
public void keyUp (EnumSet<TickType> types, KeyBinding kb, boolean tickEnd)
{
//landOnGround();
}
@Override
public EnumSet<TickType> ticks ()
{
return EnumSet.of(TickType.CLIENT);
}
public void landOnGround ()
{
doubleJump = false;
jumping = false;
}
public void resetControls ()
{
doubleJump = false;
jumping = false;
climbing = false;
onGround = false;
onStilts = false;
}
void resetFallDamage (String name)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(10);
outputStream.writeUTF(name);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
void updateSize (String name, float size)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(11);
outputStream.writeUTF(name);
outputStream.writeFloat(size);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
public static void openInventoryGui ()
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(3);
outputStream.writeByte(0);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
public static void openArmorGui ()
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(3);
outputStream.writeByte(1);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
public static void openKnapsackGui ()
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(3);
outputStream.writeByte(2);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
/*public void activateSkill (EntityPlayer player, int slot)
{
if (TProxyClient.skillList.size() > slot)
{
Skill skill = TProxyClient.skillList.get(slot);
if (skill != null)
{
skill.activate(player, player.worldObj);
}
}
}*/
public void sendSkillkey (EntityPlayer player, byte key)
{
TConstruct.playerTracker.activateSkill(player, key);
System.out.println(MinecraftServer.getServer());
if (MinecraftServer.getServer().isDedicatedServer())
{
System.out.println("Send");
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(4);
outputStream.writeByte(key);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
}
static void updateServer (ByteArrayOutputStream bos)
{
Packet250CustomPayload packet = new Packet250CustomPayload();
packet.channel = "TConstruct";
packet.data = bos.toByteArray();
packet.length = bos.size();
PacketDispatcher.sendPacketToServer(packet);
}
}
+149
View File
@@ -0,0 +1,149 @@
package tconstruct.client;
import java.util.EnumSet;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
public abstract class TKeyHandler implements ITickHandler
{
public KeyBinding[] keyBindings;
public KeyBinding[] vKeyBindings;
public boolean[] keyDown;
public boolean[] repeatings;
public boolean[] vRepeatings;
public boolean isDummy;
/**
* Pass an array of keybindings and a repeat flag for each one
*
* @param keyBindings
* @param repeatings
*/
public TKeyHandler(KeyBinding[] keyBindings, boolean[] repeatings, KeyBinding[] vanillaKeys, boolean[] vanillaRepeatings)
{
assert keyBindings.length == repeatings.length : "You need to pass two arrays of identical length";
assert vanillaKeys.length == vanillaRepeatings.length : "You need to pass two arrays of identical length";
this.keyBindings = keyBindings;
this.repeatings = repeatings;
this.vKeyBindings = vanillaKeys;
this.vRepeatings = vanillaRepeatings;
this.keyDown = new boolean[keyBindings.length + vanillaKeys.length];
}
/**
* Register the keys into the system. You will do your own keyboard management elsewhere. No events will fire
* if you use this method
*
* @param keyBindings
*/
public TKeyHandler(KeyBinding[] keyBindings)
{
this.keyBindings = keyBindings;
this.isDummy = true;
}
public KeyBinding[] getKeyBindings ()
{
return this.keyBindings;
}
/**
* Not to be overridden - KeyBindings are tickhandlers under the covers
*/
@Override
public final void tickStart (EnumSet<TickType> type, Object... tickData)
{
keyTick(type, false);
}
/**
* Not to be overridden - KeyBindings are tickhandlers under the covers
*/
@Override
public final void tickEnd (EnumSet<TickType> type, Object... tickData)
{
keyTick(type, true);
}
public void keyTick (EnumSet<TickType> type, boolean tickEnd)
{
for (int i = 0; i < keyBindings.length; i++)
{
KeyBinding keyBinding = keyBindings[i];
int keyCode = keyBinding.keyCode;
boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode));
if (state != keyDown[i] || (state && repeatings[i]))
{
if (state)
{
keyDown(type, keyBinding, tickEnd, state != keyDown[i]);
}
else
{
keyUp(type, keyBinding, tickEnd);
}
if (tickEnd)
{
keyDown[i] = state;
}
}
}
for (int i = 0; i < vKeyBindings.length; i++)
{
KeyBinding keyBinding = vKeyBindings[i];
int keyCode = keyBinding.keyCode;
boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode));
if (state != keyDown[i + keyBindings.length] || (state && vRepeatings[i]))
{
if (state)
{
keyDown(type, keyBinding, tickEnd, state != keyDown[i + keyBindings.length]);
}
else
{
keyUp(type, keyBinding, tickEnd);
}
if (tickEnd)
{
keyDown[i + keyBindings.length] = state;
}
}
}
}
/**
* Called when the key is first in the down position on any tick from the {@link #ticks()}
* set. Will be called subsequently with isRepeat set to true
*
* @see #keyUp(EnumSet, KeyBinding, boolean)
*
* @param types the type(s) of tick that fired when this key was first down
* @param tickEnd was it an end or start tick which fired the key
* @param isRepeat is it a repeat key event
*/
public abstract void keyDown (EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat);
/**
* Fired once when the key changes state from down to up
*
* @see #keyDown(EnumSet, KeyBinding, boolean, boolean)
*
* @param types the type(s) of tick that fired when this key was first down
* @param tickEnd was it an end or start tick which fired the key
*/
public abstract void keyUp (EnumSet<TickType> types, KeyBinding kb, boolean tickEnd);
/**
* This is the list of ticks for which the key binding should trigger. The only
* valid ticks are client side ticks, obviously.
*
* @see cpw.mods.fml.common.ITickHandler#ticks()
*/
public abstract EnumSet<TickType> ticks ();
}
File diff suppressed because it is too large. Load diff
+122
View File
@@ -0,0 +1,122 @@
package tconstruct.client.armor;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class WingModel extends ModelBase
{
ModelRenderer WingBaseRight;
ModelRenderer WingEdgeRight;
ModelRenderer WingInsetRight;
ModelRenderer WingCenterRight;
ModelRenderer WingFlangeRight;
ModelRenderer WingAuxRight;
ModelRenderer WingBaseLeft;
ModelRenderer WingEdgeLeft;
ModelRenderer WingInsetLeft;
ModelRenderer WingCenterLeft;
ModelRenderer WingFlangeLeft;
ModelRenderer WingAuxLeft;
public WingModel()
{
textureWidth = 64;
textureHeight = 64;
//Right Wing
WingBaseRight = new ModelRenderer(this, 0, 41);
WingBaseRight.addBox(-0.5F, -1F, 0F, 1, 2, 10);
WingBaseRight.setRotationPoint(-1F, 1F, 0F);
setRotation(WingBaseRight, 0.5235988F, -0.5235988F, 0F);
WingEdgeRight = new ModelRenderer(this, 0, 53); //Texture position
WingEdgeRight.addBox(0F, 0F, -2F, 1, 9, 2); //Offset, Size
WingEdgeRight.setRotationPoint(-0.502F, -1F, 10F); //Negative x, y - 1, Position
setRotation(WingEdgeRight, 0.5235988F, 0F, 0F); //Angle in radians
WingInsetRight = new ModelRenderer(this, 6, 53);
WingInsetRight.addBox(0F, 0F, -1F, 1, 9, 2);
WingInsetRight.setRotationPoint(-0.504F, 0F, 7.8F);
setRotation(WingInsetRight, 0.3490659F, 0F, 0F);
WingCenterRight = new ModelRenderer(this, 12, 53);
WingCenterRight.addBox(0F, 0F, -1F, 1, 9, 2);
WingCenterRight.setRotationPoint(-0.506F, 0.3F, 6.3F);
setRotation(WingCenterRight, 0.1745329F, 0F, 0F);
WingFlangeRight = new ModelRenderer(this, 18, 53);
WingFlangeRight.addBox(0F, 0F, -1F, 1, 8, 2);
WingFlangeRight.setRotationPoint(-0.508F, 0.3F, 5.1F);
setRotation(WingFlangeRight, 0F, 0F, 0F);
WingAuxRight = new ModelRenderer(this, 24, 53);
WingAuxRight.addBox(0F, 0F, -1F, 1, 7, 2);
WingAuxRight.setRotationPoint(-0.51F, 0.1F, 4F);
setRotation(WingAuxRight, -0.1745329F, 0F, 0F);
WingBaseRight.addChild(WingEdgeRight);
WingBaseRight.addChild(WingInsetRight);
WingBaseRight.addChild(WingCenterRight);
WingBaseRight.addChild(WingFlangeRight);
WingBaseRight.addChild(WingAuxRight);
//Left Wing
WingBaseLeft = new ModelRenderer(this, 42, 41);
WingBaseLeft.addBox(-0.5F, -1F, 0F, 1, 2, 10);
WingBaseLeft.setRotationPoint(1F, 1F, 0F);
setRotation(WingBaseLeft, 0.5235988F, 0.5235988F, 0F);
WingEdgeLeft = new ModelRenderer(this, 58, 53);
WingEdgeLeft.addBox(0F, 0F, -2F, 1, 9, 2);
WingEdgeLeft.setRotationPoint(-0.502F, -1F, 10F);
setRotation(WingEdgeLeft, 0.5235988F, 0F, 0F);
WingInsetLeft = new ModelRenderer(this, 52, 53);
WingInsetLeft.addBox(0F, 0F, -1F, 1, 9, 2);
WingInsetLeft.setRotationPoint(-0.504F, 0F, 7.8F);
setRotation(WingInsetLeft, 0.3490659F, 0F, 0F);
WingCenterLeft = new ModelRenderer(this, 46, 53);
WingCenterLeft.addBox(0F, 0F, -1F, 1, 9, 2);
WingCenterLeft.setRotationPoint(-0.506F, 0.3F, 6.3F);
setRotation(WingCenterLeft, 0.1745329F, 0F, 0F);
WingFlangeLeft = new ModelRenderer(this, 40, 53);
WingFlangeLeft.addBox(0F, 0F, -1F, 1, 8, 2);
WingFlangeLeft.setRotationPoint(-0.508F, 0.3F, 5.1F);
setRotation(WingFlangeLeft, 0F, 0F, 0F);
WingAuxLeft = new ModelRenderer(this, 34, 53);
WingAuxLeft.addBox(0F, 0F, -1F, 1, 7, 2);
WingAuxLeft.setRotationPoint(-0.51F, 0.1F, 4F);
setRotation(WingAuxLeft, -0.1745329F, 0F, 0F);
WingBaseLeft.addChild(WingEdgeLeft);
WingBaseLeft.addChild(WingInsetLeft);
WingBaseLeft.addChild(WingCenterLeft);
WingBaseLeft.addChild(WingFlangeLeft);
WingBaseLeft.addChild(WingAuxLeft);
}
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);
WingBaseRight.render(f5);
WingBaseLeft.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,263 @@
package tconstruct.client.block;
import tconstruct.blocks.RedstoneBallRepeater;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class BallRepeaterRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
//Inventory should be an item. This is not here!
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
return renderRedstoneBallRepeater(block, x, y, z, world);
}
@Override
public boolean shouldRender3DInInventory ()
{
return false;
}
@Override
public int getRenderId ()
{
return model;
}
public boolean renderRedstoneBallRepeater (Block par1Block, int par2, int par3, int par4, IBlockAccess world)
{
Tessellator tessellator = Tessellator.instance;
int l = world.getBlockMetadata(par2, par3, par4);
Icon icon = RedstoneBallRepeater.func_94409_b("repeaterDust_cross");
Icon icon1 = RedstoneBallRepeater.func_94409_b("repeaterDust_line");
Icon icon2 = RedstoneBallRepeater.func_94409_b("repeaterDust_cross_overlay");
Icon icon3 = RedstoneBallRepeater.func_94409_b("repeaterDust_line_overlay");
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(world, par2, par3, par4));
float f = 1.0F;
float f1 = (float) l / 15.0F;
float f2 = f1 * 0.6F + 0.4F;
if (l == 0)
{
f2 = 0.3F;
}
float f3 = f1 * f1 * 0.7F - 0.5F;
float f4 = f1 * f1 * 0.6F - 0.7F;
if (f3 < 0.0F)
{
f3 = 0.0F;
}
if (f4 < 0.0F)
{
f4 = 0.0F;
}
tessellator.setColorOpaque_F(f2, f3, f4);
boolean flag = RedstoneBallRepeater.isPowerProviderOrWire(world, par2 - 1, par3, par4, 1) || !world.isBlockNormalCube(par2 - 1, par3, par4)
&& RedstoneBallRepeater.isPowerProviderOrWire(world, par2 - 1, par3 - 1, par4, -1);
boolean flag1 = RedstoneBallRepeater.isPowerProviderOrWire(world, par2 + 1, par3, par4, 3) || !world.isBlockNormalCube(par2 + 1, par3, par4)
&& RedstoneBallRepeater.isPowerProviderOrWire(world, par2 + 1, par3 - 1, par4, -1);
boolean flag2 = RedstoneBallRepeater.isPowerProviderOrWire(world, par2, par3, par4 - 1, 2) || !world.isBlockNormalCube(par2, par3, par4 - 1)
&& RedstoneBallRepeater.isPowerProviderOrWire(world, par2, par3 - 1, par4 - 1, -1);
boolean flag3 = RedstoneBallRepeater.isPowerProviderOrWire(world, par2, par3, par4 + 1, 0) || !world.isBlockNormalCube(par2, par3, par4 + 1)
&& RedstoneBallRepeater.isPowerProviderOrWire(world, par2, par3 - 1, par4 + 1, -1);
if (!world.isBlockNormalCube(par2, par3 + 1, par4))
{
if (world.isBlockNormalCube(par2 - 1, par3, par4) && RedstoneBallRepeater.isPowerProviderOrWire(world, par2 - 1, par3 + 1, par4, -1))
{
flag = true;
}
if (world.isBlockNormalCube(par2 + 1, par3, par4) && RedstoneBallRepeater.isPowerProviderOrWire(world, par2 + 1, par3 + 1, par4, -1))
{
flag1 = true;
}
if (world.isBlockNormalCube(par2, par3, par4 - 1) && RedstoneBallRepeater.isPowerProviderOrWire(world, par2, par3 + 1, par4 - 1, -1))
{
flag2 = true;
}
if (world.isBlockNormalCube(par2, par3, par4 + 1) && RedstoneBallRepeater.isPowerProviderOrWire(world, par2, par3 + 1, par4 + 1, -1))
{
flag3 = true;
}
}
float f5 = (float) (par2 + 0);
float f6 = (float) (par2 + 1);
float f7 = (float) (par4 + 0);
float f8 = (float) (par4 + 1);
int i1 = 0;
if ((flag || flag1) && !flag2 && !flag3)
{
i1 = 1;
}
if ((flag2 || flag3) && !flag1 && !flag)
{
i1 = 2;
}
if (i1 == 0)
{
int j1 = 0;
int k1 = 0;
int l1 = 16;
int i2 = 16;
if (!flag)
{
f5 += 0.3125F;
}
if (!flag)
{
j1 += 5;
}
if (!flag1)
{
f6 -= 0.3125F;
}
if (!flag1)
{
l1 -= 5;
}
if (!flag2)
{
f7 += 0.3125F;
}
if (!flag2)
{
k1 += 5;
}
if (!flag3)
{
f8 -= 0.3125F;
}
if (!flag3)
{
i2 -= 5;
}
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f8, (double) icon.getInterpolatedU((double) l1), (double) icon.getInterpolatedV((double) i2));
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f7, (double) icon.getInterpolatedU((double) l1), (double) icon.getInterpolatedV((double) k1));
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f7, (double) icon.getInterpolatedU((double) j1), (double) icon.getInterpolatedV((double) k1));
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f8, (double) icon.getInterpolatedU((double) j1), (double) icon.getInterpolatedV((double) i2));
tessellator.setColorOpaque_F(f, f, f);
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f8, (double) icon2.getInterpolatedU((double) l1), (double) icon2.getInterpolatedV((double) i2));
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f7, (double) icon2.getInterpolatedU((double) l1), (double) icon2.getInterpolatedV((double) k1));
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f7, (double) icon2.getInterpolatedU((double) j1), (double) icon2.getInterpolatedV((double) k1));
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f8, (double) icon2.getInterpolatedU((double) j1), (double) icon2.getInterpolatedV((double) i2));
}
else if (i1 == 1)
{
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f8, (double) icon1.getMaxU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f7, (double) icon1.getMaxU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f7, (double) icon1.getMinU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f8, (double) icon1.getMinU(), (double) icon1.getMaxV());
tessellator.setColorOpaque_F(f, f, f);
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f8, (double) icon3.getMaxU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f7, (double) icon3.getMaxU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f7, (double) icon3.getMinU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f8, (double) icon3.getMinU(), (double) icon3.getMaxV());
}
else
{
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f8, (double) icon1.getMaxU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f7, (double) icon1.getMinU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f7, (double) icon1.getMinU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f8, (double) icon1.getMaxU(), (double) icon1.getMinV());
tessellator.setColorOpaque_F(f, f, f);
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f8, (double) icon3.getMaxU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) f6, (double) par3 + 0.015625D, (double) f7, (double) icon3.getMinU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f7, (double) icon3.getMinU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) f5, (double) par3 + 0.015625D, (double) f8, (double) icon3.getMaxU(), (double) icon3.getMinV());
}
if (!world.isBlockNormalCube(par2, par3 + 1, par4))
{
if (world.isBlockNormalCube(par2 - 1, par3, par4) && world.getBlockId(par2 - 1, par3 + 1, par4) == Block.redstoneWire.blockID)
{
tessellator.setColorOpaque_F(f * f2, f * f3, f * f4);
tessellator.addVertexWithUV((double) par2 + 0.015625D, (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 1), (double) icon1.getMaxU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) par2 + 0.015625D, (double) (par3 + 0), (double) (par4 + 1), (double) icon1.getMinU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) par2 + 0.015625D, (double) (par3 + 0), (double) (par4 + 0), (double) icon1.getMinU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) par2 + 0.015625D, (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 0), (double) icon1.getMaxU(), (double) icon1.getMaxV());
tessellator.setColorOpaque_F(f, f, f);
tessellator.addVertexWithUV((double) par2 + 0.015625D, (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 1), (double) icon3.getMaxU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) par2 + 0.015625D, (double) (par3 + 0), (double) (par4 + 1), (double) icon3.getMinU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) par2 + 0.015625D, (double) (par3 + 0), (double) (par4 + 0), (double) icon3.getMinU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) par2 + 0.015625D, (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 0), (double) icon3.getMaxU(), (double) icon3.getMaxV());
}
if (world.isBlockNormalCube(par2 + 1, par3, par4) && world.getBlockId(par2 + 1, par3 + 1, par4) == Block.redstoneWire.blockID)
{
tessellator.setColorOpaque_F(f * f2, f * f3, f * f4);
tessellator.addVertexWithUV((double) (par2 + 1) - 0.015625D, (double) (par3 + 0), (double) (par4 + 1), (double) icon1.getMinU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 1) - 0.015625D, (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 1), (double) icon1.getMaxU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 1) - 0.015625D, (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 0), (double) icon1.getMaxU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) (par2 + 1) - 0.015625D, (double) (par3 + 0), (double) (par4 + 0), (double) icon1.getMinU(), (double) icon1.getMinV());
tessellator.setColorOpaque_F(f, f, f);
tessellator.addVertexWithUV((double) (par2 + 1) - 0.015625D, (double) (par3 + 0), (double) (par4 + 1), (double) icon3.getMinU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 1) - 0.015625D, (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 1), (double) icon3.getMaxU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 1) - 0.015625D, (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 0), (double) icon3.getMaxU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) (par2 + 1) - 0.015625D, (double) (par3 + 0), (double) (par4 + 0), (double) icon3.getMinU(), (double) icon3.getMinV());
}
if (world.isBlockNormalCube(par2, par3, par4 - 1) && world.getBlockId(par2, par3 + 1, par4 - 1) == Block.redstoneWire.blockID)
{
tessellator.setColorOpaque_F(f * f2, f * f3, f * f4);
tessellator.addVertexWithUV((double) (par2 + 1), (double) (par3 + 0), (double) par4 + 0.015625D, (double) icon1.getMinU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 1), (double) ((float) (par3 + 1) + 0.021875F), (double) par4 + 0.015625D, (double) icon1.getMaxU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 0), (double) ((float) (par3 + 1) + 0.021875F), (double) par4 + 0.015625D, (double) icon1.getMaxU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) par4 + 0.015625D, (double) icon1.getMinU(), (double) icon1.getMinV());
tessellator.setColorOpaque_F(f, f, f);
tessellator.addVertexWithUV((double) (par2 + 1), (double) (par3 + 0), (double) par4 + 0.015625D, (double) icon3.getMinU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 1), (double) ((float) (par3 + 1) + 0.021875F), (double) par4 + 0.015625D, (double) icon3.getMaxU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 0), (double) ((float) (par3 + 1) + 0.021875F), (double) par4 + 0.015625D, (double) icon3.getMaxU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) par4 + 0.015625D, (double) icon3.getMinU(), (double) icon3.getMinV());
}
if (world.isBlockNormalCube(par2, par3, par4 + 1) && world.getBlockId(par2, par3 + 1, par4 + 1) == Block.redstoneWire.blockID)
{
tessellator.setColorOpaque_F(f * f2, f * f3, f * f4);
tessellator.addVertexWithUV((double) (par2 + 1), (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 1) - 0.015625D, (double) icon1.getMaxU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) (par2 + 1), (double) (par3 + 0), (double) (par4 + 1) - 0.015625D, (double) icon1.getMinU(), (double) icon1.getMinV());
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) (par4 + 1) - 0.015625D, (double) icon1.getMinU(), (double) icon1.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 0), (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 1) - 0.015625D, (double) icon1.getMaxU(), (double) icon1.getMaxV());
tessellator.setColorOpaque_F(f, f, f);
tessellator.addVertexWithUV((double) (par2 + 1), (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 1) - 0.015625D, (double) icon3.getMaxU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) (par2 + 1), (double) (par3 + 0), (double) (par4 + 1) - 0.015625D, (double) icon3.getMinU(), (double) icon3.getMinV());
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) (par4 + 1) - 0.015625D, (double) icon3.getMinU(), (double) icon3.getMaxV());
tessellator.addVertexWithUV((double) (par2 + 0), (double) ((float) (par3 + 1) + 0.021875F), (double) (par4 + 1) - 0.015625D, (double) icon3.getMaxU(), (double) icon3.getMaxV());
}
}
return true;
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+70
View File
@@ -0,0 +1,70 @@
package tconstruct.client.block;
import net.minecraft.block.Block;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class BreakingFX extends EntityFX
{
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item)
{
this(par1World, par2, par4, par6, par8Item, 0);
}
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item, int par9)
{
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
this.func_110125_a(par8Item.getIconFromDamage(par9));
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
this.particleGravity = Block.blockSnow.blockParticleGravity;
this.particleScale /= 2.0F;
}
public BreakingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Item par14Item, int par15)
{
this(par1World, par2, par4, par6, par14Item, par15);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += par8;
this.motionY += par10;
this.motionZ += par12;
}
public int getFXLayer()
{
return 2;
}
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float f6 = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
float f7 = f6 + 0.015609375F;
float f8 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
float f9 = f8 + 0.015609375F;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
f7 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
f8 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
f9 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
}
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
float f14 = 1.0F;
par1Tessellator.setColorOpaque_F(f14 * this.particleRed, f14 * this.particleGreen, f14 * this.particleBlue);
par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f6, (double)f9);
par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f6, (double)f8);
par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f7, (double)f8);
par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f7, (double)f9);
}
}
@@ -0,0 +1,69 @@
package tconstruct.client.block;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.CastingBasinLogic;
import tconstruct.entity.FancyEntityItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/* Special renderer, only used for drawing tools */
@SideOnly(Side.CLIENT)
public class CastingBasinSpecialRender extends TileEntitySpecialRenderer
{
@Override
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
{
this.render((CastingBasinLogic) logic, var2, var4, var6, var8);
}
public void render (CastingBasinLogic logic, double posX, double posY, double posZ, float var8)
{
GL11.glPushMatrix();
float var10 = (float) (posX - 0.5F);
float var11 = (float) (posY - 0.5F);
float var12 = (float) (posZ - 0.5F);
GL11.glTranslatef(var10, var11, var12);
ItemStack stack = logic.getStackInSlot(0);
if (stack != null)
renderItem(logic, stack);
stack = logic.getStackInSlot(1);
if (stack != null)
renderItem(logic, stack);
GL11.glPopMatrix();
}
void renderItem (CastingBasinLogic logic, ItemStack stack)
{
FancyEntityItem entityitem = new FancyEntityItem(logic.worldObj, 0.0D, 0.0D, 0.0D, stack);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glPushMatrix();
GL11.glTranslatef(1F, 0.675F, 1.0F);
//GL11.glRotatef(90F, 1, 0F, 0F);
GL11.glScalef(1.75F, 1.75F, 1.75F);
if (stack.getItem() instanceof ItemBlock)
{
GL11.glScalef(1.6F, 1.6F, 1.6F);
GL11.glTranslatef(0F, 0.045F, 0.0f);
}
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
}
@@ -0,0 +1,75 @@
package tconstruct.client.block;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.CastingTableLogic;
import tconstruct.entity.FancyEntityItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/* Special renderer, only used for drawing tools */
@SideOnly(Side.CLIENT)
public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer
{
@Override
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
{
//System.out.println("Render!!!");
this.render((CastingTableLogic) logic, var2, var4, var6, var8);
}
public void render (CastingTableLogic logic, double posX, double posY, double posZ, float var8)
{
GL11.glPushMatrix();
float var10 = (float) (posX - 0.5F);
float var11 = (float) (posY - 0.5F);
float var12 = (float) (posZ - 0.5F);
GL11.glTranslatef(var10, var11, var12);
this.func_82402_b(logic);
GL11.glPopMatrix();
}
private void func_82402_b (CastingTableLogic logic)
{
ItemStack stack = logic.getStackInSlot(0);
if (stack != null)
renderItem(logic, stack);
stack = logic.getStackInSlot(1);
if (stack != null)
renderItem(logic, stack);
}
void renderItem (CastingTableLogic logic, ItemStack stack)
{
FancyEntityItem entityitem = new FancyEntityItem(logic.worldObj, 0.0D, 0.0D, 0.0D, stack);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glPushMatrix();
GL11.glTranslatef(1F, 1.48F, 0.55F);
GL11.glRotatef(90F, 1, 0F, 0F);
GL11.glScalef(2F, 2F, 2F);
if (stack.getItem() instanceof ItemBlock)
{
GL11.glRotatef(90F, -1, 0F, 0F);
GL11.glTranslatef(0F, -0.1F, 0.2275F);
}
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
}
@@ -0,0 +1,126 @@
package tconstruct.client.block;
import tconstruct.client.TProxyClient;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class CrystalBlockRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.125F, 0.625F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.3125F, 0.125F, 0.3125F, 0.6875F, 0.25F, 0.6875F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.75F, 0.75F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.3125F, 0.75F, 0.3125F, 0.6875F, 0.875F, 0.6875F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.375F, 0.875F, 0.375F, 0.625F, 1.0F, 0.625F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
int metadata = world.getBlockMetadata(x, y, z) % 5;
if (metadata != 3)
{
renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 0.25F, 0.0625F, 0.375F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.5F, 0.0F, 0.75F, 0.625F, 0.125F, 0.8125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.5F, 0.0F, 0.8125F, 0.5625F, 0.0625F, 0.875F);
renderer.renderStandardBlock(block, x, y, z);
}
if (metadata == 0)
{
renderer.setRenderBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.125F, 0.625F);
renderer.renderStandardBlock(block, x, y, z);
}
else if (metadata == 1)
{
renderer.setRenderBounds(0.3125F, 0.0F, 0.3125F, 0.6875F, 0.25, 0.6875F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375F, 0.25, 0.375F, 0.625F, 0.375, 0.625F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.1875, 0.0F, 0.5F, 0.3125F, 0.1875, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4325F, 0.0F, 0.1875, 0.625, 0.125, 0.3125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625F, 0.0F, 0.5F, 0.8125f, 0.125, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
}
else if (metadata == 2)
{
renderer.setRenderBounds(0.3125F, 0.0F, 0.3125F, 0.6875F, 0.5F, 0.6875F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375F, 0.5F, 0.375F, 0.625F, 0.625F, 0.625F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125F, 0.0F, 0.5F, 0.3125F, 0.25F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4325F, 0.0F, 0.125F, 0.6875F, 0.375F, 0.3125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625F, 0.0F, 0.5F, 0.8125f, 0.375F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
}
else if (metadata == 3)
{
renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.75F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.3125F, 0.75F, 0.3125F, 0.6875F, 0.875F, 0.6875F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375F, 0.875F, 0.375F, 0.625F, 0.9325F, 0.625F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125F, 0.0F, 0.5F, 0.375F, 0.375, 0.875F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4325F, 0.0F, 0.0625, 0.625, 0.5, 0.3125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625F, 0.0F, 0.5F, 0.875F, 0.625, 0.875F);
renderer.renderStandardBlock(block, x, y, z);
}
else if (metadata == 4)
{
/*renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.75F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.3125F, 0.75F, 0.3125F, 0.6875F, 0.875F, 0.6875F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375F, 0.875F, 0.375F, 0.625F, 0.9325F, 0.625F);
renderer.renderStandardBlock(block, x, y, z);*/
renderer.setRenderBounds(0.125F, 0.0F, 0.5F, 0.375F, 0.125F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4325F, 0.0F, 0.0625, 0.625, 0.25F, 0.3125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625F, 0.0F, 0.5F, 0.75F, 0.1875F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
}
}
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -0,0 +1,107 @@
package tconstruct.client.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import tconstruct.client.TProxyClient;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class DryingRackRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0)
{
renderer.setRenderBounds(0.0F, 0.0, 0.375F, 1.0F, 0.25F, 0.625F);
}
if (metadata == 1)
{
renderer.setRenderBounds(0.375F, 0.0, 0.0f, 0.625F, 0.25F, 1F);
}
if (metadata == 2)
{
renderer.setRenderBounds(0.0F, 0.75F, 0.75F, 1F, 1.0F, 1F);
}
if (metadata == 3)
{
renderer.setRenderBounds(0.0F, 0.75F, 0F, 1F, 1.0F, 0.25F);
}
if (metadata == 4)
{
renderer.setRenderBounds(0.75F, 0.75F, 0.0f, 1F, 1.0F, 1F);
}
if (metadata == 5)
{
renderer.setRenderBounds(0F, 0.75F, 0.0f, 0.25F, 1.0F, 1F);
}
renderer.renderStandardBlock(block, x, y, z);
}
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}
@@ -0,0 +1,89 @@
package tconstruct.client.block;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.DryingRackLogic;
import tconstruct.entity.FancyEntityItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/* Special renderer, only used for drawing tools */
@SideOnly(Side.CLIENT)
public class DryingRackSpecialRender extends TileEntitySpecialRenderer
{
@Override
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
{
//System.out.println("Render!!!");
this.render((DryingRackLogic) logic, var2, var4, var6, var8);
}
public void render (DryingRackLogic logic, double posX, double posY, double posZ, float var8)
{
GL11.glPushMatrix();
float var10 = (float) (posX - 0.5F);
float var11 = (float) (posY - 0.5F);
float var12 = (float) (posZ - 0.5F);
GL11.glTranslatef(var10, var11, var12);
this.func_82402_b(logic);
GL11.glPopMatrix();
}
private void func_82402_b (DryingRackLogic logic)
{
ItemStack stack = logic.getStackInSlot(0);
if (stack != null)
renderItem(logic, stack);
}
void renderItem (DryingRackLogic logic, ItemStack stack)
{
FancyEntityItem entityitem = new FancyEntityItem(logic.worldObj, 0.0D, 0.0D, 0.0D, stack);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glPushMatrix();
int meta = logic.worldObj.getBlockMetadata(logic.xCoord, logic.yCoord, logic.zCoord);
if (meta <= 1)
GL11.glTranslatef(1F, -0.375F, 0.905F);
else
{
GL11.glTranslatef(1F, 0.375F, 0.905F);
if (meta / 2 == 2)
{
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glTranslatef(-0.0625F, 0F, 0F);
}
if (meta == 2)
GL11.glTranslatef(0F, 0F, 0.375F);
if (meta == 3)
GL11.glTranslatef(0F, 0F, -0.375F);
if (meta == 4)
GL11.glTranslatef(0F, 0F, 0.2875F);
if (meta == 5)
GL11.glTranslatef(0F, 0F, -0.5F);
}
GL11.glScalef(2F, 2F, 2F);
if (stack.getItem() instanceof ItemBlock)
{
//GL11.glRotatef(90F, -1, 0F, 0F);
GL11.glTranslatef(0F, 0.2125F, 0.0375F);
}
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
}
+48
View File
@@ -0,0 +1,48 @@
package tconstruct.client.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class FrypanRender implements ISimpleBlockRenderingHandler
{
public static int frypanModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
//Inventory should be an item. This is not here!
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.125F, 0.0F, 0.125F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125F, 0.125F, 0.875F, 0.875F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.875F, 0.125F, 0.0F, 1.0F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.25F, 0.125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(1F, 0.0F, 0.4375F, 2F, 0.125F, 0.5625F);
renderer.renderStandardBlock(block, x, y, z);
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return frypanModelID;
}
}
@@ -0,0 +1,60 @@
package tconstruct.client.block;
import tconstruct.client.TProxyClient;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class GolemCoreRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
renderer.setRenderBounds(0.0F, 0F, 0.0F, 1.0F, 0.1875F, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.8125F, 0.0F, 1.0F, 1.0F, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.1875F, 0.0F, 0.1875F, 0.8125F, 0.1875F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.8175, 0.1875F, 0.0F, 1f, 0.8125F, 0.1875F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.1875F, 0.8175, 0.1875F, 0.8125F, 1f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.8175F, 0.1875F, 0.8175, 1f, 0.8125F, 1f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
renderer.setRenderBounds(0.0F, 0F, 0.0F, 1.0F, 0.1875F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.8125F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.1875F, 0.0F, 0.1875F, 0.8125F, 0.1875F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.8175, 0.1875F, 0.0F, 1f, 0.8125F, 0.1875F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.1875F, 0.8175, 0.1875F, 0.8125F, 1f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.8175F, 0.1875F, 0.8175, 1f, 0.8125F, 1f);
renderer.renderStandardBlock(block, x, y, z);
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -0,0 +1,65 @@
package tconstruct.client.block;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.GolemCoreLogic;
import tconstruct.entity.FancyEntityItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/* Special renderer, only used for drawing tools */
@SideOnly(Side.CLIENT)
public class GolemCoreSpecialRender extends TileEntitySpecialRenderer
{
@Override
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
{
this.render((GolemCoreLogic) logic, var2, var4, var6, var8);
}
public void render (GolemCoreLogic logic, double posX, double posY, double posZ, float var8)
{
GL11.glPushMatrix();
float var10 = (float) (posX - 0.5F);
float var11 = (float) (posY - 0.5F);
float var12 = (float) (posZ - 0.5F);
GL11.glTranslatef(var10, var11, var12);
ItemStack stack = logic.getStackInSlot(0);
if (stack != null)
renderItem(logic, stack);
GL11.glPopMatrix();
}
void renderItem (GolemCoreLogic logic, ItemStack stack)
{
FancyEntityItem entityitem = new FancyEntityItem(logic.worldObj, 0.0D, 0.0D, 0.0D, stack);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glPushMatrix();
GL11.glTranslatef(1F, 0.675F, 1.0F);
//GL11.glRotatef(90F, 1, 0F, 0F);
GL11.glScalef(1.4F, 1.4F, 1.4F);
if (stack.getItem() instanceof ItemBlock)
{
GL11.glScalef(1.6F, 1.6F, 1.6F);
GL11.glTranslatef(0F, 0.045F, 0.0f);
}
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
}
+102
View File
@@ -0,0 +1,102 @@
package tconstruct.client.block;
import tconstruct.client.TProxyClient;
import tconstruct.library.util.IFacingLogic;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class MachineRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0)
{
renderer.renderStandardBlock(block, x, y, z);
}
else
{
renderRotatedBlock(block, x, y, z, world, renderer);
}
}
return true;
}
public boolean renderRotatedBlock (Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer)
{
IFacingLogic logic = (IFacingLogic) world.getBlockTileEntity(x, y, z);
byte direction = logic.getRenderDirection();
if (direction == 0)
{
renderer.uvRotateEast = 3;
renderer.uvRotateWest = 3;
renderer.uvRotateNorth = 3;
renderer.uvRotateSouth = 3;
}
if (direction == 2)
{
renderer.uvRotateNorth = 2;
renderer.uvRotateSouth = 1;
}
if (direction == 3)
{
renderer.uvRotateNorth = 1;
renderer.uvRotateSouth = 2;
renderer.uvRotateTop = 3;
renderer.uvRotateBottom = 3;
}
if (direction == 4)
{
renderer.uvRotateEast = 1;
renderer.uvRotateWest = 2;
renderer.uvRotateTop = 2;
renderer.uvRotateBottom = 1;
}
if (direction == 5)
{
renderer.uvRotateEast = 2;
renderer.uvRotateWest = 1;
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 2;
}
boolean flag = renderer.renderStandardBlock(block, x, y, z);
renderer.uvRotateSouth = 0;
renderer.uvRotateEast = 0;
renderer.uvRotateWest = 0;
renderer.uvRotateNorth = 0;
renderer.uvRotateTop = 0;
renderer.uvRotateBottom = 0;
return flag;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -0,0 +1,61 @@
package tconstruct.client.block;
import tconstruct.client.TProxyClient;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class OreberryRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (modelId == model)
{
int md = world.getBlockMetadata(x, y, z);
if (md < 4)
{
renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
}
else if (md < 8)
{
renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
renderer.renderStandardBlock(block, x, y, z);
}
else
{
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
}
return true;
}
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -0,0 +1,481 @@
package tconstruct.client.block;
import static net.minecraftforge.common.ForgeDirection.EAST;
import static net.minecraftforge.common.ForgeDirection.NORTH;
import static net.minecraftforge.common.ForgeDirection.SOUTH;
import static net.minecraftforge.common.ForgeDirection.WEST;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import tconstruct.blocks.GlassPaneConnected;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class PaneConnectedRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
GlassPaneConnected paneConnected = (GlassPaneConnected) block;
int l = world.getHeight();
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(paneConnected.getMixedBrightnessForBlock(world, x, y, z));
float f = 1.0F;
int i1 = paneConnected.colorMultiplier(world, x, y, z);
float f1 = (float) (i1 >> 16 & 255) / 255.0F;
float f2 = (float) (i1 >> 8 & 255) / 255.0F;
float f3 = (float) (i1 & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable)
{
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
f1 = f4;
f2 = f5;
f3 = f6;
}
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
Icon icon;
Icon icon1;
if (renderer.hasOverrideBlockTexture())
{
icon = renderer.overrideBlockTexture;
icon1 = renderer.overrideBlockTexture;
}
else
{
int j1 = world.getBlockMetadata(x, y, z);
icon = renderer.getBlockIconFromSideAndMetadata(paneConnected, 0, j1);
icon1 = paneConnected.getSideTextureIndex();
}
double d0 = (double) icon.getMinU();
double d1 = (double) icon.getInterpolatedU(8.0D);
double d2 = (double) icon.getMaxU();
double d3 = (double) icon.getMinV();
double d4 = (double) icon.getMaxV();
double d5 = (double) icon1.getInterpolatedU(7.0D);
double d6 = (double) icon1.getInterpolatedU(9.0D);
double d7 = (double) icon1.getMinV();
double d8 = (double) icon1.getInterpolatedV(8.0D);
double d9 = (double) icon1.getMaxV();
double d10 = (double) x;
double d11 = (double) x + 0.5D;
double d12 = (double) (x + 1);
double d13 = (double) z;
double d14 = (double) z + 0.5D;
double d15 = (double) (z + 1);
double d16 = (double) x + 0.5D - 0.0625D;
double d17 = (double) x + 0.5D + 0.0625D;
double d18 = (double) z + 0.5D - 0.0625D;
double d19 = (double) z + 0.5D + 0.0625D;
boolean flag = paneConnected.canPaneConnectTo(world, x, y, z, NORTH);
boolean flag1 = paneConnected.canPaneConnectTo(world, x, y, z, SOUTH);
boolean flag2 = paneConnected.canPaneConnectTo(world, x, y, z, WEST);
boolean flag3 = paneConnected.canPaneConnectTo(world, x, y, z, EAST);
boolean flag4 = paneConnected.shouldSideBeRendered(world, x, y + 1, z, 1);
boolean flag5 = paneConnected.shouldSideBeRendered(world, x, y - 1, z, 0);
double d20 = 0.01D;
double d21 = 0.005D;
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
{
if (flag2 && !flag3)
{
tessellator.addVertexWithUV(d10, (double) (y + 1), d14, d0, d3);
tessellator.addVertexWithUV(d10, (double) (y + 0), d14, d0, d4);
tessellator.addVertexWithUV(d11, (double) (y + 0), d14, d1, d4);
tessellator.addVertexWithUV(d11, (double) (y + 1), d14, d1, d3);
tessellator.addVertexWithUV(d11, (double) (y + 1), d14, d0, d3);
tessellator.addVertexWithUV(d11, (double) (y + 0), d14, d0, d4);
tessellator.addVertexWithUV(d10, (double) (y + 0), d14, d1, d4);
tessellator.addVertexWithUV(d10, (double) (y + 1), d14, d1, d3);
if (!flag1 && !flag)
{
tessellator.addVertexWithUV(d11, (double) (y + 1), d19, d5, d7);
tessellator.addVertexWithUV(d11, (double) (y + 0), d19, d5, d9);
tessellator.addVertexWithUV(d11, (double) (y + 0), d18, d6, d9);
tessellator.addVertexWithUV(d11, (double) (y + 1), d18, d6, d7);
tessellator.addVertexWithUV(d11, (double) (y + 1), d18, d5, d7);
tessellator.addVertexWithUV(d11, (double) (y + 0), d18, d5, d9);
tessellator.addVertexWithUV(d11, (double) (y + 0), d19, d6, d9);
tessellator.addVertexWithUV(d11, (double) (y + 1), d19, d6, d7);
}
if (flag4 || y < l - 1 && world.isAirBlock(x - 1, y + 1, z))
{
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d18, d5, d8);
}
if (flag5 || y > 1 && world.isAirBlock(x - 1, y - 1, z))
{
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d18, d5, d8);
}
}
else if (!flag2 && flag3)
{
tessellator.addVertexWithUV(d11, (double) (y + 1), d14, d1, d3);
tessellator.addVertexWithUV(d11, (double) (y + 0), d14, d1, d4);
tessellator.addVertexWithUV(d12, (double) (y + 0), d14, d2, d4);
tessellator.addVertexWithUV(d12, (double) (y + 1), d14, d2, d3);
tessellator.addVertexWithUV(d12, (double) (y + 1), d14, d1, d3);
tessellator.addVertexWithUV(d12, (double) (y + 0), d14, d1, d4);
tessellator.addVertexWithUV(d11, (double) (y + 0), d14, d2, d4);
tessellator.addVertexWithUV(d11, (double) (y + 1), d14, d2, d3);
if (!flag1 && !flag)
{
tessellator.addVertexWithUV(d11, (double) (y + 1), d18, d5, d7);
tessellator.addVertexWithUV(d11, (double) (y + 0), d18, d5, d9);
tessellator.addVertexWithUV(d11, (double) (y + 0), d19, d6, d9);
tessellator.addVertexWithUV(d11, (double) (y + 1), d19, d6, d7);
tessellator.addVertexWithUV(d11, (double) (y + 1), d19, d5, d7);
tessellator.addVertexWithUV(d11, (double) (y + 0), d19, d5, d9);
tessellator.addVertexWithUV(d11, (double) (y + 0), d18, d6, d9);
tessellator.addVertexWithUV(d11, (double) (y + 1), d18, d6, d7);
}
if (flag4 || y < l - 1 && world.isAirBlock(x + 1, y + 1, z))
{
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d18, d5, d7);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d18, d5, d7);
}
if (flag5 || y > 1 && world.isAirBlock(x + 1, y - 1, z))
{
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d18, d5, d7);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d18, d5, d7);
}
}
}
else
{
tessellator.addVertexWithUV(d10, (double) (y + 1), d14, d0, d3);
tessellator.addVertexWithUV(d10, (double) (y + 0), d14, d0, d4);
tessellator.addVertexWithUV(d12, (double) (y + 0), d14, d2, d4);
tessellator.addVertexWithUV(d12, (double) (y + 1), d14, d2, d3);
tessellator.addVertexWithUV(d12, (double) (y + 1), d14, d0, d3);
tessellator.addVertexWithUV(d12, (double) (y + 0), d14, d0, d4);
tessellator.addVertexWithUV(d10, (double) (y + 0), d14, d2, d4);
tessellator.addVertexWithUV(d10, (double) (y + 1), d14, d2, d3);
if (flag4)
{
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d18, d5, d7);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d18, d5, d7);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d18, d5, d9);
}
else
{
if (y < l - 1 && world.isAirBlock(x - 1, y + 1, z))
{
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d10, (double) (y + 1) + 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d18, d5, d8);
}
if (y < l - 1 && world.isAirBlock(x + 1, y + 1, z))
{
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d18, d5, d7);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d11, (double) (y + 1) + 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d12, (double) (y + 1) + 0.01D, d18, d5, d7);
}
}
if (flag5)
{
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d18, d5, d7);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d18, d5, d7);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d18, d5, d9);
}
else
{
if (y > 1 && world.isAirBlock(x - 1, y - 1, z))
{
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d19, d6, d9);
tessellator.addVertexWithUV(d10, (double) y - 0.01D, d18, d5, d9);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d18, d5, d8);
}
if (y > 1 && world.isAirBlock(x + 1, y - 1, z))
{
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d18, d5, d7);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d19, d6, d7);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d19, d6, d8);
tessellator.addVertexWithUV(d11, (double) y - 0.01D, d18, d5, d8);
tessellator.addVertexWithUV(d12, (double) y - 0.01D, d18, d5, d7);
}
}
}
if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1))
{
if (flag && !flag1)
{
tessellator.addVertexWithUV(d11, (double) (y + 1), d13, d0, d3);
tessellator.addVertexWithUV(d11, (double) (y + 0), d13, d0, d4);
tessellator.addVertexWithUV(d11, (double) (y + 0), d14, d1, d4);
tessellator.addVertexWithUV(d11, (double) (y + 1), d14, d1, d3);
tessellator.addVertexWithUV(d11, (double) (y + 1), d14, d0, d3);
tessellator.addVertexWithUV(d11, (double) (y + 0), d14, d0, d4);
tessellator.addVertexWithUV(d11, (double) (y + 0), d13, d1, d4);
tessellator.addVertexWithUV(d11, (double) (y + 1), d13, d1, d3);
if (!flag3 && !flag2)
{
tessellator.addVertexWithUV(d16, (double) (y + 1), d14, d5, d7);
tessellator.addVertexWithUV(d16, (double) (y + 0), d14, d5, d9);
tessellator.addVertexWithUV(d17, (double) (y + 0), d14, d6, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1), d14, d6, d7);
tessellator.addVertexWithUV(d17, (double) (y + 1), d14, d5, d7);
tessellator.addVertexWithUV(d17, (double) (y + 0), d14, d5, d9);
tessellator.addVertexWithUV(d16, (double) (y + 0), d14, d6, d9);
tessellator.addVertexWithUV(d16, (double) (y + 1), d14, d6, d7);
}
if (flag4 || y < l - 1 && world.isAirBlock(x, y + 1, z - 1))
{
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d13, d6, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d14, d6, d8);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d14, d5, d8);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d13, d5, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d14, d6, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d13, d6, d8);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d13, d5, d8);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d14, d5, d7);
}
if (flag5 || y > 1 && world.isAirBlock(x, y - 1, z - 1))
{
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d13, d6, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d14, d6, d8);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d14, d5, d8);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d13, d5, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d14, d6, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d13, d6, d8);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d13, d5, d8);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d14, d5, d7);
}
}
else if (!flag && flag1)
{
tessellator.addVertexWithUV(d11, (double) (y + 1), d14, d1, d3);
tessellator.addVertexWithUV(d11, (double) (y + 0), d14, d1, d4);
tessellator.addVertexWithUV(d11, (double) (y + 0), d15, d2, d4);
tessellator.addVertexWithUV(d11, (double) (y + 1), d15, d2, d3);
tessellator.addVertexWithUV(d11, (double) (y + 1), d15, d1, d3);
tessellator.addVertexWithUV(d11, (double) (y + 0), d15, d1, d4);
tessellator.addVertexWithUV(d11, (double) (y + 0), d14, d2, d4);
tessellator.addVertexWithUV(d11, (double) (y + 1), d14, d2, d3);
if (!flag3 && !flag2)
{
tessellator.addVertexWithUV(d17, (double) (y + 1), d14, d5, d7);
tessellator.addVertexWithUV(d17, (double) (y + 0), d14, d5, d9);
tessellator.addVertexWithUV(d16, (double) (y + 0), d14, d6, d9);
tessellator.addVertexWithUV(d16, (double) (y + 1), d14, d6, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1), d14, d5, d7);
tessellator.addVertexWithUV(d16, (double) (y + 0), d14, d5, d9);
tessellator.addVertexWithUV(d17, (double) (y + 0), d14, d6, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1), d14, d6, d7);
}
if (flag4 || y < l - 1 && world.isAirBlock(x, y + 1, z + 1))
{
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d14, d5, d8);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d15, d5, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d15, d6, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d14, d6, d8);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d15, d5, d8);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d14, d5, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d14, d6, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d15, d6, d8);
}
if (flag5 || y > 1 && world.isAirBlock(x, y - 1, z + 1))
{
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d14, d5, d8);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d15, d5, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d15, d6, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d14, d6, d8);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d15, d5, d8);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d14, d5, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d14, d6, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d15, d6, d8);
}
}
}
else
{
tessellator.addVertexWithUV(d11, (double) (y + 1), d15, d0, d3);
tessellator.addVertexWithUV(d11, (double) (y + 0), d15, d0, d4);
tessellator.addVertexWithUV(d11, (double) (y + 0), d13, d2, d4);
tessellator.addVertexWithUV(d11, (double) (y + 1), d13, d2, d3);
tessellator.addVertexWithUV(d11, (double) (y + 1), d13, d0, d3);
tessellator.addVertexWithUV(d11, (double) (y + 0), d13, d0, d4);
tessellator.addVertexWithUV(d11, (double) (y + 0), d15, d2, d4);
tessellator.addVertexWithUV(d11, (double) (y + 1), d15, d2, d3);
if (flag4)
{
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d15, d6, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d13, d6, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d13, d5, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d15, d5, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d13, d6, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d15, d6, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d15, d5, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d13, d5, d9);
}
else
{
if (y < l - 1 && world.isAirBlock(x, y + 1, z - 1))
{
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d13, d6, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d14, d6, d8);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d14, d5, d8);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d13, d5, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d14, d6, d7);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d13, d6, d8);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d13, d5, d8);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d14, d5, d7);
}
if (y < l - 1 && world.isAirBlock(x, y + 1, z + 1))
{
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d14, d5, d8);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d15, d5, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d15, d6, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d14, d6, d8);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d15, d5, d8);
tessellator.addVertexWithUV(d16, (double) (y + 1) + 0.005D, d14, d5, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d14, d6, d9);
tessellator.addVertexWithUV(d17, (double) (y + 1) + 0.005D, d15, d6, d8);
}
}
if (flag5)
{
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d15, d6, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d13, d6, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d13, d5, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d15, d5, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d13, d6, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d15, d6, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d15, d5, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d13, d5, d9);
}
else
{
if (y > 1 && world.isAirBlock(x, y - 1, z - 1))
{
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d13, d6, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d14, d6, d8);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d14, d5, d8);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d13, d5, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d14, d6, d7);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d13, d6, d8);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d13, d5, d8);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d14, d5, d7);
}
if (y > 1 && world.isAirBlock(x, y - 1, z + 1))
{
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d14, d5, d8);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d15, d5, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d15, d6, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d14, d6, d8);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d15, d5, d8);
tessellator.addVertexWithUV(d16, (double) y - 0.005D, d14, d5, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d14, d6, d9);
tessellator.addVertexWithUV(d17, (double) y - 0.005D, d15, d6, d8);
}
}
}
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return false;
}
@Override
public int getRenderId ()
{
return model;
}
}
+394
View File
@@ -0,0 +1,394 @@
package tconstruct.client.block;
import tconstruct.blocks.PaneBase;
import tconstruct.client.TProxyClient;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class PaneRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.0F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
return renderPaneInWorld(renderer, world, x, y, z, (PaneBase) block);
}
else
{
return false;
}
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
public static boolean renderPaneInWorld (RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, PaneBase pane)
{
int l = iblockaccess.getHeight();
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(pane.getMixedBrightnessForBlock(iblockaccess, x, y, z));
float f = 1.0F;
int i1 = pane.colorMultiplier(iblockaccess, x, y, z);
float f1 = (float) (i1 >> 16 & 0xff) / 255F;
float f2 = (float) (i1 >> 8 & 0xff) / 255F;
float f3 = (float) (i1 & 0xff) / 255F;
if (EntityRenderer.anaglyphEnable)
{
float f4 = (f1 * 30F + f2 * 59F + f3 * 11F) / 100F;
float f5 = (f1 * 30F + f2 * 70F) / 100F;
float f6 = (f1 * 30F + f3 * 70F) / 100F;
f1 = f4;
f2 = f5;
f3 = f6;
}
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
boolean flag = false;
boolean flag1 = false;
Icon icon;
Icon icon1;
int meta = iblockaccess.getBlockMetadata(x, y, z);
icon = renderblocks.getBlockIconFromSideAndMetadata(pane, 0, meta);
icon1 = pane.getSideTextureIndex(meta);
meta = icon.getOriginX();
int k1 = icon.getOriginY();
double d = (double) icon.getMinU();
double d1 = (double) icon.getInterpolatedU(8.0D);
double d2 = (double) icon.getMaxU();
double d3 = (double) icon.getMinV();
double d4 = (double) icon.getMaxV();
int l1 = icon1.getOriginX();
int i2 = icon1.getOriginY();
double d5 = (double) icon1.getInterpolatedU(7.0D);
double d6 = (double) icon1.getInterpolatedU(9.0D);
double d7 = (double) icon1.getMinV();
double d8 = (double) icon1.getInterpolatedV(8.0D);
double d9 = (double) icon1.getMaxV();
/*int blockTextureIndex;
int blockSideIndex;
int j1 = iblockaccess.getBlockMetadata(x, y, z);
blockTextureIndex = pane.getBlockTextureFromSideAndMetadata(0, j1);
blockSideIndex = pane.getSideTextureIndex(j1);
int k1 = (blockTextureIndex & 0xf) << 4;
int j2 = blockTextureIndex & 0xf0;
double d = (float) k1 / 256F;
double d1 = ((float) k1 + 7.99F) / 256F;
double d2 = ((float) k1 + 15.99F) / 256F;
double d3 = (float) j2 / 256F;
double d4 = ((float) j2 + 15.99F) / 256F;
int k2 = (blockSideIndex & 0xf) << 4;
int l2 = blockSideIndex & 0xf0;
double d5 = (float) (k2 + 7) / 256F;
double d6 = ((float) k2 + 8.99F) / 256F;
double d7 = (float) l2 / 256F;
double d8 = (float) (l2 + 8) / 256F;
double d9 = ((float) l2 + 15.99F) / 256F;*/
double xBot = x;
double xMid = (double) x + 0.5D;
double xTop = x + 1;
double zBot = z;
double zMid = (double) z + 0.5D;
double zTop = z + 1;
double xMidDown = ((double) x + 0.5D) - 0.0625D;
double xMidUp = (double) x + 0.5D + 0.0625D;
double zMidDown = ((double) z + 0.5D) - 0.0625D;
double zMidUp = (double) z + 0.5D + 0.0625D;
boolean west = pane.canConnectTo(iblockaccess.getBlockId(x, y, z - 1));
boolean east = pane.canConnectTo(iblockaccess.getBlockId(x, y, z + 1));
boolean south = pane.canConnectTo(iblockaccess.getBlockId(x - 1, y, z));
boolean north = pane.canConnectTo(iblockaccess.getBlockId(x + 1, y, z));
boolean renderAbove = pane.shouldSideBeRendered(iblockaccess, x, y + 1, z, 1);
boolean renderBelow = pane.shouldSideBeRendered(iblockaccess, x, y - 1, z, 0);
if ((!south || !north) && (south || north || west || east))
{
if (south && !north)
{
tessellator.addVertexWithUV(xBot, y + 1, zMidDown, d, d3);
tessellator.addVertexWithUV(xBot, y + 0, zMidDown, d, d4);
tessellator.addVertexWithUV(xMid, y + 0, zMidDown, d1, d4);
tessellator.addVertexWithUV(xMid, y + 1, zMidDown, d1, d3);
tessellator.addVertexWithUV(xMid, y + 1, zMidUp, d, d3);
tessellator.addVertexWithUV(xMid, y + 0, zMidUp, d, d4);
tessellator.addVertexWithUV(xBot, y + 0, zMidUp, d1, d4);
tessellator.addVertexWithUV(xBot, y + 1, zMidUp, d1, d3);
if (!east && !west)
{
tessellator.addVertexWithUV(xMid, y + 1, zMidUp, d5, d7);
tessellator.addVertexWithUV(xMid, y + 0, zMidUp, d5, d9);
tessellator.addVertexWithUV(xMid, y + 0, zMidDown, d6, d9);
tessellator.addVertexWithUV(xMid, y + 1, zMidDown, d6, d7);
}
if (renderAbove || y < l - 1 && iblockaccess.isAirBlock(x - 1, y + 1, z))
{
tessellator.addVertexWithUV(xBot, (double) (y + 1) + 0.01D, zMidUp, d6, d8);
tessellator.addVertexWithUV(xMid, (double) (y + 1) + 0.01D, zMidUp, d6, d9);
tessellator.addVertexWithUV(xMid, (double) (y + 1) + 0.01D, zMidDown, d5, d9);
tessellator.addVertexWithUV(xBot, (double) (y + 1) + 0.01D, zMidDown, d5, d8);
}
if (renderBelow || y > 1 && iblockaccess.isAirBlock(x - 1, y - 1, z))
{
tessellator.addVertexWithUV(xBot, (double) y - 0.01D, zMidUp, d6, d8);
tessellator.addVertexWithUV(xMid, (double) y - 0.01D, zMidUp, d6, d9);
tessellator.addVertexWithUV(xMid, (double) y - 0.01D, zMidDown, d5, d9);
tessellator.addVertexWithUV(xBot, (double) y - 0.01D, zMidDown, d5, d8);
}
}
else if (!south && north)
{
tessellator.addVertexWithUV(xMid, y + 1, zMidDown, d1, d3);
tessellator.addVertexWithUV(xMid, y + 0, zMidDown, d1, d4);
tessellator.addVertexWithUV(xTop, y + 0, zMidDown, d2, d4);
tessellator.addVertexWithUV(xTop, y + 1, zMidDown, d2, d3);
tessellator.addVertexWithUV(xTop, y + 1, zMidUp, d1, d3);
tessellator.addVertexWithUV(xTop, y + 0, zMidUp, d1, d4);
tessellator.addVertexWithUV(xMid, y + 0, zMidUp, d2, d4);
tessellator.addVertexWithUV(xMid, y + 1, zMidUp, d2, d3);
if (!east && !west)
{
tessellator.addVertexWithUV(xMid, y + 1, zMidDown, d5, d7);
tessellator.addVertexWithUV(xMid, y + 0, zMidDown, d5, d9);
tessellator.addVertexWithUV(xMid, y + 0, zMidUp, d6, d9);
tessellator.addVertexWithUV(xMid, y + 1, zMidUp, d6, d7);
}
if (renderAbove || y < l - 1 && iblockaccess.isAirBlock(x + 1, y + 1, z))
{
tessellator.addVertexWithUV(xMid, (double) (y + 1) + 0.01D, zMidUp, d6, d7);
tessellator.addVertexWithUV(xTop, (double) (y + 1) + 0.01D, zMidUp, d6, d8);
tessellator.addVertexWithUV(xTop, (double) (y + 1) + 0.01D, zMidDown, d5, d8);
tessellator.addVertexWithUV(xMid, (double) (y + 1) + 0.01D, zMidDown, d5, d7);
}
if (renderBelow || y > 1 && iblockaccess.isAirBlock(x + 1, y - 1, z))
{
tessellator.addVertexWithUV(xMid, (double) y - 0.01D, zMidUp, d6, d7);
tessellator.addVertexWithUV(xTop, (double) y - 0.01D, zMidUp, d6, d8);
tessellator.addVertexWithUV(xTop, (double) y - 0.01D, zMidDown, d5, d8);
tessellator.addVertexWithUV(xMid, (double) y - 0.01D, zMidDown, d5, d7);
}
}
}
else
{
tessellator.addVertexWithUV(xBot, y + 1, zMidDown, d, d3);
tessellator.addVertexWithUV(xBot, y + 0, zMidDown, d, d4);
tessellator.addVertexWithUV(xTop, y + 0, zMidDown, d2, d4);
tessellator.addVertexWithUV(xTop, y + 1, zMidDown, d2, d3);
tessellator.addVertexWithUV(xTop, y + 1, zMidUp, d, d3);
tessellator.addVertexWithUV(xTop, y + 0, zMidUp, d, d4);
tessellator.addVertexWithUV(xBot, y + 0, zMidUp, d2, d4);
tessellator.addVertexWithUV(xBot, y + 1, zMidUp, d2, d3);
if (renderAbove)
{
tessellator.addVertexWithUV(xBot, (double) (y + 1) + 0.01D, zMidUp, d6, d9);
tessellator.addVertexWithUV(xTop, (double) (y + 1) + 0.01D, zMidUp, d6, d7);
tessellator.addVertexWithUV(xTop, (double) (y + 1) + 0.01D, zMidDown, d5, d7);
tessellator.addVertexWithUV(xBot, (double) (y + 1) + 0.01D, zMidDown, d5, d9);
}
else
{
if (y < l - 1 && iblockaccess.isAirBlock(x - 1, y + 1, z))
{
tessellator.addVertexWithUV(xBot, (double) (y + 1) + 0.01D, zMidUp, d6, d8);
tessellator.addVertexWithUV(xMid, (double) (y + 1) + 0.01D, zMidUp, d6, d9);
tessellator.addVertexWithUV(xMid, (double) (y + 1) + 0.01D, zMidDown, d5, d9);
tessellator.addVertexWithUV(xBot, (double) (y + 1) + 0.01D, zMidDown, d5, d8);
}
if (y < l - 1 && iblockaccess.isAirBlock(x + 1, y + 1, z))
{
tessellator.addVertexWithUV(xMid, (double) (y + 1) + 0.01D, zMidUp, d6, d7);
tessellator.addVertexWithUV(xTop, (double) (y + 1) + 0.01D, zMidUp, d6, d8);
tessellator.addVertexWithUV(xTop, (double) (y + 1) + 0.01D, zMidDown, d5, d8);
tessellator.addVertexWithUV(xMid, (double) (y + 1) + 0.01D, zMidDown, d5, d7);
}
}
if (renderBelow)
{
tessellator.addVertexWithUV(xBot, (double) y - 0.01D, zMidUp, d6, d9);
tessellator.addVertexWithUV(xTop, (double) y - 0.01D, zMidUp, d6, d7);
tessellator.addVertexWithUV(xTop, (double) y - 0.01D, zMidDown, d5, d7);
tessellator.addVertexWithUV(xBot, (double) y - 0.01D, zMidDown, d5, d9);
}
else
{
if (y > 1 && iblockaccess.isAirBlock(x - 1, y - 1, z))
{
tessellator.addVertexWithUV(xBot, (double) y - 0.01D, zMidUp, d6, d8);
tessellator.addVertexWithUV(xMid, (double) y - 0.01D, zMidUp, d6, d9);
tessellator.addVertexWithUV(xMid, (double) y - 0.01D, zMidDown, d5, d9);
tessellator.addVertexWithUV(xBot, (double) y - 0.01D, zMidDown, d5, d8);
}
if (y > 1 && iblockaccess.isAirBlock(x + 1, y - 1, z))
{
tessellator.addVertexWithUV(xMid, (double) y - 0.01D, zMidUp, d6, d7);
tessellator.addVertexWithUV(xTop, (double) y - 0.01D, zMidUp, d6, d8);
tessellator.addVertexWithUV(xTop, (double) y - 0.01D, zMidDown, d5, d8);
tessellator.addVertexWithUV(xMid, (double) y - 0.01D, zMidDown, d5, d7);
}
}
}
if ((!west || !east) && (south || north || west || east))
{
if (west && !east)
{
tessellator.addVertexWithUV(xMidDown, y + 1, zBot, d, d3);
tessellator.addVertexWithUV(xMidDown, y + 0, zBot, d, d4);
tessellator.addVertexWithUV(xMidDown, y + 0, zMid, d1, d4);
tessellator.addVertexWithUV(xMidDown, y + 1, zMid, d1, d3);
tessellator.addVertexWithUV(xMidUp, y + 1, zMid, d, d3);
tessellator.addVertexWithUV(xMidUp, y + 0, zMid, d, d4);
tessellator.addVertexWithUV(xMidUp, y + 0, zBot, d1, d4);
tessellator.addVertexWithUV(xMidUp, y + 1, zBot, d1, d3);
if (!north && !south)
{
tessellator.addVertexWithUV(xMidDown, y + 1, zMid, d5, d7);
tessellator.addVertexWithUV(xMidDown, y + 0, zMid, d5, d9);
tessellator.addVertexWithUV(xMidUp, y + 0, zMid, d6, d9);
tessellator.addVertexWithUV(xMidUp, y + 1, zMid, d6, d7);
}
if (renderAbove || y < l - 1 && iblockaccess.isAirBlock(x, y + 1, z - 1))
{
tessellator.addVertexWithUV(xMidDown, y + 1, zBot, d6, d7);
tessellator.addVertexWithUV(xMidDown, y + 1, zMid, d6, d8);
tessellator.addVertexWithUV(xMidUp, y + 1, zMid, d5, d8);
tessellator.addVertexWithUV(xMidUp, y + 1, zBot, d5, d7);
}
if (renderBelow || y > 1 && iblockaccess.isAirBlock(x, y - 1, z - 1))
{
tessellator.addVertexWithUV(xMidDown, y, zBot, d6, d7);
tessellator.addVertexWithUV(xMidDown, y, zMid, d6, d8);
tessellator.addVertexWithUV(xMidUp, y, zMid, d5, d8);
tessellator.addVertexWithUV(xMidUp, y, zBot, d5, d7);
}
}
else if (!west && east)
{
tessellator.addVertexWithUV(xMidDown, y + 1, zMid, d1, d3);
tessellator.addVertexWithUV(xMidDown, y + 0, zMid, d1, d4);
tessellator.addVertexWithUV(xMidDown, y + 0, zTop, d2, d4);
tessellator.addVertexWithUV(xMidDown, y + 1, zTop, d2, d3);
tessellator.addVertexWithUV(xMidUp, y + 1, zTop, d1, d3);
tessellator.addVertexWithUV(xMidUp, y + 0, zTop, d1, d4);
tessellator.addVertexWithUV(xMidUp, y + 0, zMid, d2, d4);
tessellator.addVertexWithUV(xMidUp, y + 1, zMid, d2, d3);
if (!north && !south)
{
tessellator.addVertexWithUV(xMidUp, y + 1, zMid, d5, d7);
tessellator.addVertexWithUV(xMidUp, y + 0, zMid, d5, d9);
tessellator.addVertexWithUV(xMidDown, y + 0, zMid, d6, d9);
tessellator.addVertexWithUV(xMidDown, y + 1, zMid, d6, d7);
}
if (renderAbove || y < l - 1 && iblockaccess.isAirBlock(x, y + 1, z + 1))
{
tessellator.addVertexWithUV(xMidDown, y + 1, zMid, d5, d8);
tessellator.addVertexWithUV(xMidDown, y + 1, zTop, d5, d9);
tessellator.addVertexWithUV(xMidUp, y + 1, zTop, d6, d9);
tessellator.addVertexWithUV(xMidUp, y + 1, zMid, d6, d8);
}
if (renderBelow || y > 1 && iblockaccess.isAirBlock(x, y - 1, z + 1))
{
tessellator.addVertexWithUV(xMidDown, y, zMid, d5, d8);
tessellator.addVertexWithUV(xMidDown, y, zTop, d5, d9);
tessellator.addVertexWithUV(xMidUp, y, zTop, d6, d9);
tessellator.addVertexWithUV(xMidUp, y, zMid, d6, d8);
}
}
}
else
{
tessellator.addVertexWithUV(xMidDown, y + 1, zTop, d, d3);
tessellator.addVertexWithUV(xMidDown, y + 0, zTop, d, d4);
tessellator.addVertexWithUV(xMidDown, y + 0, zBot, d2, d4);
tessellator.addVertexWithUV(xMidDown, y + 1, zBot, d2, d3);
tessellator.addVertexWithUV(xMidUp, y + 1, zBot, d, d3);
tessellator.addVertexWithUV(xMidUp, y + 0, zBot, d, d4);
tessellator.addVertexWithUV(xMidUp, y + 0, zTop, d2, d4);
tessellator.addVertexWithUV(xMidUp, y + 1, zTop, d2, d3);
if (renderAbove)
{
tessellator.addVertexWithUV(xMidUp, y + 1, zTop, d6, d9);
tessellator.addVertexWithUV(xMidUp, y + 1, zBot, d6, d7);
tessellator.addVertexWithUV(xMidDown, y + 1, zBot, d5, d7);
tessellator.addVertexWithUV(xMidDown, y + 1, zTop, d5, d9);
}
else
{
if (y < l - 1 && iblockaccess.isAirBlock(x, y + 1, z - 1))
{
tessellator.addVertexWithUV(xMidDown, y + 1, zBot, d6, d7);
tessellator.addVertexWithUV(xMidDown, y + 1, zMid, d6, d8);
tessellator.addVertexWithUV(xMidUp, y + 1, zMid, d5, d8);
tessellator.addVertexWithUV(xMidUp, y + 1, zBot, d5, d7);
}
if (y < l - 1 && iblockaccess.isAirBlock(x, y + 1, z + 1))
{
tessellator.addVertexWithUV(xMidDown, y + 1, zMid, d5, d8);
tessellator.addVertexWithUV(xMidDown, y + 1, zTop, d5, d9);
tessellator.addVertexWithUV(xMidUp, y + 1, zTop, d6, d9);
tessellator.addVertexWithUV(xMidUp, y + 1, zMid, d6, d8);
}
}
if (renderBelow)
{
tessellator.addVertexWithUV(xMidUp, y, zTop, d6, d9);
tessellator.addVertexWithUV(xMidUp, y, zBot, d6, d7);
tessellator.addVertexWithUV(xMidDown, y, zBot, d5, d7);
tessellator.addVertexWithUV(xMidDown, y, zTop, d5, d9);
tessellator.addVertexWithUV(xMidUp, y, zBot, d6, d9);
tessellator.addVertexWithUV(xMidUp, y, zTop, d6, d7);
tessellator.addVertexWithUV(xMidDown, y, zTop, d5, d7);
tessellator.addVertexWithUV(xMidDown, y, zBot, d5, d9);
}
else
{
if (y > 1 && iblockaccess.isAirBlock(x, y - 1, z - 1))
{
tessellator.addVertexWithUV(xMidDown, y, zBot, d6, d7);
tessellator.addVertexWithUV(xMidDown, y, zMid, d6, d8);
tessellator.addVertexWithUV(xMidUp, y, zMid, d5, d8);
tessellator.addVertexWithUV(xMidUp, y, zBot, d5, d7);
}
if (y > 1 && iblockaccess.isAirBlock(x, y - 1, z + 1))
{
tessellator.addVertexWithUV(xMidDown, y, zMid, d5, d8);
tessellator.addVertexWithUV(xMidDown, y, zTop, d5, d9);
tessellator.addVertexWithUV(xMidUp, y, zTop, d6, d9);
tessellator.addVertexWithUV(xMidUp, y, zMid, d6, d8);
}
}
}
return true;
}
}
+409
View File
@@ -0,0 +1,409 @@
package tconstruct.client.block;
import tconstruct.blocks.logic.CastingBasinLogic;
import tconstruct.blocks.logic.CastingTableLogic;
import tconstruct.blocks.logic.FaucetLogic;
import tconstruct.client.TProxyClient;
import tconstruct.common.TContent;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.Item;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.Fluid;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class SearedRender implements ISimpleBlockRenderingHandler
{
public static int searedModel = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == searedModel)
{
if (metadata == 0)
{
//Top
renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
//Lip
renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
//Legs
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
else if (metadata == 1)
{
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.375, 0.625, 1);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.625, 0.25, 0.625, 0.75, 0.625, 1);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
}
else if (metadata == 2)
{
renderer.setRenderBounds(0.125F, 0.125f, 0.125F, 0.875F, 0.25F, 0.875F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
//Details
renderer.setRenderBounds(0.001f, 0.1245f, 0.001f, 0.1245f, 0.999f, 0.4375f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.001f, 0.1245f, 0.5625f, 0.1245f, 0.999f, 0.999f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.001f, 0.8755f, 0.4375f, 0.1245f, 0.999f, 0.5625f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.001f, 0.1245f, 0.4375f, 0.1245f, 0.25F, 0.5625f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.8755f, 0.1245f, 0f, 0.999f, 0.999f, 0.4375f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.8755f, 0.1245f, 0.5625f, 0.999f, 0.999f, 0.999f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.8755f, 0.8755f, 0.4375f, 0.999f, 0.999f, 0.5625f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.8755f, 0.1245f, 0.4375f, 0.999f, 0.25F, 0.5625f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.1245f, 0.1245f, 0.8755f, 0.4375f, 0.999f, 0.999f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.5625f, 0.1245f, 0.8755f, 0.8755f, 0.999f, 0.999f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.4375f, 0.8755f, 0.8755f, 0.5625f, 0.999f, 0.999f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.4375f, 0.1245f, 0.8755f, 0.5625f, 0.2495F, 0.999f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.1245f, 0.1245f, 0.001f, 0.4375f, 0.999f, 0.1245f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.5625f, 0.1245f, 0.001f, 0.8755f, 0.999f, 0.1245f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.4375f, 0.8755f, 0.001f, 0.5625f, 0.999f, 0.1245f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.4375f, 0.1245f, 0.001f, 0.5625f, 0.25F, 0.1245f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
//Legs
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.125, 0.3125F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.6875F, 0.0F, 0.0F, 1.0F, 0.125, 0.3125F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.6875F, 0.3125F, 0.125, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.6875F, 0.0F, 0.6875F, 1.0F, 0.125, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
//Outside
renderer.setRenderBounds(0.0f, 0.125, 0f, 0.125, 1.0F, 1);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.875f, 0.125, 0f, 1, 1.0F, 1);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.125f, 0.125, 0f, 0.875f, 1.0F, 0.125f);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.125f, 0.125, 0.875f, 0.875f, 1.0F, 1);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
else
{
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == searedModel)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0)
{
//Top
renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
//Lip
renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
renderer.renderStandardBlock(block, x, y, z);
//Legs
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z);
if (logic.liquid != null)
{
float height = logic.getLiquidAmount() / (logic.getCapacity() * 1.03F) / 16F;
renderer.setRenderBounds(0.0625F, 0.9375F, 0.0625F, 0.9375F, 0.9375F + height, 0.9375F);
Fluid fluid = logic.liquid.getFluid();
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
/*if (logic.liquid.fluidID < 4096) //Block
{
Block liquidBlock = Block.blocksList[logic.liquid.fluidID];
if (liquidBlock != null)
{
//ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, 0, x, y, z, renderer, world);
}
}
else
//Item
{
Item liquidItem = Item.itemsList[logic.liquid.fluidID];
if (liquidItem != null)
{
//ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(0), x, y, z, renderer, world);
}
}*/
}
}
else if (metadata == 1)
{
FaucetLogic logic = (FaucetLogic) world.getBlockTileEntity(x, y, z);
float xMin = 0.375F, zMin = 0.375F, xMax = 0.625F, zMax = 0.625F;
switch (logic.getRenderDirection())
{
case 2:
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.25, 0.375, 0.625, 0.375, 0.625, 1);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0.625, 0.75, 0.625, 1);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
zMin = 0.5F;
//zMin = 0.625F;
break;
case 3:
renderer.setRenderBounds(0.25, 0.25, 0, 0.75, 0.375, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.25, 0.375, 0, 0.375, 0.625, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0, 0.75, 0.625, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375, 0.375, 0, 0.625, 0.625, 0.375);
zMax = 0.5F;
break;
case 4:
renderer.setRenderBounds(0.625, 0.25, 0.25, 1, 0.375, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0.25, 1, 0.625, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0.625, 1, 0.625, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0.375, 1, 0.625, 0.625);
xMin = 0.5F;
break;
case 5:
renderer.setRenderBounds(0, 0.25, 0.25, 0.375, 0.375, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0.375, 0.25, 0.375, 0.625, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0.375, 0.625, 0.375, 0.625, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0.375, 0.375, 0.375, 0.625, 0.625);
xMax = 0.5F;
break;
}
float yMin = 0F;
int uID = world.getBlockId(x, y - 1, z);
int uMeta = world.getBlockMetadata(x, y - 1, z);
if (uID == TContent.searedBlock.blockID && uMeta == 0)
{
yMin = -0.125F;
}
else if (uID == TContent.searedBlock.blockID && uMeta == 2)
{
yMin = -0.75F;
}
else if (uID == TContent.lavaTank.blockID)
{
yMin = -1F;
}
if (logic.liquid != null)
{
Fluid fluid = logic.liquid.getFluid();
renderer.setRenderBounds(xMin, yMin, zMin, xMax, 0.625, zMax);
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
/*if (fluid.canBePlacedInWorld())
{
Block liquidBlock = Block.blocksList[blockToRender.itemID];
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, 0, x, y, z, renderer, world);
renderer.setRenderBounds(xMin, yMin, zMin, xMax, 0.625, zMax);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, 0, x, y, z, renderer, world);
}*/
/*ItemStack blockToRender = new ItemStack(logic.liquid.fluidID, 1, logic.liquid.itemMeta);
if (blockToRender.itemID < 4096) //Block
{
}
else
//Item
{
Item liquidItem = Item.itemsList[blockToRender.itemID];
//ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
int meta = blockToRender.getItemDamage();
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(meta), x, y, z, renderer, world);
renderer.setRenderBounds(xMin, yMin, zMin, xMax, 0.625, zMax);
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(meta), x, y, z, renderer, world);
}*/
//renderer.renderStandardBlock(block, x, y, z);
}
}
else if (metadata == 2)
{
renderer.setRenderBounds(0.125F, 0.125f, 0.125F, 0.875F, 0.25F, 0.875F);
renderer.renderStandardBlock(block, x, y, z);
//Outside
renderer.setRenderBounds(0.0f, 0.125, 0f, 0.125, 1.0F, 1);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.875f, 0.125, 0f, 1, 1.0F, 1);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125f, 0.125, 0f, 0.875f, 1.0F, 0.125f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125f, 0.125, 0.875f, 0.875f, 1.0F, 1);
renderer.renderStandardBlock(block, x, y, z);
//Details
renderer.setRenderBounds(0.001f, 0.1245f, 0.001f, 0.1245f, 0.999f, 0.4375f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.001f, 0.1245f, 0.5625f, 0.1245f, 0.999f, 0.999f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.001f, 0.8755f, 0.4375f, 0.1245f, 0.999f, 0.5625f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.001f, 0.1245f, 0.4375f, 0.1245f, 0.25F, 0.5625f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.8755f, 0.1245f, 0f, 0.999f, 0.999f, 0.4375f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.8755f, 0.1245f, 0.5625f, 0.999f, 0.999f, 0.999f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.8755f, 0.8755f, 0.4375f, 0.999f, 0.999f, 0.5625f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.8755f, 0.1245f, 0.4375f, 0.999f, 0.25F, 0.5625f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.1245f, 0.1245f, 0.8755f, 0.4375f, 0.999f, 0.999f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.5625f, 0.1245f, 0.8755f, 0.8755f, 0.999f, 0.999f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375f, 0.8755f, 0.8755f, 0.5625f, 0.999f, 0.999f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375f, 0.1245f, 0.8755f, 0.5625f, 0.2495F, 0.999f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.1245f, 0.1245f, 0.001f, 0.4375f, 0.999f, 0.1245f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.5625f, 0.1245f, 0.001f, 0.8755f, 0.999f, 0.1245f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375f, 0.8755f, 0.001f, 0.5625f, 0.999f, 0.1245f);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375f, 0.1245f, 0.001f, 0.5625f, 0.25F, 0.1245f);
renderer.renderStandardBlock(block, x, y, z);
//Legs
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.125, 0.3125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.6875F, 0.0F, 0.0F, 1.0F, 0.125, 0.3125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.6875F, 0.3125F, 0.125, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.6875F, 0.0F, 0.6875F, 1.0F, 0.125, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
//Liquids
CastingBasinLogic logic = (CastingBasinLogic) world.getBlockTileEntity(x, y, z);
if (logic.liquid != null)
{
float height = logic.getLiquidAmount() / (logic.getCapacity() * 1.05F) * 0.6875F;
renderer.setRenderBounds(0.0625F, 0.25f, 0.0625F, 0.9375F, 0.25f + height, 0.9375F);
Fluid fluid = logic.liquid.getFluid();
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
/*if (logic.liquid.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[logic.liquid.itemID];
if (liquidBlock != null)
{
//ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, logic.liquid.itemMeta, x, y, z, renderer, world);
}
}
else
//Item
{
Item liquidItem = Item.itemsList[logic.liquid.itemID];
if (liquidItem != null)
{
//ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(logic.liquid.itemMeta), x, y, z, renderer, world);
}
}*/
}
}
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
}
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return searedModel;
}
}
File diff suppressed because it is too large. Load diff
+175
View File
@@ -0,0 +1,175 @@
package tconstruct.client.block;
import tconstruct.blocks.logic.SmelteryLogic;
import tconstruct.client.TProxyClient;
import tconstruct.library.crafting.Smeltery;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class SmelteryRender implements ISimpleBlockRenderingHandler
{
public static int smelteryModel = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == smelteryModel)
{
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == smelteryModel)
{
if (world.getBlockMetadata(x, y, z) == 0)
return renderSmeltery(world, x, y, z, block, modelID, renderer);
else
renderer.renderStandardBlock(block, x, y, z);
}
return true;
}
public boolean renderSmeltery (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
renderer.renderStandardBlock(block, x, y, z);
SmelteryLogic logic = (SmelteryLogic) world.getBlockTileEntity(x, y, z);
if (logic.validStructure)
{
int posX = logic.centerPos.x - 1, posY = logic.centerPos.y, posZ = logic.centerPos.z - 1;
//Melting
if (logic.getSizeInventory() > 0)
{
for (int i = 0; i < logic.layers; i++)
{
renderLayer(logic, i * 9, posX, posY + i, posZ, renderer, world);
}
}
//Liquids
float base = 0F;
int yBase = 0;
int liquidBase = 0;
for (FluidStack liquid : logic.moltenMetal)
{
int liquidSize = liquid.amount;
while (liquidSize > 0)
{
int room = 20000 - liquidBase;
int countSize = liquidSize > room ? room : liquidSize;
liquidSize -= countSize;
float height = countSize > 20000 ? 1.0F : countSize / 20000F;
//renderer.setRenderBounds(0, base, 0, 1, height + base, 1);
float renderBase = base;
float renderHeight = height + base;
base += height;
liquidBase += countSize;
Fluid fluid = liquid.getFluid();
for (int i = 0; i < 9; i++)
{
float minX = i % 3 == 0 ? -0.001F : 0F;
float minZ = i / 3 == 0 ? -0.001F : 0F;
float maxX = i % 3 == 2 ? 1.001F : 1F;
float maxZ = i / 3 == 2 ? 1.001F : 1F;
renderer.setRenderBounds(minX, renderBase, minZ, maxX, renderHeight, maxZ);
if (fluid.canBePlacedInWorld())
BlockSkinRenderHelper.renderMetadataBlock(Block.blocksList[fluid.getBlockID()], 0, posX + i % 3, posY + yBase, posZ + i / 3, renderer, world);
else
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), posX + i % 3, posY + yBase, posZ + i / 3, renderer, world);
}
/*if (liquid.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[liquid.itemID];
for (int i = 0; i < 9; i++)
{
float minX = i % 3 == 0 ? -0.001F : 0F;
float minZ = i / 3 == 0 ? -0.001F : 0F;
float maxX = i % 3 == 2 ? 1.001F : 1F;
float maxZ = i / 3 == 2 ? 1.001F : 1F;
renderer.setRenderBounds(minX, renderBase, minZ, maxX, renderHeight, maxZ);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, liquid.itemMeta, posX + i % 3, posY + yBase, posZ + i / 3, renderer, world);
}
}
else
//Item
{
Item liquidItem = Item.itemsList[liquid.itemID];
for (int i = 0; i < 9; i++)
{
float minX = i % 3 == 0 ? -0.001F : 0F;
float minZ = i / 3 == 0 ? -0.001F : 0F;
float maxX = i % 3 == 2 ? 1.001F : 1F;
float maxZ = i / 3 == 2 ? 1.001F : 1F;
renderer.setRenderBounds(minX, renderBase, minZ, maxX, renderHeight, maxZ);
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(liquid.itemMeta), posX, posY + yBase, posZ, renderer, world);
}
}*/
if (countSize == room)
{
base = 0F;
yBase++;
liquidBase = 0;
}
}
}
}
return true;
}
void renderLayer (SmelteryLogic logic, int start, int posX, int posY, int posZ, RenderBlocks renderer, IBlockAccess world)
{
renderer.setRenderBounds(-0.001F, -0.001F, -0.001F, 1.001F, 1.001F, 1.001F);
for (int i = 0; i < 9; i++)
{
ItemStack input = logic.getStackInSlot(i + start);
if (input != null && logic.getTempForSlot(i + start) > 20)
{
ItemStack blockToRender = Smeltery.getRenderIndex(input);
if (blockToRender != null)
{
float blockHeight = input.stackSize / (float) blockToRender.stackSize;
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, MathHelper.clamp_float(blockHeight, 0.01F, 1.0F), 1.0F);
if (blockToRender.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[blockToRender.itemID];
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), posX + i % 3, posY, posZ + i / 3, renderer, world);
}
/*else //No items, only blocks
//Item
{
Item liquidItem = Item.itemsList[blockToRender.itemID];
int metadata = blockToRender.getItemDamage();
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(metadata), posX + i % 3, posY, posZ + i / 3, renderer, world);
}*/
}
}
}
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return smelteryModel;
}
}
@@ -0,0 +1,96 @@
package tconstruct.client.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class TableForgeRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}
+113
View File
@@ -0,0 +1,113 @@
package tconstruct.client.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class TableRender implements ISimpleBlockRenderingHandler
{
public static int tabelModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == tabelModelID)
{
if (metadata == 5)
{
renderer.setRenderBounds(0.0F, 0.0, 0.0F, 1.0F, 0.875F, 1.0F);
renderStandardInvBlock(renderer, block, metadata);
}
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderStandardInvBlock(renderer, block, metadata);
}
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == tabelModelID)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5)
{
renderer.setRenderBounds(0.0F, 0.0, 0.0F, 1.0F, 0.875F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
}
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return tabelModelID;
}
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}
+113
View File
@@ -0,0 +1,113 @@
package tconstruct.client.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.LavaTankLogic;
import tconstruct.client.TProxyClient;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class TankRender implements ISimpleBlockRenderingHandler
{
public static int tankModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == tankModelID)
{
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
if (metadata == 0)
{
renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
renderDoRe(renderer, block, metadata);
}
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == tankModelID)
{
//Liquid
LavaTankLogic logic = (LavaTankLogic) world.getBlockTileEntity(x, y, z);
if (logic.containsFluid())
{
FluidStack liquid = logic.tank.getFluid();
renderer.setRenderBounds(0.001, 0.001, 0.001, 0.999, logic.getFluidAmountScaled(), 0.999);
Fluid fluid = liquid.getFluid();
if (fluid.canBePlacedInWorld())
BlockSkinRenderHelper.renderMetadataBlock(Block.blocksList[fluid.getBlockID()], 0, x, y, z, renderer, world);
else
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
renderer.setRenderBounds(00, 0.001, 0.001, 0.999, logic.getFluidAmountScaled(), 0.999);
}
//Block
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0 && world.getBlockId(x, y + 1, z) == 0)
{
renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
renderer.renderStandardBlock(block, x, y + 1, z);
}
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
renderer.renderStandardBlock(block, x, y, z);
}
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return tankModelID;
}
private void renderDoRe (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, 0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}
+141
View File
@@ -0,0 +1,141 @@
package tconstruct.client.entity;
import net.minecraft.block.Block;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import org.lwjgl.opengl.GL11;
import tconstruct.entity.CartEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CartRender extends Render
{
protected ModelBase modelCart;
RenderBlocks renderblocks;
public CartRender()
{
this.shadowSize = 0.5F;
this.modelCart = new ModelPullcart();
renderblocks = new RenderBlocks();
}
public void renderPullcart (CartEntity cart, double posX, double posY, double posZ, float par8, float par9)
{
GL11.glPushMatrix();
long var10 = (long) cart.entityId * 493286711L;
var10 = var10 * var10 * 4392167121L + var10 * 98761L;
float var12 = (((float) (var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
float var13 = (((float) (var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
float var14 = (((float) (var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
GL11.glTranslatef(var12, var13, var14);
double var15 = cart.lastTickPosX + (cart.posX - cart.lastTickPosX) * (double) par9;
double var17 = cart.lastTickPosY + (cart.posY - cart.lastTickPosY) * (double) par9;
double var19 = cart.lastTickPosZ + (cart.posZ - cart.lastTickPosZ) * (double) par9;
double var21 = 0.30000001192092896D;
Vec3 var23 = cart.func_70489_a(var15, var17, var19);
float var24 = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * par9;
if (var23 != null)
{
Vec3 var25 = cart.func_70495_a(var15, var17, var19, var21);
Vec3 var26 = cart.func_70495_a(var15, var17, var19, -var21);
if (var25 == null)
{
var25 = var23;
}
if (var26 == null)
{
var26 = var23;
}
posX += var23.xCoord - var15;
posY += (var25.yCoord + var26.yCoord) / 2.0D - var17;
posZ += var23.zCoord - var19;
Vec3 var27 = var26.addVector(-var25.xCoord, -var25.yCoord, -var25.zCoord);
if (var27.lengthVector() != 0.0D)
{
var27 = var27.normalize();
par8 = (float) (Math.atan2(var27.zCoord, var27.xCoord) * 180.0D / Math.PI);
var24 = (float) (Math.atan(var27.yCoord) * 73.0D);
}
}
GL11.glTranslatef((float) posX, (float) posY + 0.3125f, (float) posZ);
GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F);
float var28 = (float) cart.func_70496_j() - par9;
float var30 = (float) cart.getDamage() - par9;
if (var30 < 0.0F)
{
var30 = 0.0F;
}
if (var28 > 0.0F)
{
GL11.glRotatef(MathHelper.sin(var28) * var28 * var30 / 10.0F * (float) cart.func_70493_k(), 1.0F, 0.0F, 0.0F);
}
if (cart.getCartType() != 0)
{
//this.loadTexture("/terrain.png");
float var29 = 0.75F;
GL11.glScalef(var29, var29, var29);
if (cart.getCartType() == 1)
{
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
renderblocks.renderBlockAsItem(Block.chest, 0, cart.getBrightness(par9));
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.5F, 0.0F, -0.5F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
else if (cart.getCartType() == 2)
{
GL11.glTranslatef(0.0F, 0.3125F, 0.0F);
renderblocks.renderBlockAsItem(Block.furnaceIdle, 0, cart.getBrightness(par9));
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.3125F, 0.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
//GL11.glScalef(1.0F / var29, 1.0F / var29, 1.0F / var29);
}
//this.loadTexture("/tinkertextures/entity/pullcart.png");
GL11.glScalef(-1.0F, -1.0F, 1.0F);
this.modelCart.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderPullcart((CartEntity) par1Entity, par2, par4, par6, par8, par9);
}
protected ResourceLocation func_110775_a(Entity par1Entity)
{
return texture;
}
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/pullcart.png");
}
@@ -0,0 +1,33 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CloneHeadModel extends ModelBase
{
/** The slime's bodies, both the inside box and the outside box */
ModelRenderer slimeBodies;
ModelRenderer slimeHeadwear;
public CloneHeadModel(float scale)
{
this.slimeBodies = new ModelRenderer(this, 0, 0);
this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8);
this.slimeHeadwear = new ModelRenderer(this, 32, 0);
this.slimeHeadwear.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8, scale);
}
/**
* Sets the models various rotation angles then renders the model.
*/
public void render (Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
this.slimeBodies.render(par7);
this.slimeHeadwear.render(par7);
}
}
@@ -0,0 +1,121 @@
package tconstruct.client.entity;
import tconstruct.entity.Automaton;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
public class CrystalGuardianModel extends ModelBase
{
public ModelRenderer chest;
public ModelRenderer leftarm;
public ModelRenderer rightarm;
public ModelRenderer leftleg;
public ModelRenderer rightleg;
public ModelRenderer neckplate;
public ModelRenderer head;
public ModelRenderer crystal;
public ModelRenderer eyeleft;
public ModelRenderer eyeright;
public CrystalGuardianModel()
{
textureWidth = 64;
textureHeight = 64;
chest = new ModelRenderer(this, 0, 0);
chest.addBox(-8F, -8F, -5F, 16, 16, 10);
chest.setRotationPoint(0F, 0F, 0F);
setRotation(chest, 0F, 0F, 0F);
leftarm = new ModelRenderer(this, 0, 26);
leftarm.mirror = true;
leftarm.addBox(0F, -2F, -2F, 4, 22, 4);
leftarm.setRotationPoint(8F, -5F, 0F);
setRotation(leftarm, 0F, 0F, 0F);
rightarm = new ModelRenderer(this, 0, 26);
rightarm.mirror = false;
rightarm.addBox(-4F, -2F, -2F, 4, 22, 4);
rightarm.setRotationPoint(-8F, -5F, 0F);
setRotation(rightarm, 0F, 0F, 0F);
leftleg = new ModelRenderer(this, 16, 26);
leftleg.mirror = true;
leftleg.addBox(-2F, 0F, -3F, 4, 16, 6);
leftleg.setRotationPoint(4F, 8F, 0F);
setRotation(leftleg, 0F, 0F, 0F);
rightleg = new ModelRenderer(this, 16, 26);
rightleg.mirror = false;
rightleg.addBox(-2F, 0F, -3F, 4, 16, 6);
rightleg.setRotationPoint(-4F, 8F, 0F);
setRotation(rightleg, 0F, 0F, 0F);
neckplate = new ModelRenderer(this, 8, 48);
neckplate.addBox(-4F, -1F, -4F, 8, 1, 8);
neckplate.setRotationPoint(0F, -8F, 0F);
setRotation(neckplate, 0F, 0F, 0F);
head = new ModelRenderer(this, 36, 26);
head.addBox(-3F, -6F, -3F, 6, 6, 6);
head.setRotationPoint(0F, -9F, 0F);
setRotation(head, 0F, 0F, 0F);
crystal = new ModelRenderer(this, 36, 38);
crystal.addBox(-1F, -8F, -1F, 2, 2, 2);
crystal.setRotationPoint(0F, -9F, 0F);
setRotation(crystal, 0F, 0F, 0F);
eyeleft = new ModelRenderer(this, 36, 42);
eyeleft.addBox(1F, -4F, -4F, 2, 2, 1);
eyeleft.setRotationPoint(0F, -9F, 0F);
setRotation(eyeleft, 0F, 0F, 0F);
eyeright = new ModelRenderer(this, 36, 42);
eyeright.addBox(-3F, -4F, -4F, 2, 2, 1);
eyeright.setRotationPoint(0F, -9F, 0F);
setRotation(eyeright, 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);
chest.render(f5);
leftarm.render(f5);
rightarm.render(f5);
leftleg.render(f5);
rightleg.render(f5);
neckplate.render(f5);
head.render(f5);
crystal.render(f5);
eyeleft.render(f5);
eyeright.render(f5);
}
private void setRotation (ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
@Override
public void setRotationAngles (float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
{
//super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.rightleg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2;
this.leftleg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2;
}
@Override
public void setLivingAnimations (EntityLivingBase par1EntityLiving, float par2, float par3, float par4)
{
Automaton entityirongolem = (Automaton) par1EntityLiving;
int i = 0;//entityirongolem.getAttackTimer();
this.rightarm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3;
this.leftarm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3;
/*this.rightarm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);
this.leftarm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);*/
}
private float func_78172_a (float par1, float par2)
{
return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F);
}
}
@@ -0,0 +1,195 @@
package tconstruct.client.entity;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CrystalGuardianRender extends RenderLiving
{
CrystalGuardianModel model;
public CrystalGuardianRender()
{
super(new CrystalGuardianModel(), 0.5F);
this.model = (CrystalGuardianModel) this.mainModel;
}
@Override
protected void renderEquippedItems (EntityLivingBase par1EntityLiving, float par2)
{
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
super.renderEquippedItems(par1EntityLiving, par2);
ItemStack itemstack = par1EntityLiving.getHeldItem();
ItemStack itemstack1 = par1EntityLiving.getCurrentItemOrArmor(4);
float f2;
if (itemstack1 != null)
{
GL11.glPushMatrix();
this.model.head.postRender(0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D));
if (itemstack1.getItem() instanceof ItemBlock)
{
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))
{
f2 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, -f2);
}
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack1, 0);
}
else if (itemstack1.getItem().itemID == Item.skull.itemID)
{
f2 = 1.0625F;
GL11.glScalef(f2, -f2, -f2);
String s = "";
if (itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("SkullOwner"))
{
s = itemstack1.getTagCompound().getString("SkullOwner");
}
TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, itemstack1.getItemDamage(), s);
}
GL11.glPopMatrix();
}
if (itemstack != null)
{
GL11.glPushMatrix();
if (this.mainModel.isChild)
{
f2 = 0.5F;
GL11.glTranslatef(0.0F, 0.625F, 0.0F);
GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
GL11.glScalef(f2, f2, f2);
}
this.model.rightarm.postRender(0.0625F);
GL11.glTranslatef(-0.125F, 1F, 0F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
if (itemstack.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())))
{
f2 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
f2 *= 0.75F;
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(-f2, -f2, f2);
}
else if (itemstack.itemID == Item.bow.itemID)
{
f2 = 0.625F;
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else if (Item.itemsList[itemstack.itemID].isFull3D())
{
f2 = 0.625F;
if (Item.itemsList[itemstack.itemID].shouldRotateAroundWhenRendering())
{
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
}
this.func_82422_c();
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else
{
f2 = 0.375F;
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
GL11.glScalef(f2, f2, f2);
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
}
float f6;
float f11;
int j;
float f12;
if (itemstack.getItem().requiresMultipleRenderPasses())
{
for (j = 0; j < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); j++)
{
int k = itemstack.getItem().getColorFromItemStack(itemstack, j);
f12 = (float) (k >> 16 & 255) / 255.0F;
f11 = (float) (k >> 8 & 255) / 255.0F;
f6 = (float) (k & 255) / 255.0F;
GL11.glColor4f(f12, f11, f6, 1.0F);
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, j);
}
}
else
{
j = itemstack.getItem().getColorFromItemStack(itemstack, 0);
f6 = (float) (j >> 16 & 255) / 255.0F;
f12 = (float) (j >> 8 & 255) / 255.0F;
f11 = (float) (j & 255) / 255.0F;
GL11.glColor4f(f6, f12, f11, 1.0F);
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0);
}
/*this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0);
if (itemstack.getItem().requiresMultipleRenderPasses())
{
for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
{
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x);
}
}*/
GL11.glPopMatrix();
}
}
protected void func_82422_c ()
{
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
}
@Override
protected ResourceLocation func_110775_a(Entity par1Entity)
{
return texture;
}
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/crystalguardamber.png");
}
@@ -0,0 +1,52 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class CrystalModelSmall extends ModelBase
{
/*ModelRenderer body;
ModelRendererTurbo top;
ModelRendererTurbo bottom;
public CrystalModelSmall()
{
textureWidth = 32;
textureHeight = 32;
body = new ModelRenderer(this, 0, 8);
body.addBox(-2F, 0F, -2F, 4, 6, 4);
body.setRotationPoint(0F, 0F, 0F);
setRotation(body, 0, 0.7853982F, 0);
top = new ModelRendererTurbo(this, 0, 0, 32, 32);
top.addCone(0, 0, 0, 2.8F, 4, 4, 0, ModelRendererTurbo.MR_BOTTOM, 4, 8);
top.setRotationPoint(0F, -4F, 0F);
setRotation(top, 0F, 0F, 0F);
bottom = new ModelRendererTurbo(this, 0, 18, 32, 32);
top.addCone(0, 10, 0, 2.8F, 4, 4, 0, ModelRendererTurbo.MR_TOP, 4, 8);
bottom.setRotationPoint(0F, 6F, 0F);
//setRotation(bottom, 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);
body.render(f5);
top.render(f5);
bottom.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,73 @@
package tconstruct.client.entity;
import tconstruct.entity.Crystal;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CrystalRender extends RenderLiving
{
/** The creeper model. */
private ModelBase creeperModel = new CrystalModelSmall();
public CrystalRender()
{
super(new CrystalModelSmall(), 0.5F);
}
/**
* A method used to render a creeper's powered form as a pass model.
*/
protected int renderCreeperPassModel (Crystal par1EntityCreeper, int par2, float par3)
{
return -1;
}
protected int func_77061_b (Crystal par1EntityCreeper, int par2, float par3)
{
return -1;
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
/*protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
{
this.updateCreeperScale((Skyla)par1EntityLiving, par2);
}*/
/**
* Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
*/
protected int getColorMultiplier (EntityLiving par1EntityLiving, float par2, float par3)
{
return super.getColorMultiplier(par1EntityLiving, par2, par3);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
{
return this.renderCreeperPassModel((Crystal) par1EntityLiving, par2, par3);
}
protected int inheritRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
{
return this.func_77061_b((Crystal) par1EntityLiving, par2, par3);
}
protected ResourceLocation func_110775_a(Entity par1Entity)
{
return texture;
}
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/crystalwater.png");
}
@@ -0,0 +1,636 @@
package tconstruct.client.entity;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class FancyItemRender extends Render
{
private static final ResourceLocation field_110798_h = new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
public boolean renderWithColor = true;
/** Defines the zLevel of rendering of item on GUI. */
public float zLevel;
public static boolean renderInFrame;
public FancyItemRender()
{
this.shadowSize = 0.15F;
this.shadowOpaque = 0.75F;
}
/**
* Renders the item
*/
public void doRenderItem (EntityItem par1EntityItem, double par2, double par4, double par6, float par8, float par9)
{
this.func_110777_b(par1EntityItem);
this.random.setSeed(187L);
ItemStack itemstack = par1EntityItem.getEntityItem();
if (itemstack.getItem() != null)
{
GL11.glPushMatrix();
float f2 = shouldBob() ? MathHelper.sin(((float) par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F;
float f3 = (((float) par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI);
byte b0 = getMiniBlockCount(itemstack);
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float f4;
float f5;
float f6;
int i;
Block block = null;
if (itemstack.itemID < Block.blocksList.length)
{
block = Block.blocksList[itemstack.itemID];
}
if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks))
{
;
}
else if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
if (renderInFrame)
{
GL11.glScalef(1.25F, 1.25F, 1.25F);
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
float f7 = 0.25F;
int j = block.getRenderType();
if (j == 1 || j == 19 || j == 12 || j == 2)
{
f7 = 0.5F;
}
GL11.glScalef(f7, f7, f7);
for (i = 0; i < b0; ++i)
{
GL11.glPushMatrix();
if (i > 0)
{
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
GL11.glTranslatef(f5, f4, f6);
}
f5 = 1.0F;
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
GL11.glPopMatrix();
}
}
else
{
float f8;
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
{
if (renderInFrame)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
{
this.random.setSeed(187L);
Icon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
if (this.renderWithColor)
{
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
f5 = (float) (i >> 16 & 255) / 255.0F;
f4 = (float) (i >> 8 & 255) / 255.0F;
f6 = (float) (i & 255) / 255.0F;
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
}
else
{
this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
}
}
}
else
{
if (renderInFrame)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
Icon icon1 = itemstack.getIconIndex();
if (this.renderWithColor)
{
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
f8 = (float) (l >> 16 & 255) / 255.0F;
float f9 = (float) (l >> 8 & 255) / 255.0F;
f5 = (float) (l & 255) / 255.0F;
f4 = 1.0F;
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
}
else
{
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
}
}
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
protected ResourceLocation func_110796_a (EntityItem par1EntityItem)
{
return this.renderManager.renderEngine.func_130087_a(par1EntityItem.getEntityItem().getItemSpriteNumber());
}
/**
* Renders a dropped item
*/
private void renderDroppedItem (EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
{
renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0);
}
private void renderDroppedItem (EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
{
Tessellator tessellator = Tessellator.instance;
if (par2Icon == null)
{
TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
ResourceLocation resourcelocation = texturemanager.func_130087_a(par1EntityItem.getEntityItem().getItemSpriteNumber());
par2Icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
}
float f4 = ((Icon) par2Icon).getMinU();
float f5 = ((Icon) par2Icon).getMaxU();
float f6 = ((Icon) par2Icon).getMinV();
float f7 = ((Icon) par2Icon).getMaxV();
float f8 = 1.0F;
float f9 = 0.5F;
float f10 = 0.25F;
float f11;
GL11.glPushMatrix();
if (renderInFrame)
{
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
}
else
{
GL11.glRotatef((((float) par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
float f12 = 0.0625F;
f11 = 0.021875F;
ItemStack itemstack = par1EntityItem.getEntityItem();
int j = itemstack.stackSize;
byte b0 = getMiniItemCount(itemstack);
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
for (int k = 0; k < b0; ++k)
{
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
if (k > 0 && shouldSpreadItems())
{
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
GL11.glTranslatef(x, y, f12 + f11);
}
else
{
GL11.glTranslatef(0f, 0f, f12 + f11);
}
if (itemstack.getItemSpriteNumber() == 0)
{
this.func_110776_a(TextureMap.field_110575_b);
}
else
{
this.func_110776_a(TextureMap.field_110576_c);
}
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getOriginX(), ((Icon) par2Icon).getOriginY(), f12);
if (itemstack.hasEffect(pass))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
this.renderManager.renderEngine.func_110577_a(field_110798_h);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f13 = 0.76F;
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f14 = 0.125F;
GL11.glScalef(f14, f14, f14);
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f15, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f14, f14, f14);
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f15, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
GL11.glPopMatrix();
}
/**
* Renders the item's icon or block into the UI at the specified position.
*/
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
}
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
{
int k = par3ItemStack.itemID;
int l = par3ItemStack.getItemDamage();
Object object = par3ItemStack.getIconIndex();
float f;
int i1;
float f1;
float f2;
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
{
par2TextureManager.func_110577_a(TextureMap.field_110575_b);
GL11.glPushMatrix();
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
GL11.glScalef(10.0F, 10.0F, 10.0F);
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
GL11.glScalef(1.0F, 1.0F, -1.0F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f = (float) (i1 >> 16 & 255) / 255.0F;
f1 = (float) (i1 >> 8 & 255) / 255.0F;
f2 = (float) (i1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f, f1, f2, 1.0F);
}
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
this.itemRenderBlocks.useInventoryTint = this.renderWithColor;
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
this.itemRenderBlocks.useInventoryTint = true;
GL11.glPopMatrix();
}
else if (Item.itemsList[k].requiresMultipleRenderPasses())
{
GL11.glDisable(GL11.GL_LIGHTING);
for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
{
par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1);
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
f1 = (float) (k1 >> 16 & 255) / 255.0F;
f2 = (float) (k1 >> 8 & 255) / 255.0F;
float f3 = (float) (k1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f1, f2, f3, 1.0F);
}
this.renderIcon(par4, par5, icon, 16, 16);
if (par3ItemStack.hasEffect(j1))
{
renderEffect(par2TextureManager, par4, par5);
}
}
GL11.glEnable(GL11.GL_LIGHTING);
}
else
{
GL11.glDisable(GL11.GL_LIGHTING);
ResourceLocation resourcelocation = par2TextureManager.func_130087_a(par3ItemStack.getItemSpriteNumber());
par2TextureManager.func_110577_a(resourcelocation);
if (object == null)
{
object = ((TextureMap) Minecraft.getMinecraft().func_110434_K().func_110581_b(resourcelocation)).func_110572_b("missingno");
}
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f = (float) (i1 >> 16 & 255) / 255.0F;
f1 = (float) (i1 >> 8 & 255) / 255.0F;
f2 = (float) (i1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f, f1, f2, 1.0F);
}
this.renderIcon(par4, par5, (Icon) object, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
if (par3ItemStack.hasEffect(0))
{
renderEffect(par2TextureManager, par4, par5);
}
}
GL11.glEnable(GL11.GL_CULL_FACE);
}
private void renderEffect (TextureManager manager, int x, int y)
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
manager.func_110577_a(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
/**
* Render the item's icon or block into the GUI, including the glint effect.
*/
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
if (par3ItemStack != null)
{
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
{
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
}
/* Modders must handle this themselves if they use custom renderers!
if (par3ItemStack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
par2TextureManager.func_110577_a(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
*/
}
}
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
{
for (int j1 = 0; j1 < 2; ++j1)
{
if (j1 == 0)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
if (j1 == 1)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
float f = 0.00390625F;
float f1 = 0.00390625F;
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
float f3 = 0.0F;
Tessellator tessellator = Tessellator.instance;
float f4 = 4.0F;
if (j1 == 1)
{
f4 = -1.0F;
}
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
(double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
tessellator.draw();
}
}
/**
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
* specified position.
*/
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
}
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
{
if (par3ItemStack != null)
{
if (par3ItemStack.stackSize > 1 || par6Str != null)
{
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
if (par3ItemStack.isItemDamaged())
{
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator tessellator = Tessellator.instance;
int i1 = 255 - l << 16 | l << 8;
int j1 = (255 - l) / 4 << 16 | 16128;
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}
/**
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
* tessellator, x, y, width, height, color
*/
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
{
par1Tessellator.startDrawingQuads();
par1Tessellator.setColorOpaque_I(par6);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
par1Tessellator.draw();
}
public void renderIcon (int par1, int par2, Icon par3Icon, int par4, int par5)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
tessellator.draw();
}
protected ResourceLocation func_110775_a (Entity par1Entity)
{
return this.func_110796_a((EntityItem) par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderItem((EntityItem) par1Entity, par2, par4, par6, par8, par9);
}
/**
* Items should spread out when rendered in 3d?
* @return
*/
public boolean shouldSpreadItems ()
{
return true;
}
/**
* Items should have a bob effect
* @return
*/
public boolean shouldBob ()
{
return true;
}
public byte getMiniBlockCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 5)
ret = 3;
if (stack.stackSize > 20)
ret = 4;
if (stack.stackSize > 40)
ret = 5;
return ret;
}
/**
* Allows for a subclass to override how many rendered items appear in a
* "mini item 3d stack"
* @param stack
* @return
*/
public byte getMiniItemCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 15)
ret = 3;
if (stack.stackSize > 31)
ret = 4;
return ret;
}
}
@@ -0,0 +1,79 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelPig;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
public class GolemBaseModel extends ModelPig
{
ModelRenderer rightArm;
ModelRenderer leftArm;
public GolemBaseModel()
{
float f = 0.0F;
float f1 = 0.0F;
head = new ModelRenderer(this, 0, 0);
head.addBox(-4F, -8F, -4F, 8, 8, 8, f);
head.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
head.showModel = false;
body = new ModelRenderer(this, 16, 16);
body.addBox(-4F, 0.0F, -2F, 8, 12, 4, f);
body.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
body.showModel = false;
rightArm = new ModelRenderer(this, 40, 16);
rightArm.addBox(-3F, -2F, -2F, 4, 12, 4, f);
rightArm.setRotationPoint(-5F, 2.0F + f1, 0.0F);
leftArm = new ModelRenderer(this, 40, 16);
leftArm.mirror = true;
leftArm.addBox(-1F, -2F, -2F, 4, 12, 4, f);
leftArm.setRotationPoint(5F, 2.0F + f1, 0.0F);
leg3 = new ModelRenderer(this, 0, 16);
leg3.addBox(-2F, 0.0F, -2F, 4, 12, 4, f);
leg3.setRotationPoint(-2F, 12F + f1, 0.0F);
leg4 = new ModelRenderer(this, 0, 16);
leg4.mirror = true;
leg4.addBox(-2F, 0.0F, -2F, 4, 12, 4, f);
leg4.setRotationPoint(2.0F, 12F + f1, 0.0F);
rightArm = new ModelRenderer(this, 40, 16);
rightArm.addBox(-1F, -2F, -1F, 2, 12, 2, f);
rightArm.setRotationPoint(-5F, 2.0F, 0.0F);
rightArm.showModel = false;
leftArm = new ModelRenderer(this, 40, 16);
leftArm.mirror = true;
leftArm.addBox(-1F, -2F, -1F, 2, 12, 2, f);
leftArm.setRotationPoint(5F, 2.0F, 0.0F);
leftArm.showModel = false;
leg3 = new ModelRenderer(this, 0, 16);
leg3.addBox(-1F, 0.0F, -1F, 2, 12, 2, f);
leg3.setRotationPoint(-2F, 12F, 0.0F);
leg3.showModel = false;
leg4 = new ModelRenderer(this, 0, 16);
leg4.mirror = true;
leg4.addBox(-1F, 0.0F, -1F, 2, 12, 2, f);
leg4.setRotationPoint(2.0F, 12F, 0.0F);
leg4.showModel = false;
leg1.showModel = leg2.showModel = false;
}
@Override
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);
float f6 = 0.0F;
float f7 = 0.0F;
rightArm.rotateAngleZ = 0.0F;
leftArm.rotateAngleZ = 0.0F;
rightArm.rotateAngleY = -(0.1F - f6 * 0.6F) + head.rotateAngleY;
leftArm.rotateAngleY = (0.1F - f6 * 0.6F) + head.rotateAngleY + 0.4F;
rightArm.rotateAngleX = -1.570796F + head.rotateAngleX;
leftArm.rotateAngleX = -1.570796F + head.rotateAngleX;
rightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
leftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
rightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
leftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
rightArm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F;
leftArm.rotateAngleX -= MathHelper.sin(f2 * 0.067F) * 0.05F;
}
}
@@ -0,0 +1,186 @@
package tconstruct.client.entity;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class MiniGardyRender extends RenderLiving
{
public MiniGardyRender()
{
super(new ModelMiniGardy(), 0.5F);
}
@Override
protected void renderEquippedItems (EntityLivingBase par1EntityLiving, float par2)
{
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
super.renderEquippedItems(par1EntityLiving, par2);
ItemStack heldItem = par1EntityLiving.getHeldItem();
ItemStack helmetItem = par1EntityLiving.getCurrentItemOrArmor(4);
float f2;
ModelMiniGardy model = (ModelMiniGardy) this.mainModel;
if (helmetItem != null)
{
GL11.glPushMatrix();
model.head.postRender(0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(helmetItem, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, helmetItem, BLOCK_3D));
if (helmetItem.getItem() instanceof ItemBlock)
{
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[helmetItem.itemID].getRenderType()))
{
f2 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, -f2);
}
this.renderManager.itemRenderer.renderItem(par1EntityLiving, helmetItem, 0);
}
else if (helmetItem.getItem().itemID == Item.skull.itemID)
{
f2 = 1.0625F;
GL11.glScalef(f2, -f2, -f2);
String s = "";
if (helmetItem.hasTagCompound() && helmetItem.getTagCompound().hasKey("SkullOwner"))
{
s = helmetItem.getTagCompound().getString("SkullOwner");
}
TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, helmetItem.getItemDamage(), s);
}
GL11.glPopMatrix();
}
if (heldItem != null)
{
GL11.glPushMatrix();
//if (this.mainModel.isChild)
{
f2 = 0.5F;
GL11.glTranslatef(0.0F, 0.75F, 0.0F);
GL11.glRotatef(-10.0F, 0F, 0.0F, 1.0F);
GL11.glScalef(f2, f2, f2);
}
model.torso.postRender(0.0625F);
model.rightArm.postRender(0.0625F);
model.rightHand.postRender(0.0625F);
GL11.glTranslatef(-0.125F, 1F, 0F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(heldItem, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, heldItem, BLOCK_3D));
if (heldItem.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[heldItem.itemID].getRenderType())))
{
f2 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
f2 *= 0.75F;
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(-f2, -f2, f2);
}
else if (heldItem.itemID == Item.bow.itemID)
{
f2 = 0.625F;
GL11.glTranslatef(-0.175F, 0.125F, 0.3125F);
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else
//if (Item.itemsList[heldItem.itemID].isFull3D())
{
f2 = 0.625F;
if (Item.itemsList[heldItem.itemID].shouldRotateAroundWhenRendering())
{
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
}
this.translateItem();
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
/*else
{
f2 = 0.375F;
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
GL11.glScalef(f2, f2, f2);
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
}*/
float f6;
float f11;
int j;
float f12;
if (heldItem.getItem().requiresMultipleRenderPasses())
{
for (j = 0; j < heldItem.getItem().getRenderPasses(heldItem.getItemDamage()); j++)
{
int k = heldItem.getItem().getColorFromItemStack(heldItem, j);
f12 = (float) (k >> 16 & 255) / 255.0F;
f11 = (float) (k >> 8 & 255) / 255.0F;
f6 = (float) (k & 255) / 255.0F;
GL11.glColor4f(f12, f11, f6, 1.0F);
this.renderManager.itemRenderer.renderItem(par1EntityLiving, heldItem, j);
}
}
else
{
j = heldItem.getItem().getColorFromItemStack(heldItem, 0);
f6 = (float) (j >> 16 & 255) / 255.0F;
f12 = (float) (j >> 8 & 255) / 255.0F;
f11 = (float) (j & 255) / 255.0F;
GL11.glColor4f(f6, f12, f11, 1.0F);
this.renderManager.itemRenderer.renderItem(par1EntityLiving, heldItem, 0);
}
GL11.glPopMatrix();
}
}
protected void translateItem ()
{
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
}
@Override
protected ResourceLocation func_110775_a(Entity par1Entity)
{
return texture;
}
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/googirl.png");
}
@@ -0,0 +1,120 @@
package tconstruct.client.entity;
import net.minecraft.client.model.PositionTextureVertex;
import net.minecraft.client.model.TexturedQuad;
import net.minecraft.client.renderer.Tessellator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ModelBoxDegrees
{
/**
* The (x,y,z) vertex positions and (u,v) texture coordinates for each of the 8 points on a cube
*/
private PositionTextureVertex[] vertexPositions;
/** An array of 6 TexturedQuads, one for each face of a cube */
private TexturedQuad[] quadList;
/** X vertex coordinate of lower box corner */
public final float posX1;
/** Y vertex coordinate of lower box corner */
public final float posY1;
/** Z vertex coordinate of lower box corner */
public final float posZ1;
/** X vertex coordinate of upper box corner */
public final float posX2;
/** Y vertex coordinate of upper box corner */
public final float posY2;
/** Z vertex coordinate of upper box corner */
public final float posZ2;
public String field_78247_g;
public ModelBoxDegrees(ModelRendererDegrees par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10)
{
this.posX1 = par4;
this.posY1 = par5;
this.posZ1 = par6;
this.posX2 = par4 + (float) par7;
this.posY2 = par5 + (float) par8;
this.posZ2 = par6 + (float) par9;
this.vertexPositions = new PositionTextureVertex[8];
this.quadList = new TexturedQuad[6];
float f4 = par4 + (float) par7;
float f5 = par5 + (float) par8;
float f6 = par6 + (float) par9;
par4 -= par10;
par5 -= par10;
par6 -= par10;
f4 += par10;
f5 += par10;
f6 += par10;
if (par1ModelRenderer.mirror)
{
float f7 = f4;
f4 = par4;
par4 = f7;
}
PositionTextureVertex positiontexturevertex = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f4, par5, par6, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f4, f5, par6, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(par4, f5, par6, 8.0F, 0.0F);
PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(par4, par5, f6, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f4, par5, f6, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(par4, f5, f6, 8.0F, 0.0F);
this.vertexPositions[0] = positiontexturevertex;
this.vertexPositions[1] = positiontexturevertex1;
this.vertexPositions[2] = positiontexturevertex2;
this.vertexPositions[3] = positiontexturevertex3;
this.vertexPositions[4] = positiontexturevertex4;
this.vertexPositions[5] = positiontexturevertex5;
this.vertexPositions[6] = positiontexturevertex6;
this.vertexPositions[7] = positiontexturevertex7;
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex5, positiontexturevertex1, positiontexturevertex2, positiontexturevertex6 }, par2 + par9 + par7, par3
+ par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex, positiontexturevertex4, positiontexturevertex7, positiontexturevertex3 }, par2, par3 + par9, par2
+ par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1 }, par2 + par9, par3, par2
+ par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex2, positiontexturevertex3, positiontexturevertex7, positiontexturevertex6 }, par2 + par9 + par7, par3
+ par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex1, positiontexturevertex, positiontexturevertex3, positiontexturevertex2 }, par2 + par9, par3 + par9,
par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex4, positiontexturevertex5, positiontexturevertex6, positiontexturevertex7 }, par2 + par9 + par7 + par9,
par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
if (par1ModelRenderer.mirror)
{
for (int j1 = 0; j1 < this.quadList.length; ++j1)
{
this.quadList[j1].flipFace();
}
}
}
/**
* Draw the six sided box defined by this ModelBox
*/
@SideOnly(Side.CLIENT)
public void render (Tessellator par1Tessellator, float par2)
{
for (int i = 0; i < this.quadList.length; ++i)
{
this.quadList[i].draw(par1Tessellator, par2);
}
}
public ModelBoxDegrees func_78244_a (String par1Str)
{
this.field_78247_g = par1Str;
return this;
}
}
@@ -0,0 +1,208 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
public class ModelMiniGardy extends ModelBase
{
ModelRendererDegrees body;
ModelRendererDegrees torso;
ModelRendererDegrees head;
ModelRendererDegrees rightArm;
ModelRendererDegrees rightHand;
ModelRendererDegrees leftArm;
ModelRendererDegrees leftHand;
ModelRendererDegrees hairTop;
ModelRendererDegrees hairRight;
ModelRendererDegrees lockLeft;
ModelRendererDegrees lockRight;
ModelRendererDegrees hairLeft;
ModelRendererDegrees hairBack;
ModelRendererDegrees hairFront;
ModelRendererDegrees hairTopFront;
ModelRendererDegrees hairTopBack;
ModelRendererDegrees lockInsideRight;
ModelRendererDegrees lockInsideLeft;
public ModelMiniGardy()
{
body = new ModelRendererDegrees(this, 0, 0);
body.addBox(-3F, 0F, -3F, 6, 6, 6);
body.setRotationPoint(0F, 18F, 0F);
body.mirror = true;
setRotation(body, 0F, 0F, 0F);
torso = new ModelRendererDegrees(this, 16, 12);
torso.addBox(-1F, -5F, -1F, 2, 5, 2);
torso.setRotationPoint(0F, 0F, 0F);
torso.mirror = true;
setRotation(torso, 0F, 0F, 0F);
body.addChild(torso);
rightArm = new ModelRendererDegrees(this, 24, 0);
rightArm.addBox(-1F, -1F, -1F, 2, 4, 2);
rightArm.setRotationPoint(-2F, -3F, 0F);
rightArm.mirror = true;
setRotation(rightArm, 0F, 0F, 15F);//convertDegrees(30.0f));//0.2617994F);
torso.addChild(rightArm);
rightHand = new ModelRendererDegrees(this, 24, 6);
rightHand.addBox(-1F, 0F, -2F, 2, 4, 2);
rightHand.setRotationPoint(0F, 3F, 1F);
rightHand.setTextureSize(64, 32);
rightHand.mirror = true;
setRotation(rightHand, 0F, 0F, 0F);
rightArm.addChild(rightHand);
leftArm = new ModelRendererDegrees(this, 32, 0);
leftArm.addBox(-1F, -1F, -1F, 2, 4, 2);
leftArm.setRotationPoint(2F, -3F, 0F);
leftArm.mirror = true;
setRotation(leftArm, 0F, 0F, -15F);
torso.addChild(leftArm);
leftHand = new ModelRendererDegrees(this, 32, 6);
leftHand.addBox(-1F, 0F, -2F, 2, 4, 2);
leftHand.setRotationPoint(0F, 3F, 1F);
leftHand.mirror = true;
setRotation(leftHand, 0F, 0F, 0F);
leftArm.addChild(leftHand);
//Head
head = new ModelRendererDegrees(this, 0, 12);
head.addBox(-2F, -4F, -2F, 4, 4, 4);
head.setRotationPoint(0F, -5F, 0F);
head.mirror = true;
setRotation(head, 0F, 0F, 0F);
torso.addChild(head);
hairTop = new ModelRendererDegrees(this, 40, 2);
hairTop.addBox(-3F, 0F, -2F, 6, 1, 4);
hairTop.setRotationPoint(0F, -5F, 0F);
hairTop.mirror = true;
setRotation(hairTop, 0F, 0F, 0F);
head.addChild(hairTop);
hairRight = new ModelRendererDegrees(this, 40, 7);
hairRight.addBox(0F, 0F, 0F, 2, 5, 4);
hairRight.setRotationPoint(-3F, -4F, -1F);
hairRight.mirror = true;
setRotation(hairRight, 0F, 0F, 0F);
head.addChild(hairRight);
lockLeft = new ModelRendererDegrees(this, 46, 19);
lockLeft.addBox(0F, 0F, 0F, 1, 2, 2);
lockLeft.setRotationPoint(2F, -1F, -3F);
lockLeft.mirror = true;
setRotation(lockLeft, 0F, 0F, 0F);
head.addChild(lockLeft);
lockRight = new ModelRendererDegrees(this, 40, 19);
lockRight.addBox(-1F, 0F, 0F, 1, 2, 2);
lockRight.setRotationPoint(-2F, -1F, -3F);
lockRight.mirror = true;
setRotation(lockRight, 0F, 0F, 0F);
head.addChild(lockRight);
hairLeft = new ModelRendererDegrees(this, 52, 7);
hairLeft.addBox(0F, 0F, 0F, 2, 5, 4);
hairLeft.setRotationPoint(1F, -4F, -1F);
hairLeft.mirror = true;
setRotation(hairLeft, 0F, 0F, 0F);
head.addChild(hairLeft);
hairBack = new ModelRendererDegrees(this, 56, 16);
hairBack.addBox(-1F, 0F, 0F, 2, 4, 1);
hairBack.setRotationPoint(0F, -4F, 2F);
hairBack.mirror = true;
setRotation(hairBack, 0F, 0F, 0F);
head.addChild(hairBack);
hairFront = new ModelRendererDegrees(this, 40, 16);
hairFront.addBox(0F, 0F, 0F, 6, 1, 2);
hairFront.setRotationPoint(-3F, -4F, -3F);
hairFront.mirror = true;
setRotation(hairFront, 0F, 0F, 0F);
head.addChild(hairFront);
hairTopFront = new ModelRendererDegrees(this, 50, 0);
hairTopFront.addBox(0F, 0F, 0F, 4, 1, 1);
hairTopFront.setRotationPoint(-2F, -5F, -3F);
hairTopFront.mirror = true;
setRotation(hairTopFront, 0F, 0F, 0F);
head.addChild(hairTopFront);
hairTopBack = new ModelRendererDegrees(this, 40, 0);
hairTopBack.addBox(0F, 0F, 0F, 4, 1, 1);
hairTopBack.setRotationPoint(-2F, -5F, 2F);
hairTopBack.mirror = true;
setRotation(hairTopBack, 0F, 0F, 0F);
head.addChild(hairTopBack);
lockInsideRight = new ModelRendererDegrees(this, 40, 23);
lockInsideRight.addBox(0F, 0F, 0F, 1, 1, 2);
lockInsideRight.setRotationPoint(-2F, 0F, -3F);
lockInsideRight.mirror = true;
setRotation(lockInsideRight, 0F, 0F, 0F);
head.addChild(lockInsideRight);
lockInsideLeft = new ModelRendererDegrees(this, 46, 23);
lockInsideLeft.addBox(-1F, 0F, 0F, 1, 1, 2);
lockInsideLeft.setRotationPoint(2F, 0F, -3F);
lockInsideLeft.mirror = true;
setRotation(lockInsideLeft, 0F, 0F, 0F);
head.addChild(lockInsideLeft);
}
@Override
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);
body.render(f5);
}
private void setRotation (ModelRendererDegrees model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
private float convertDegrees (float f)
{
return f * ((float) Math.PI / 180F);
}
private float convertRadians (float f)
{
return f * (180F / (float) Math.PI);
}
@Override
public void setRotationAngles (float limbSwing, float limbDelta, float ticksExisted, float rotation, float rotationDelta, float par6, Entity entity)
{
float bodyRotation = convertRadians(MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbDelta * 0.5F);
this.rightArm.rotateAngleX = bodyRotation;
this.leftArm.rotateAngleX = -bodyRotation;
this.torso.rotateAngleY = bodyRotation / 2;
this.head.rotateAngleY = rotation - bodyRotation / 2;
this.head.rotateAngleX = rotationDelta;
if (bodyRotation <= 0)
{
this.rightHand.rotateAngleX = bodyRotation;
}
if (-bodyRotation <= 0)
{
this.leftHand.rotateAngleX = -bodyRotation;
}
this.rightArm.rotateAngleZ = 15F;
this.leftArm.rotateAngleZ = -15F;
this.torso.rotationPointY = 0F;
this.rightArm.rotateAngleZ += convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.05F + 0.05F);
this.leftArm.rotateAngleZ -= convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.05F + 0.05F);
this.torso.rotationPointY += convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.01F + 0.01F);
}
}
+281
View File
@@ -0,0 +1,281 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelPullcart extends ModelBase
{
ModelRenderer BackPanel;
ModelRenderer FrontPanel;
ModelRenderer RightPanel;
ModelRenderer LeftPanel;
ModelRenderer BottomPanel;
ModelRenderer RightHandle;
ModelRenderer LeftHandle;
ModelRenderer RightSpokeUp;
ModelRenderer RightSpokeRight;
ModelRenderer RightSpokeDown;
ModelRenderer RightSpokeLeft;
ModelRenderer RightAxle;
ModelRenderer WheelRight1;
ModelRenderer WheelRight2;
ModelRenderer WheelRight3;
ModelRenderer WheelRight4;
ModelRenderer WheelRight5;
ModelRenderer WheelRight6;
ModelRenderer WheelRight7;
ModelRenderer WheelRight8;
ModelRenderer WheelRight9;
ModelRenderer WheelRight10;
ModelRenderer WheelRight11;
ModelRenderer WheelRight12;
ModelRenderer LeftSpokeRight;
ModelRenderer LeftSpokeLeft;
ModelRenderer LeftSpokeDown;
ModelRenderer LeftSpokeUp;
ModelRenderer LeftAxle;
ModelRenderer WheelLeft1;
ModelRenderer WheelLeft2;
ModelRenderer WheelLeft3;
ModelRenderer WheelLeft4;
ModelRenderer WheelLeft5;
ModelRenderer WheelLeft6;
ModelRenderer WheelLeft7;
ModelRenderer WheelLeft8;
ModelRenderer WheelLeft9;
ModelRenderer WheelLeft10;
ModelRenderer WheelLeft11;
ModelRenderer WheelLeft12;
public ModelPullcart()
{
textureWidth = 128;
textureHeight = 64;
BackPanel = new ModelRenderer(this, 0, 12);
BackPanel.addBox(-10F, 0F, 0F, 20, 10, 2);
BackPanel.setRotationPoint(0F, -8F, 8F);
setRotation(BackPanel, 0F, 0F, 0F);
FrontPanel = new ModelRenderer(this, 0, 0);
FrontPanel.addBox(-10F, 0F, 0F, 20, 10, 2);
FrontPanel.setRotationPoint(0F, -8F, -10F);
setRotation(FrontPanel, 0F, 0F, 0F);
RightPanel = new ModelRenderer(this, 0, 35);
RightPanel.addBox(0F, 0F, -10F, 2, 8, 20);
RightPanel.setRotationPoint(-12F, -6F, 0F);
setRotation(RightPanel, 0F, 0F, 0F);
LeftPanel = new ModelRenderer(this, 24, 15);
LeftPanel.addBox(0F, 0F, -10F, 2, 8, 20);
LeftPanel.setRotationPoint(10F, -6F, 0F);
setRotation(LeftPanel, 0F, 0F, 0F);
BottomPanel = new ModelRenderer(this, 40, 43);
BottomPanel.addBox(-12F, 0F, -10F, 24, 1, 20);
BottomPanel.setRotationPoint(0F, 2F, 0F);
setRotation(BottomPanel, 0F, 0F, 0F);
RightHandle = new ModelRenderer(this, 92, 33);
RightHandle.addBox(0F, 0F, 0F, 16, 2, 2);
RightHandle.setRotationPoint(-28F, 0F, -7F);
setRotation(RightHandle, 0F, 0F, 0F);
LeftHandle = new ModelRenderer(this, 92, 38);
LeftHandle.addBox(0F, 0F, 0F, 16, 2, 2);
LeftHandle.setRotationPoint(-28F, 0F, 5F);
setRotation(LeftHandle, 0F, 0F, 0F);
RightSpokeUp = new ModelRenderer(this, 99, 3);
RightSpokeUp.addBox(-2F, -8F, 0F, 4, 6, 1);
RightSpokeUp.setRotationPoint(0F, 3F, -11F);
setRotation(RightSpokeUp, 0F, 0F, 0F);
RightSpokeRight = new ModelRenderer(this, 112, 15);
RightSpokeRight.addBox(2F, -2F, 0F, 6, 4, 1);
RightSpokeRight.setRotationPoint(0F, 3F, -11F);
setRotation(RightSpokeRight, 0F, 0F, 0F);
RightSpokeDown = new ModelRenderer(this, 99, 25);
RightSpokeDown.addBox(-2F, 2F, 0F, 4, 6, 1);
RightSpokeDown.setRotationPoint(0F, 3F, -11F);
setRotation(RightSpokeDown, 0F, 0F, 0F);
RightSpokeLeft = new ModelRenderer(this, 82, 15);
RightSpokeLeft.addBox(-8F, -2F, 0F, 6, 4, 1);
RightSpokeLeft.setRotationPoint(0F, 3F, -11F);
setRotation(RightSpokeLeft, 0F, 0F, 0F);
RightAxle = new ModelRenderer(this, 98, 14);
RightAxle.addBox(-2F, -2F, 0F, 4, 4, 2);
RightAxle.setRotationPoint(0F, 3F, -12F);
setRotation(RightAxle, 0F, 0F, 0F);
WheelRight1 = new ModelRenderer(this, 110, 3);
WheelRight1.addBox(2F, -7F, 0F, 2, 2, 1);
WheelRight1.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight1, 0F, 0F, 0F);
WheelRight2 = new ModelRenderer(this, 117, 5);
WheelRight2.addBox(4F, -6F, 0F, 2, 2, 1);
WheelRight2.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight2, 0F, 0F, 0F);
WheelRight3 = new ModelRenderer(this, 122, 9);
WheelRight3.addBox(5F, -4F, 0F, 2, 2, 1);
WheelRight3.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight3, 0F, 0F, 0F);
WheelRight4 = new ModelRenderer(this, 122, 23);
WheelRight4.addBox(5F, 2F, 0F, 2, 2, 1);
WheelRight4.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight4, 0F, 0F, 0F);
WheelRight5 = new ModelRenderer(this, 117, 27);
WheelRight5.addBox(4F, 4F, 0F, 2, 2, 1);
WheelRight5.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight5, 0F, 0F, 0F);
WheelRight6 = new ModelRenderer(this, 110, 29);
WheelRight6.addBox(2F, 5F, 0F, 2, 2, 1);
WheelRight6.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight6, 0F, 0F, 0F);
WheelRight7 = new ModelRenderer(this, 92, 29);
WheelRight7.addBox(-4F, 5F, 0F, 2, 2, 1);
WheelRight7.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight7, 0F, 0F, 0F);
WheelRight8 = new ModelRenderer(this, 85, 27);
WheelRight8.addBox(-6F, 4F, 0F, 2, 2, 1);
WheelRight8.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight8, 0F, 0F, 0F);
WheelRight9 = new ModelRenderer(this, 80, 23);
WheelRight9.addBox(-7F, 2F, 0F, 2, 2, 1);
WheelRight9.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight9, 0F, 0F, 0F);
WheelRight10 = new ModelRenderer(this, 80, 9);
WheelRight10.addBox(-7F, -4F, 0F, 2, 2, 1);
WheelRight10.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight10, 0F, 0F, 0F);
WheelRight11 = new ModelRenderer(this, 85, 5);
WheelRight11.addBox(-6F, -6F, 0F, 2, 2, 1);
WheelRight11.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight11, 0F, 0F, 0F);
WheelRight12 = new ModelRenderer(this, 92, 3);
WheelRight12.addBox(-4F, -7F, 0F, 2, 2, 1);
WheelRight12.setRotationPoint(0F, 3F, -11F);
setRotation(WheelRight12, 0F, 0F, 0F);
LeftSpokeRight = new ModelRenderer(this, 82, 15);
LeftSpokeRight.addBox(-8F, -2F, 0F, 6, 4, 1);
LeftSpokeRight.setRotationPoint(0F, 3F, 10F);
setRotation(LeftSpokeRight, 0F, 0F, 0F);
LeftSpokeLeft = new ModelRenderer(this, 112, 15);
LeftSpokeLeft.addBox(2F, -2F, 0F, 6, 4, 1);
LeftSpokeLeft.setRotationPoint(0F, 3F, 10F);
setRotation(LeftSpokeLeft, 0F, 0F, 0F);
LeftSpokeDown = new ModelRenderer(this, 99, 25);
LeftSpokeDown.addBox(-2F, 2F, 0F, 4, 6, 1);
LeftSpokeDown.setRotationPoint(0F, 3F, 10F);
setRotation(LeftSpokeDown, 0F, 0F, 0F);
LeftSpokeUp = new ModelRenderer(this, 99, 3);
LeftSpokeUp.addBox(-2F, -8F, 0F, 4, 6, 1);
LeftSpokeUp.setRotationPoint(0F, 3F, 10F);
setRotation(LeftSpokeUp, 0F, 0F, 0F);
LeftAxle = new ModelRenderer(this, 98, 14);
LeftAxle.addBox(-2F, -2F, 0F, 4, 4, 2);
LeftAxle.setRotationPoint(0F, 3F, 10F);
setRotation(LeftAxle, 0F, 0F, 0F);
WheelLeft1 = new ModelRenderer(this, 92, 3);
WheelLeft1.addBox(-4F, -7F, 0F, 2, 2, 1);
WheelLeft1.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft1, 0F, 0F, 0F);
WheelLeft2 = new ModelRenderer(this, 117, 5);
WheelLeft2.addBox(-6F, -6F, 0F, 2, 2, 1);
WheelLeft2.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft2, 0F, 0F, 0F);
WheelLeft3 = new ModelRenderer(this, 80, 9);
WheelLeft3.addBox(-7F, -4F, 0F, 2, 2, 1);
WheelLeft3.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft3, 0F, 0F, 0F);
WheelLeft4 = new ModelRenderer(this, 80, 23);
WheelLeft4.addBox(-7F, 2F, 0F, 2, 2, 1);
WheelLeft4.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft4, 0F, 0F, 0F);
WheelLeft5 = new ModelRenderer(this, 117, 27);
WheelLeft5.addBox(-6F, 4F, 0F, 2, 2, 1);
WheelLeft5.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft5, 0F, 0F, 0F);
WheelLeft6 = new ModelRenderer(this, 110, 29);
WheelLeft6.addBox(-4F, 5F, 0F, 2, 2, 1);
WheelLeft6.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft6, 0F, 0F, 0F);
WheelLeft7 = new ModelRenderer(this, 92, 29);
WheelLeft7.addBox(2F, 5F, 0F, 2, 2, 1);
WheelLeft7.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft7, 0F, 0F, 0F);
WheelLeft8 = new ModelRenderer(this, 85, 27);
WheelLeft8.addBox(4F, 4F, 0F, 2, 2, 1);
WheelLeft8.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft8, 0F, 0F, 0F);
WheelLeft9 = new ModelRenderer(this, 122, 23);
WheelLeft9.addBox(5F, 2F, 0F, 2, 2, 1);
WheelLeft9.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft9, 0F, 0F, 0F);
WheelLeft10 = new ModelRenderer(this, 122, 9);
WheelLeft10.addBox(5F, -4F, 0F, 2, 2, 1);
WheelLeft10.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft10, 0F, 0F, 0F);
WheelLeft11 = new ModelRenderer(this, 85, 5);
WheelLeft11.addBox(4F, -6F, 0F, 2, 2, 1);
WheelLeft11.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft11, 0F, 0F, 0F);
WheelLeft12 = new ModelRenderer(this, 110, 3);
WheelLeft12.addBox(2F, -7F, 0F, 2, 2, 1);
WheelLeft12.setRotationPoint(0F, 3F, 10F);
setRotation(WheelLeft12, 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);
BackPanel.render(f5);
FrontPanel.render(f5);
RightPanel.render(f5);
LeftPanel.render(f5);
BottomPanel.render(f5);
RightHandle.render(f5);
LeftHandle.render(f5);
RightSpokeUp.render(f5);
RightSpokeRight.render(f5);
RightSpokeDown.render(f5);
RightSpokeLeft.render(f5);
RightAxle.render(f5);
WheelRight1.render(f5);
WheelRight2.render(f5);
WheelRight3.render(f5);
WheelRight4.render(f5);
WheelRight5.render(f5);
WheelRight6.render(f5);
WheelRight7.render(f5);
WheelRight8.render(f5);
WheelRight9.render(f5);
WheelRight10.render(f5);
WheelRight11.render(f5);
WheelRight12.render(f5);
LeftSpokeRight.render(f5);
LeftSpokeLeft.render(f5);
LeftSpokeDown.render(f5);
LeftSpokeUp.render(f5);
LeftAxle.render(f5);
WheelLeft1.render(f5);
WheelLeft2.render(f5);
WheelLeft3.render(f5);
WheelLeft4.render(f5);
WheelLeft5.render(f5);
WheelLeft6.render(f5);
WheelLeft7.render(f5);
WheelLeft8.render(f5);
WheelLeft9.render(f5);
WheelLeft10.render(f5);
WheelLeft11.render(f5);
WheelLeft12.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,321 @@
package tconstruct.client.entity;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.TextureOffset;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ModelRendererDegrees
{
/** The size of the texture file's width in pixels. */
public float textureWidth;
/** The size of the texture file's height in pixels. */
public float textureHeight;
/** The X offset into the texture used for displaying this model */
private int textureOffsetX;
/** The Y offset into the texture used for displaying this model */
private int textureOffsetY;
public float rotationPointX;
public float rotationPointY;
public float rotationPointZ;
public float rotateAngleX;
public float rotateAngleY;
public float rotateAngleZ;
private boolean compiled;
/** The GL display list rendered by the Tessellator for this model */
private int displayList;
public boolean mirror;
public boolean showModel;
/** Hides the model. */
public boolean isHidden;
public List cubeList;
public List childModels;
public final String boxName;
private ModelBase baseModel;
public float field_82906_o;
public float field_82908_p;
public float field_82907_q;
public ModelRendererDegrees(ModelBase par1ModelBase, String par2Str)
{
this.textureWidth = 64.0F;
this.textureHeight = 32.0F;
this.compiled = false;
this.displayList = 0;
this.mirror = false;
this.showModel = true;
this.isHidden = false;
this.cubeList = new ArrayList();
this.baseModel = par1ModelBase;
par1ModelBase.boxList.add(this);
this.boxName = par2Str;
this.setTextureSize(par1ModelBase.textureWidth, par1ModelBase.textureHeight);
}
public ModelRendererDegrees(ModelBase par1ModelBase)
{
this(par1ModelBase, (String) null);
}
public ModelRendererDegrees(ModelBase par1ModelBase, int par2, int par3)
{
this(par1ModelBase);
this.setTextureOffset(par2, par3);
}
/**
* Sets the current box's rotation points and rotation angles to another box.
*/
public void addChild (ModelRendererDegrees par1ModelRenderer)
{
if (this.childModels == null)
{
this.childModels = new ArrayList();
}
this.childModels.add(par1ModelRenderer);
}
public ModelRendererDegrees setTextureOffset (int par1, int par2)
{
this.textureOffsetX = par1;
this.textureOffsetY = par2;
return this;
}
public ModelRendererDegrees addBox (String par1Str, float par2, float par3, float par4, int par5, int par6, int par7)
{
par1Str = this.boxName + "." + par1Str;
TextureOffset textureoffset = this.baseModel.getTextureOffset(par1Str);
this.setTextureOffset(textureoffset.textureOffsetX, textureoffset.textureOffsetY);
this.cubeList.add((new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, par6, par7, 0.0F)).func_78244_a(par1Str));
return this;
}
public ModelRendererDegrees addBox (float par1, float par2, float par3, int par4, int par5, int par6)
{
this.cubeList.add(new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, 0.0F));
return this;
}
/**
* Creates a textured box. Args: originX, originY, originZ, width, height, depth, scaleFactor.
*/
public void addBox (float par1, float par2, float par3, int par4, int par5, int par6, float par7)
{
this.cubeList.add(new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, par7));
}
public void setRotationPoint (float par1, float par2, float par3)
{
this.rotationPointX = par1;
this.rotationPointY = par2;
this.rotationPointZ = par3;
}
@SideOnly(Side.CLIENT)
public void render (float par1)
{
if (!this.isHidden)
{
if (this.showModel)
{
if (!this.compiled)
{
this.compileDisplayList(par1);
}
GL11.glTranslatef(this.field_82906_o, this.field_82908_p, this.field_82907_q);
int i;
if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F)
{
if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F)
{
GL11.glCallList(this.displayList);
if (this.childModels != null)
{
for (i = 0; i < this.childModels.size(); ++i)
{
((ModelRendererDegrees) this.childModels.get(i)).render(par1);
}
}
}
else
{
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
GL11.glCallList(this.displayList);
if (this.childModels != null)
{
for (i = 0; i < this.childModels.size(); ++i)
{
((ModelRendererDegrees) this.childModels.get(i)).render(par1);
}
}
GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1, -this.rotationPointZ * par1);
}
}
else
{
GL11.glPushMatrix();
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
if (this.rotateAngleZ != 0.0F)
{
GL11.glRotatef(this.rotateAngleZ, 0.0F, 0.0F, 1.0F);
}
if (this.rotateAngleY != 0.0F)
{
GL11.glRotatef(this.rotateAngleY, 0.0F, 1.0F, 0.0F);
}
if (this.rotateAngleX != 0.0F)
{
GL11.glRotatef(this.rotateAngleX, 1.0F, 0.0F, 0.0F);
}
GL11.glCallList(this.displayList);
if (this.childModels != null)
{
for (i = 0; i < this.childModels.size(); ++i)
{
((ModelRendererDegrees) this.childModels.get(i)).render(par1);
}
}
GL11.glPopMatrix();
}
GL11.glTranslatef(-this.field_82906_o, -this.field_82908_p, -this.field_82907_q);
}
}
}
@SideOnly(Side.CLIENT)
public void renderWithRotation (float par1)
{
if (!this.isHidden)
{
if (this.showModel)
{
if (!this.compiled)
{
this.compileDisplayList(par1);
}
GL11.glPushMatrix();
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
if (this.rotateAngleY != 0.0F)
{
GL11.glRotatef(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (this.rotateAngleX != 0.0F)
{
GL11.glRotatef(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
if (this.rotateAngleZ != 0.0F)
{
GL11.glRotatef(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
GL11.glCallList(this.displayList);
GL11.glPopMatrix();
}
}
}
/**
* Allows the changing of Angles after a box has been rendered
*/
@SideOnly(Side.CLIENT)
public void postRender (float par1)
{
if (!this.isHidden)
{
if (this.showModel)
{
if (!this.compiled)
{
this.compileDisplayList(par1);
}
if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F)
{
if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F)
{
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
}
}
else
{
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
if (this.rotateAngleZ != 0.0F)
{
GL11.glRotatef(this.rotateAngleZ, 0.0F, 0.0F, 1.0F);
}
if (this.rotateAngleY != 0.0F)
{
GL11.glRotatef(this.rotateAngleY, 0.0F, 1.0F, 0.0F);
}
if (this.rotateAngleX != 0.0F)
{
GL11.glRotatef(this.rotateAngleX, 1.0F, 0.0F, 0.0F);
}
}
}
}
}
/**
* Compiles a GL display list for this model
*/
@SideOnly(Side.CLIENT)
private void compileDisplayList (float par1)
{
this.displayList = GLAllocation.generateDisplayLists(1);
GL11.glNewList(this.displayList, GL11.GL_COMPILE);
Tessellator tessellator = Tessellator.instance;
for (int i = 0; i < this.cubeList.size(); ++i)
{
((ModelBoxDegrees) this.cubeList.get(i)).render(tessellator, par1);
}
GL11.glEndList();
this.compiled = true;
}
/**
* Returns the model renderer with the new texture parameters.
*/
public ModelRendererDegrees setTextureSize (int par1, int par2)
{
this.textureWidth = (float) par1;
this.textureHeight = (float) par2;
return this;
}
}
+458
View File
@@ -0,0 +1,458 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelWagon extends ModelBase
{
ModelRenderer Bottom;
ModelRenderer Left;
ModelRenderer Right;
ModelRenderer Back;
ModelRenderer Front;
ModelRenderer Leftpull;
ModelRenderer Rightpull;
ModelRenderer LeftWheelAxle;
ModelRenderer LeftWCenterHbeam;
ModelRenderer LeftWCenterVtop;
ModelRenderer LeftWCenterVbottom;
ModelRenderer LeftWnwH;
ModelRenderer LeftWnwM;
ModelRenderer LeftWnwV;
ModelRenderer LeftWnwEye;
ModelRenderer LeftWneH;
ModelRenderer LeftWneM;
ModelRenderer LeftWneV;
ModelRenderer LeftWneEye;
ModelRenderer LeftWswH;
ModelRenderer LeftWswM;
ModelRenderer LeftWswV;
ModelRenderer LeftWswEye;
ModelRenderer LeftWseH;
ModelRenderer LeftWseM;
ModelRenderer LeftWseV;
ModelRenderer LeftWseEye;
ModelRenderer RightWheelAxle;
ModelRenderer RightWCenterHbeam;
ModelRenderer RightWCenterVtop;
ModelRenderer RightWCenterVbottom;
ModelRenderer RightWnwH;
ModelRenderer RightWnwM;
ModelRenderer RightWnwV;
ModelRenderer RightWnwEye;
ModelRenderer RoghtWneH;
ModelRenderer RightWneM;
ModelRenderer RightWneV;
ModelRenderer RightWneEye;
ModelRenderer RightWswH;
ModelRenderer RightWswM;
ModelRenderer RightWswV;
ModelRenderer RightWswEye;
ModelRenderer RightWseH;
ModelRenderer RightWseM;
ModelRenderer RightWseV;
public ModelRenderer RightWseEye;
ModelRenderer HandBrakeMain;
ModelRenderer HandbrakeJamb;
ModelRenderer StandCenterBar;
ModelRenderer StandLeft;
ModelRenderer StandRight;
public ModelWagon()
{
this.textureWidth = 128;
this.textureHeight = 64;
this.Bottom = new ModelRenderer(this, 26, 46);
this.Bottom.addBox(0.0F, 0.0F, 0.0F, 20, 2, 16);
this.Bottom.setRotationPoint(-10.0F, 4.0F, -8.0F);
this.Bottom.setTextureSize(64, 32);
this.Bottom.mirror = true;
this.setRotation(this.Bottom, 0.0F, 0.0F, 0.0F);
this.Left = new ModelRenderer(this, 0, 35);
this.Left.addBox(0.0F, 0.0F, 0.0F, 20, 8, 2);
this.Left.setRotationPoint(-10.0F, -4.0F, -8.0F);
this.Left.setTextureSize(64, 32);
this.Left.mirror = true;
this.setRotation(this.Left, 0.0F, 0.0F, 0.0F);
this.Right = new ModelRenderer(this, 83, 35);
this.Right.addBox(0.0F, 0.0F, 0.0F, 20, 8, 2);
this.Right.setRotationPoint(-10.0F, -4.0F, 6.0F);
this.Right.setTextureSize(64, 32);
this.Right.mirror = true;
this.setRotation(this.Right, 0.0F, 0.0F, 0.0F);
this.Back = new ModelRenderer(this, 99, 46);
this.Back.addBox(-2.0F, -5.0F, 0.0F, 2, 5, 12);
this.Back.setRotationPoint(10.0F, 4.0F, -6.0F);
this.Back.setTextureSize(64, 32);
this.Back.mirror = true;
this.setRotation(this.Back, 0.0F, 0.0F, 0.0F);
this.Front = new ModelRenderer(this, 50, 1);
this.Front.addBox(0.0F, 0.0F, 0.0F, 2, 8, 12);
this.Front.setRotationPoint(-10.0F, -4.0F, -6.0F);
this.Front.setTextureSize(64, 32);
this.Front.mirror = true;
this.setRotation(this.Front, 0.0F, 0.0F, 0.0F);
this.Leftpull = new ModelRenderer(this, 0, 30);
this.Leftpull.addBox(0.0F, 0.0F, 0.0F, 16, 2, 2);
this.Leftpull.setRotationPoint(-26.0F, 2.0F, -6.0F);
this.Leftpull.setTextureSize(64, 32);
this.Leftpull.mirror = true;
this.setRotation(this.Leftpull, 0.0F, 0.0F, 0.0F);
this.Rightpull = new ModelRenderer(this, 91, 30);
this.Rightpull.addBox(0.0F, 0.0F, 0.0F, 16, 2, 2);
this.Rightpull.setRotationPoint(-26.0F, 2.0F, 4.0F);
this.Rightpull.setTextureSize(64, 32);
this.Rightpull.mirror = true;
this.setRotation(this.Rightpull, 0.0F, 0.0F, 0.0F);
this.HandBrakeMain = new ModelRenderer(this, 1, 59);
this.HandBrakeMain.addBox(-6.0F, 0.0F, 0.0F, 11, 1, 1);
this.HandBrakeMain.setRotationPoint(-9.0F, -3.0F, -9.0F);
this.HandBrakeMain.setTextureSize(64, 32);
this.HandBrakeMain.mirror = true;
this.setRotation(this.HandBrakeMain, 0.0F, 0.0F, 0.0F);
this.HandbrakeJamb = new ModelRenderer(this, 10, 62);
this.HandbrakeJamb.addBox(3.0F, 1.0F, 0.0F, 2, 1, 1);
this.HandbrakeJamb.setRotationPoint(-9.0F, -3.0F, -9.0F);
this.HandbrakeJamb.setTextureSize(64, 32);
this.HandbrakeJamb.mirror = true;
this.setRotation(this.HandbrakeJamb, 0.0F, 0.0F, 0.0F);
this.LeftWheelAxle = new ModelRenderer(this, 0, 12);
this.LeftWheelAxle.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 3);
this.LeftWheelAxle.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWheelAxle.setTextureSize(64, 32);
this.LeftWheelAxle.mirror = true;
this.setRotation(this.LeftWheelAxle, 0.0F, 0.0F, 0.0F);
this.LeftWCenterHbeam = new ModelRenderer(this, 12, 12);
this.LeftWCenterHbeam.addBox(-8.0F, -2.0F, 0.0F, 16, 4, 1);
this.LeftWCenterHbeam.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWCenterHbeam.setTextureSize(64, 32);
this.LeftWCenterHbeam.mirror = true;
this.setRotation(this.LeftWCenterHbeam, 0.0F, 0.0F, 0.0F);
this.LeftWCenterVtop = new ModelRenderer(this, 18, 0);
this.LeftWCenterVtop.addBox(-2.0F, -8.0F, 0.0F, 4, 6, 1);
this.LeftWCenterVtop.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWCenterVtop.setTextureSize(64, 32);
this.LeftWCenterVtop.mirror = true;
this.setRotation(this.LeftWCenterVtop, 0.0F, 0.0F, 0.0F);
this.LeftWCenterVbottom = new ModelRenderer(this, 18, 22);
this.LeftWCenterVbottom.addBox(-2.0F, 2.0F, 0.0F, 4, 6, 1);
this.LeftWCenterVbottom.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWCenterVbottom.setTextureSize(64, 32);
this.LeftWCenterVbottom.mirror = true;
this.setRotation(this.LeftWCenterVbottom, 0.0F, 0.0F, 0.0F);
this.LeftWnwH = new ModelRenderer(this, 0, 7);
this.LeftWnwH.addBox(-7.0F, -4.0F, 0.0F, 3, 2, 1);
this.LeftWnwH.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWnwH.setTextureSize(64, 32);
this.LeftWnwH.mirror = true;
this.setRotation(this.LeftWnwH, 0.0F, 0.0F, 0.0F);
this.LeftWnwM = new ModelRenderer(this, 4, 3);
this.LeftWnwM.addBox(-6.0F, -6.0F, 0.0F, 2, 2, 1);
this.LeftWnwM.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWnwM.setTextureSize(64, 32);
this.LeftWnwM.mirror = true;
this.setRotation(this.LeftWnwM, 0.0F, 0.0F, 0.0F);
this.LeftWnwV = new ModelRenderer(this, 11, 1);
this.LeftWnwV.addBox(-4.0F, -7.0F, 0.0F, 2, 3, 1);
this.LeftWnwV.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWnwV.setTextureSize(64, 32);
this.LeftWnwV.mirror = true;
this.setRotation(this.LeftWnwV, 0.0F, 0.0F, 0.0F);
this.LeftWnwEye = new ModelRenderer(this, 10, 7);
this.LeftWnwEye.addBox(-4.0F, -4.0F, 0.0F, 1, 1, 1);
this.LeftWnwEye.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWnwEye.setTextureSize(64, 32);
this.LeftWnwEye.mirror = true;
this.setRotation(this.LeftWnwEye, 0.0F, 0.0F, 0.0F);
this.LeftWneH = new ModelRenderer(this, 40, 7);
this.LeftWneH.addBox(4.0F, -4.0F, 0.0F, 3, 2, 1);
this.LeftWneH.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWneH.setTextureSize(64, 32);
this.LeftWneH.mirror = true;
this.setRotation(this.LeftWneH, 0.0F, 0.0F, 0.0F);
this.LeftWneM = new ModelRenderer(this, 37, 3);
this.LeftWneM.addBox(4.0F, -6.0F, 0.0F, 2, 2, 1);
this.LeftWneM.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWneM.setTextureSize(64, 32);
this.LeftWneM.mirror = true;
this.setRotation(this.LeftWneM, 0.0F, 0.0F, 0.0F);
this.LeftWneV = new ModelRenderer(this, 29, 1);
this.LeftWneV.addBox(2.0F, -7.0F, 0.0F, 2, 3, 1);
this.LeftWneV.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWneV.setTextureSize(64, 32);
this.LeftWneV.mirror = true;
this.setRotation(this.LeftWneV, 0.0F, 0.0F, 0.0F);
this.LeftWneEye = new ModelRenderer(this, 33, 7);
this.LeftWneEye.addBox(3.0F, -4.0F, 0.0F, 1, 1, 1);
this.LeftWneEye.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWneEye.setTextureSize(64, 32);
this.LeftWneEye.mirror = true;
this.setRotation(this.LeftWneEye, 0.0F, 0.0F, 0.0F);
this.LeftWswH = new ModelRenderer(this, 0, 19);
this.LeftWswH.addBox(-7.0F, 2.0F, 0.0F, 3, 2, 1);
this.LeftWswH.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWswH.setTextureSize(64, 32);
this.LeftWswH.mirror = true;
this.setRotation(this.LeftWswH, 0.0F, 0.0F, 0.0F);
this.LeftWswM = new ModelRenderer(this, 4, 23);
this.LeftWswM.addBox(-6.0F, 4.0F, 0.0F, 2, 2, 1);
this.LeftWswM.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWswM.setTextureSize(64, 32);
this.LeftWswM.mirror = true;
this.setRotation(this.LeftWswM, 0.0F, 0.0F, 0.0F);
this.LeftWswV = new ModelRenderer(this, 11, 24);
this.LeftWswV.addBox(-4.0F, 4.0F, 0.0F, 2, 3, 1);
this.LeftWswV.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWswV.setTextureSize(64, 32);
this.LeftWswV.mirror = true;
this.setRotation(this.LeftWswV, 0.0F, 0.0F, 0.0F);
this.LeftWswEye = new ModelRenderer(this, 10, 20);
this.LeftWswEye.addBox(-4.0F, 3.0F, 0.0F, 1, 1, 1);
this.LeftWswEye.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWswEye.setTextureSize(64, 32);
this.LeftWswEye.mirror = true;
this.setRotation(this.LeftWswEye, 0.0F, 0.0F, 0.0F);
this.LeftWseH = new ModelRenderer(this, 40, 19);
this.LeftWseH.addBox(4.0F, 2.0F, 0.0F, 3, 2, 1);
this.LeftWseH.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWseH.setTextureSize(64, 32);
this.LeftWseH.mirror = true;
this.setRotation(this.LeftWseH, 0.0F, 0.0F, 0.0F);
this.LeftWseM = new ModelRenderer(this, 37, 23);
this.LeftWseM.addBox(4.0F, 4.0F, 0.0F, 2, 2, 1);
this.LeftWseM.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWseM.setTextureSize(64, 32);
this.LeftWseM.mirror = true;
this.setRotation(this.LeftWseM, 0.0F, 0.0F, 0.0F);
this.LeftWseV = new ModelRenderer(this, 29, 24);
this.LeftWseV.addBox(2.0F, 4.0F, 0.0F, 2, 3, 1);
this.LeftWseV.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWseV.setTextureSize(64, 32);
this.LeftWseV.mirror = true;
this.setRotation(this.LeftWseV, 0.0F, 0.0F, 0.0F);
this.LeftWseEye = new ModelRenderer(this, 33, 20);
this.LeftWseEye.addBox(3.0F, 3.0F, 0.0F, 1, 1, 1);
this.LeftWseEye.setRotationPoint(0.0F, 5.0F, -10.0F);
this.LeftWseEye.setTextureSize(64, 32);
this.LeftWseEye.mirror = true;
this.setRotation(this.LeftWseEye, 0.0F, 0.0F, 0.0F);
this.RightWheelAxle = new ModelRenderer(this, 117, 12);
this.RightWheelAxle.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 3);
this.RightWheelAxle.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWheelAxle.setTextureSize(64, 32);
this.RightWheelAxle.mirror = true;
this.setRotation(this.RightWheelAxle, 0.0F, 0.0F, 0.0F);
this.RightWCenterHbeam = new ModelRenderer(this, 80, 12);
this.RightWCenterHbeam.addBox(-8.0F, -2.0F, 0.0F, 16, 4, 1);
this.RightWCenterHbeam.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWCenterHbeam.setTextureSize(64, 32);
this.RightWCenterHbeam.mirror = true;
this.setRotation(this.RightWCenterHbeam, 0.0F, 0.0F, 0.0F);
this.RightWCenterVtop = new ModelRenderer(this, 98, 0);
this.RightWCenterVtop.addBox(-2.0F, -8.0F, 0.0F, 4, 6, 1);
this.RightWCenterVtop.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWCenterVtop.setTextureSize(64, 32);
this.RightWCenterVtop.mirror = true;
this.setRotation(this.RightWCenterVtop, 0.0F, 0.0F, 0.0F);
this.RightWCenterVbottom = new ModelRenderer(this, 98, 22);
this.RightWCenterVbottom.addBox(-2.0F, 2.0F, 0.0F, 4, 6, 1);
this.RightWCenterVbottom.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWCenterVbottom.setTextureSize(64, 32);
this.RightWCenterVbottom.mirror = true;
this.setRotation(this.RightWCenterVbottom, 0.0F, 0.0F, 0.0F);
this.RightWnwH = new ModelRenderer(this, 79, 7);
this.RightWnwH.addBox(4.0F, -4.0F, 0.0F, 3, 2, 1);
this.RightWnwH.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWnwH.setTextureSize(64, 32);
this.RightWnwH.mirror = true;
this.setRotation(this.RightWnwH, 0.0F, 0.0F, 0.0F);
this.RightWnwM = new ModelRenderer(this, 84, 3);
this.RightWnwM.addBox(4.0F, -6.0F, 0.0F, 2, 2, 1);
this.RightWnwM.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWnwM.setTextureSize(64, 32);
this.RightWnwM.mirror = true;
this.setRotation(this.RightWnwM, 0.0F, 0.0F, 0.0F);
this.RightWnwV = new ModelRenderer(this, 91, 1);
this.RightWnwV.addBox(2.0F, -7.0F, 0.0F, 2, 3, 1);
this.RightWnwV.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWnwV.setTextureSize(64, 32);
this.RightWnwV.mirror = true;
this.setRotation(this.RightWnwV, 0.0F, 0.0F, 0.0F);
this.RightWnwEye = new ModelRenderer(this, 90, 7);
this.RightWnwEye.addBox(3.0F, -4.0F, 0.0F, 1, 1, 1);
this.RightWnwEye.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWnwEye.setTextureSize(64, 32);
this.RightWnwEye.mirror = true;
this.setRotation(this.RightWnwEye, 0.0F, 0.0F, 0.0F);
this.RoghtWneH = new ModelRenderer(this, 119, 7);
this.RoghtWneH.addBox(-7.0F, -4.0F, 0.0F, 3, 2, 1);
this.RoghtWneH.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RoghtWneH.setTextureSize(64, 32);
this.RoghtWneH.mirror = true;
this.setRotation(this.RoghtWneH, 0.0F, 0.0F, 0.0F);
this.RightWneM = new ModelRenderer(this, 116, 3);
this.RightWneM.addBox(-6.0F, -6.0F, 0.0F, 2, 2, 1);
this.RightWneM.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWneM.setTextureSize(64, 32);
this.RightWneM.mirror = true;
this.setRotation(this.RightWneM, 0.0F, 0.0F, 0.0F);
this.RightWneV = new ModelRenderer(this, 109, 1);
this.RightWneV.addBox(-4.0F, -7.0F, 0.0F, 2, 3, 1);
this.RightWneV.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWneV.setTextureSize(64, 32);
this.RightWneV.mirror = true;
this.setRotation(this.RightWneV, 0.0F, 0.0F, 0.0F);
this.RightWneEye = new ModelRenderer(this, 113, 7);
this.RightWneEye.addBox(-4.0F, -4.0F, 0.0F, 1, 1, 1);
this.RightWneEye.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWneEye.setTextureSize(64, 32);
this.RightWneEye.mirror = true;
this.setRotation(this.RightWneEye, 0.0F, 0.0F, 0.0F);
this.RightWswH = new ModelRenderer(this, 79, 19);
this.RightWswH.addBox(4.0F, 2.0F, 0.0F, 3, 2, 1);
this.RightWswH.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWswH.setTextureSize(64, 32);
this.RightWswH.mirror = true;
this.setRotation(this.RightWswH, 0.0F, 0.0F, 0.0F);
this.RightWswM = new ModelRenderer(this, 84, 23);
this.RightWswM.addBox(4.0F, 4.0F, 0.0F, 2, 2, 1);
this.RightWswM.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWswM.setTextureSize(64, 32);
this.RightWswM.mirror = true;
this.setRotation(this.RightWswM, 0.0F, 0.0F, 0.0F);
this.RightWswV = new ModelRenderer(this, 91, 24);
this.RightWswV.addBox(2.0F, 4.0F, 0.0F, 2, 3, 1);
this.RightWswV.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWswV.setTextureSize(64, 32);
this.RightWswV.mirror = true;
this.setRotation(this.RightWswV, 0.0F, 0.0F, 0.0F);
this.RightWswEye = new ModelRenderer(this, 90, 20);
this.RightWswEye.addBox(3.0F, 3.0F, 0.0F, 1, 1, 1);
this.RightWswEye.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWswEye.setTextureSize(64, 32);
this.RightWswEye.mirror = true;
this.setRotation(this.RightWswEye, 0.0F, 0.0F, 0.0F);
this.RightWseH = new ModelRenderer(this, 119, 19);
this.RightWseH.addBox(-7.0F, 2.0F, 0.0F, 3, 2, 1);
this.RightWseH.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWseH.setTextureSize(64, 32);
this.RightWseH.mirror = true;
this.setRotation(this.RightWseH, 0.0F, 0.0F, 0.0F);
this.RightWseM = new ModelRenderer(this, 116, 23);
this.RightWseM.addBox(-6.0F, 4.0F, 0.0F, 2, 2, 1);
this.RightWseM.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWseM.setTextureSize(64, 32);
this.RightWseM.mirror = true;
this.setRotation(this.RightWseM, 0.0F, 0.0F, 0.0F);
this.RightWseV = new ModelRenderer(this, 109, 24);
this.RightWseV.addBox(-4.0F, 4.0F, 0.0F, 2, 3, 1);
this.RightWseV.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWseV.setTextureSize(64, 32);
this.RightWseV.mirror = true;
this.setRotation(this.RightWseV, 0.0F, 0.0F, 0.0F);
this.RightWseEye = new ModelRenderer(this, 113, 20);
this.RightWseEye.addBox(-4.0F, 3.0F, 0.0F, 1, 1, 1);
this.RightWseEye.setRotationPoint(0.0F, 5.0F, 9.0F);
this.RightWseEye.setTextureSize(64, 32);
this.RightWseEye.mirror = true;
this.setRotation(this.RightWseEye, 0.0F, 0.0F, 0.0F);
this.StandCenterBar = new ModelRenderer(this, 47, 27);
this.StandCenterBar.addBox(-1.0F, 0.0F, -8.0F, 1, 2, 16);
this.StandCenterBar.setRotationPoint(-9.0F, 6.0F, 0.0F);
this.StandCenterBar.setTextureSize(64, 32);
this.StandCenterBar.mirror = true;
this.setRotation(this.StandCenterBar, 0.0F, 0.0F, 0.0F);
this.StandLeft = new ModelRenderer(this, 37, 27);
this.StandLeft.addBox(-1.0F, 2.0F, -8.0F, 1, 5, 2);
this.StandLeft.setRotationPoint(-9.0F, 6.0F, 0.0F);
this.StandLeft.setTextureSize(64, 32);
this.StandLeft.mirror = true;
this.setRotation(this.StandLeft, 0.0F, 0.0F, 0.0F);
this.StandRight = new ModelRenderer(this, 84, 27);
this.StandRight.addBox(-1.0F, 2.0F, 6.0F, 1, 5, 2);
this.StandRight.setRotationPoint(-9.0F, 6.0F, 0.0F);
this.StandRight.setTextureSize(64, 32);
this.StandRight.mirror = true;
this.setRotation(this.StandRight, 0.0F, 0.0F, 0.0F);
}
/**
* Sets the models various rotation angles then renders the model.
*/
@Override
public void render (Entity var1, float var2, float var3, float var4, float var5, float var6, float var7)
{
super.render(var1, var2, var3, var4, var5, var6, var7);
this.setRotationAngles(var2, var3, var4, var5, var6, var7, var1);
this.LeftWheelAxle.rotateAngleZ = this.LeftWCenterHbeam.rotateAngleZ = this.LeftWCenterVtop.rotateAngleZ = this.LeftWCenterVbottom.rotateAngleZ = this.LeftWnwH.rotateAngleZ = this.LeftWnwM.rotateAngleZ = this.LeftWnwV.rotateAngleZ = this.LeftWnwEye.rotateAngleZ = this.LeftWneH.rotateAngleZ = this.LeftWneM.rotateAngleZ = this.LeftWneV.rotateAngleZ = this.LeftWneEye.rotateAngleZ = this.LeftWswH.rotateAngleZ = this.LeftWswM.rotateAngleZ = this.LeftWswV.rotateAngleZ = this.LeftWswEye.rotateAngleZ = this.LeftWseH.rotateAngleZ = this.LeftWseM.rotateAngleZ = this.LeftWseV.rotateAngleZ = this.LeftWseEye.rotateAngleZ = this.RightWheelAxle.rotateAngleZ = this.RightWCenterHbeam.rotateAngleZ = this.RightWCenterVtop.rotateAngleZ = this.RightWCenterVbottom.rotateAngleZ = this.RightWnwH.rotateAngleZ = this.RightWnwM.rotateAngleZ = this.RightWnwV.rotateAngleZ = this.RightWnwEye.rotateAngleZ = this.RoghtWneH.rotateAngleZ = this.RightWneM.rotateAngleZ = this.RightWneV.rotateAngleZ = this.RightWneEye.rotateAngleZ = this.RightWswH.rotateAngleZ = this.RightWswM.rotateAngleZ = this.RightWswV.rotateAngleZ = this.RightWswEye.rotateAngleZ = this.RightWseH.rotateAngleZ = this.RightWseM.rotateAngleZ = this.RightWseV.rotateAngleZ = this.RightWseEye.rotateAngleZ;
this.Bottom.render(var7);
this.Left.render(var7);
this.Right.render(var7);
this.Back.render(var7);
this.Front.render(var7);
this.Leftpull.render(var7);
this.Rightpull.render(var7);
this.HandBrakeMain.render(var7);
this.HandbrakeJamb.render(var7);
this.LeftWheelAxle.render(var7);
this.LeftWCenterHbeam.render(var7);
this.LeftWCenterVtop.render(var7);
this.LeftWCenterVbottom.render(var7);
this.LeftWnwH.render(var7);
this.LeftWnwM.render(var7);
this.LeftWnwV.render(var7);
this.LeftWnwEye.render(var7);
this.LeftWneH.render(var7);
this.LeftWneM.render(var7);
this.LeftWneV.render(var7);
this.LeftWneEye.render(var7);
this.LeftWswH.render(var7);
this.LeftWswM.render(var7);
this.LeftWswV.render(var7);
this.LeftWswEye.render(var7);
this.LeftWseH.render(var7);
this.LeftWseM.render(var7);
this.LeftWseV.render(var7);
this.LeftWseEye.render(var7);
this.RightWheelAxle.render(var7);
this.RightWCenterHbeam.render(var7);
this.RightWCenterVtop.render(var7);
this.RightWCenterVbottom.render(var7);
this.RightWnwH.render(var7);
this.RightWnwM.render(var7);
this.RightWnwV.render(var7);
this.RightWnwEye.render(var7);
this.RoghtWneH.render(var7);
this.RightWneM.render(var7);
this.RightWneV.render(var7);
this.RightWneEye.render(var7);
this.RightWswH.render(var7);
this.RightWswM.render(var7);
this.RightWswV.render(var7);
this.RightWswEye.render(var7);
this.RightWseH.render(var7);
this.RightWseM.render(var7);
this.RightWseV.render(var7);
this.RightWseEye.render(var7);
this.StandCenterBar.render(var7);
this.StandLeft.render(var7);
this.StandRight.render(var7);
}
private void setRotation (ModelRenderer var1, float var2, float var3, float var4)
{
var1.rotateAngleX = var2;
var1.rotateAngleY = var3;
var1.rotateAngleZ = var4;
}
/**
* Sets the models various rotation angles.
*/
@Override
public void setRotationAngles (float var1, float var2, float var3, float var4, float var5, float var6, Entity par7Entity)
{
super.setRotationAngles(var1, var2, var3, var4, var5, var6, par7Entity);
}
}
@@ -0,0 +1,101 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.entity.SlimeClone;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class SlimeCloneRender extends RenderLiving
{
private ModelBase scaleAmount;
public SlimeCloneRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
{
super(par1ModelBase, par3);
this.scaleAmount = par2ModelBase;
}
/**
* Determines whether Slime Render should pass or not.
*/
protected int shouldSlimeRenderPass (SlimeClone blueSlime, int par2, float par3)
{
if (blueSlime.isInvisible())
{
return 0;
}
else if (par2 == 0)
{
this.setRenderPassModel(this.scaleAmount);
GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
return 1;
}
else
{
if (par2 == 1)
{
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
return -1;
}
}
/**
* sets the scale for the slime based on getSlimeSize in EdibleSlime
*/
protected void scaleSlime (SlimeClone slimeClone, float par2)
{
float f1 = slimeClone.getSlimeSize();
float f2 = (slimeClone.sizeHeight + (slimeClone.sizeFactor - slimeClone.sizeHeight) * par2) / (f1 * 0.5F + 1.0F);
float f3 = 1.0F / (f2 + 1.0F);
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback (EntityLiving par1EntityLiving, float par2)
{
this.scaleSlime((SlimeClone) par1EntityLiving, par2);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
{
return this.shouldSlimeRenderPass((SlimeClone) par1EntityLiving, par2, par3);
}
/*protected ResourceLocation func_98191_a (SlimeClone slime)
{
this.loadDownloadableImageTexture(slime.skinUrl, slime.getTexture());
}
@Override
protected void func_98190_a (EntityLiving par1EntityLiving)
{
this.func_98191_a((SlimeClone) par1EntityLiving);
}*/
@Override
protected ResourceLocation func_110775_a (Entity entity)
{
//return func_98191_a((SlimeClone)entity);
return null;
}
}
+57
View File
@@ -0,0 +1,57 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class SlimeModel extends ModelBase
{
/** The slime's bodies, both the inside box and the outside box */
ModelRenderer slimeBodies;
/** The slime's right eye */
ModelRenderer slimeRightEye;
/** The slime's left eye */
ModelRenderer slimeLeftEye;
/** The slime's mouth */
ModelRenderer slimeMouth;
public SlimeModel(int par1)
{
this.slimeBodies = new ModelRenderer(this, 0, par1);
this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8);
if (par1 > 0)
{
this.slimeBodies = new ModelRenderer(this, 0, par1);
this.slimeBodies.addBox(-3.0F, 17.0F, -3.0F, 6, 6, 6);
this.slimeRightEye = new ModelRenderer(this, 32, 0);
this.slimeRightEye.addBox(-3.25F, 18.0F, -3.5F, 2, 2, 2);
this.slimeLeftEye = new ModelRenderer(this, 32, 4);
this.slimeLeftEye.addBox(1.25F, 18.0F, -3.5F, 2, 2, 2);
this.slimeMouth = new ModelRenderer(this, 32, 8);
this.slimeMouth.addBox(0.0F, 21.0F, -3.5F, 1, 1, 1);
}
}
/**
* Sets the models various rotation angles then renders the model.
*/
public void render (Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
this.slimeBodies.render(par7);
if (this.slimeRightEye != null)
{
this.slimeRightEye.render(par7);
this.slimeLeftEye.render(par7);
this.slimeMouth.render(par7);
}
}
}
+104
View File
@@ -0,0 +1,104 @@
package tconstruct.client.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.entity.BlueSlime;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class SlimeRender extends RenderLiving
{
private ModelBase scaleAmount;
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
{
super(par1ModelBase, par3);
this.scaleAmount = par2ModelBase;
}
public void doRenderLiving (EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
super.doRenderLiving(par1EntityLiving, par2, par4, par6, par8, par9);
renderBossHealth((BlueSlime) par1EntityLiving);
}
public void renderBossHealth (BlueSlime slime)
{
if (slime.getSlimeSize() >= 8)
BossStatus.func_82824_a(slime, true);
}
/**
* Determines whether Slime Render should pass or not.
*/
protected int shouldSlimeRenderPass (BlueSlime blueSlime, int par2, float par3)
{
if (blueSlime.isInvisible())
{
return 0;
}
else if (par2 == 0)
{
this.setRenderPassModel(this.scaleAmount);
GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
return 1;
}
else
{
if (par2 == 1)
{
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
return -1;
}
}
/**
* sets the scale for the slime based on getSlimeSize in EdibleSlime
*/
protected void scaleSlime (BlueSlime par1EdibleSlime, float par2)
{
float f1 = (float) par1EdibleSlime.getSlimeSize();
float f2 = (par1EdibleSlime.sizeHeight + (par1EdibleSlime.sizeFactor - par1EdibleSlime.sizeHeight) * par2) / (f1 * 0.5F + 1.0F);
float f3 = 1.0F / (f2 + 1.0F);
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback (EntityLiving par1EntityLiving, float par2)
{
this.scaleSlime((BlueSlime) par1EntityLiving, par2);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
{
return this.shouldSlimeRenderPass((BlueSlime) par1EntityLiving, par2, par3);
}
@Override
protected ResourceLocation func_110775_a(Entity par1Entity)
{
return texture;
}
static final ResourceLocation texture = new ResourceLocation("tinker", "textures/mob/slimeedible.png");
}
@@ -0,0 +1,634 @@
package tconstruct.client.entity.projectile;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.entity.projectile.ArrowEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ArrowRender extends Render
{
private static final ResourceLocation field_110798_h = new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
public boolean renderWithColor = true;
/** Defines the zLevel of rendering of item on GUI. */
public float zLevel;
public static boolean renderInFrame;
public ArrowRender()
{
this.shadowSize = 0.15F;
this.shadowOpaque = 0.75F;
}
/**
* Renders the item
*/
public void doRenderItem (ArrowEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
{
this.func_110777_b(par1ArrowEntity);
this.random.setSeed(187L);
ItemStack itemstack = par1ArrowEntity.getEntityItem();
if (itemstack.getItem() != null)
{
GL11.glPushMatrix();
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9) / 10.0F + 0) * 0.1F + 0.1F : 0F;
float f3 = (((float) 0 + par9) / 20.0F + 0) * (180F / (float) Math.PI);
byte b0 = getMiniBlockCount(itemstack);
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float f4;
float f5;
float f6;
int i;
Block block = null;
if (itemstack.itemID < Block.blocksList.length)
{
block = Block.blocksList[itemstack.itemID];
}
if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
if (renderInFrame)
{
GL11.glScalef(1.25F, 1.25F, 1.25F);
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
float f7 = 0.25F;
int j = block.getRenderType();
if (j == 1 || j == 19 || j == 12 || j == 2)
{
f7 = 0.5F;
}
GL11.glScalef(f7, f7, f7);
for (i = 0; i < b0; ++i)
{
GL11.glPushMatrix();
if (i > 0)
{
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
GL11.glTranslatef(f5, f4, f6);
}
f5 = 1.0F;
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
GL11.glPopMatrix();
}
}
else
{
float f8;
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
{
if (renderInFrame)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
{
this.random.setSeed(187L);
Icon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
if (this.renderWithColor)
{
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
f5 = (float) (i >> 16 & 255) / 255.0F;
f4 = (float) (i >> 8 & 255) / 255.0F;
f6 = (float) (i & 255) / 255.0F;
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
}
else
{
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
}
}
}
else
{
if (renderInFrame)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
Icon icon1 = itemstack.getIconIndex();
if (this.renderWithColor)
{
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
f8 = (float) (l >> 16 & 255) / 255.0F;
float f9 = (float) (l >> 8 & 255) / 255.0F;
f5 = (float) (l & 255) / 255.0F;
f4 = 1.0F;
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
}
else
{
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
}
}
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
protected ResourceLocation func_110796_a (ArrowEntity par1ArrowEntity)
{
return this.renderManager.renderEngine.func_130087_a(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
}
/**
* Renders a dropped item
*/
private void renderDroppedItem (ArrowEntity par1ArrowEntity, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
{
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
}
private void renderDroppedItem (ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
{
Tessellator tessellator = Tessellator.instance;
if (par2Icon == null)
{
TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
ResourceLocation resourcelocation = texturemanager.func_130087_a(arrow.getEntityItem().getItemSpriteNumber());
par2Icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
}
float f4 = ((Icon) par2Icon).getMinU();
float f5 = ((Icon) par2Icon).getMaxU();
float f6 = ((Icon) par2Icon).getMinV();
float f7 = ((Icon) par2Icon).getMaxV();
float f8 = 1.0F;
float f9 = 0.5F;
float f10 = 0.25F;
float f11;
GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F, 0.0F, 0.0F, 1.0F);
GL11.glPushMatrix();
if (renderInFrame)
{
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
}
else
{
GL11.glRotatef((((float) 0 + par4) / 20.0F + 0) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
float f12 = 0.0625F;
f11 = 0.021875F;
ItemStack itemstack = arrow.getEntityItem();
int j = itemstack.stackSize;
byte b0 = getMiniItemCount(itemstack);
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
for (int k = 0; k < b0; ++k)
{
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
if (k > 0 && shouldSpreadItems())
{
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
GL11.glTranslatef(x, y, f12 + f11);
}
else
{
GL11.glTranslatef(0f, 0f, f12 + f11);
}
if (itemstack.getItemSpriteNumber() == 0)
{
this.func_110776_a(TextureMap.field_110575_b);
}
else
{
this.func_110776_a(TextureMap.field_110576_c);
}
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getOriginX(), ((Icon) par2Icon).getOriginY(), f12);
if (itemstack.hasEffect(pass))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
this.renderManager.renderEngine.func_110577_a(field_110798_h);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f13 = 0.76F;
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f14 = 0.125F;
GL11.glScalef(f14, f14, f14);
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f15, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f14, f14, f14);
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f15, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
GL11.glPopMatrix();
}
/**
* Renders the item's icon or block into the UI at the specified position.
*/
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
}
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
{
int k = par3ItemStack.itemID;
int l = par3ItemStack.getItemDamage();
Object object = par3ItemStack.getIconIndex();
float f;
int i1;
float f1;
float f2;
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
{
par2TextureManager.func_110577_a(TextureMap.field_110575_b);
GL11.glPushMatrix();
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
GL11.glScalef(10.0F, 10.0F, 10.0F);
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
GL11.glScalef(1.0F, 1.0F, -1.0F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f = (float) (i1 >> 16 & 255) / 255.0F;
f1 = (float) (i1 >> 8 & 255) / 255.0F;
f2 = (float) (i1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f, f1, f2, 1.0F);
}
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
this.itemRenderBlocks.useInventoryTint = this.renderWithColor;
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
this.itemRenderBlocks.useInventoryTint = true;
GL11.glPopMatrix();
}
else if (Item.itemsList[k].requiresMultipleRenderPasses())
{
GL11.glDisable(GL11.GL_LIGHTING);
for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
{
par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1);
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
f1 = (float) (k1 >> 16 & 255) / 255.0F;
f2 = (float) (k1 >> 8 & 255) / 255.0F;
float f3 = (float) (k1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f1, f2, f3, 1.0F);
}
this.renderIcon(par4, par5, icon, 16, 16);
if (par3ItemStack.hasEffect(j1))
{
renderEffect(par2TextureManager, par4, par5);
}
}
GL11.glEnable(GL11.GL_LIGHTING);
}
else
{
GL11.glDisable(GL11.GL_LIGHTING);
ResourceLocation resourcelocation = par2TextureManager.func_130087_a(par3ItemStack.getItemSpriteNumber());
par2TextureManager.func_110577_a(resourcelocation);
if (object == null)
{
object = ((TextureMap) Minecraft.getMinecraft().func_110434_K().func_110581_b(resourcelocation)).func_110572_b("missingno");
}
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f = (float) (i1 >> 16 & 255) / 255.0F;
f1 = (float) (i1 >> 8 & 255) / 255.0F;
f2 = (float) (i1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f, f1, f2, 1.0F);
}
this.renderIcon(par4, par5, (Icon) object, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
if (par3ItemStack.hasEffect(0))
{
renderEffect(par2TextureManager, par4, par5);
}
}
GL11.glEnable(GL11.GL_CULL_FACE);
}
private void renderEffect (TextureManager manager, int x, int y)
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
manager.func_110577_a(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
/**
* Render the item's icon or block into the GUI, including the glint effect.
*/
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
if (par3ItemStack != null)
{
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
{
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
}
/* Modders must handle this themselves if they use custom renderers!
if (par3ItemStack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
par2TextureManager.func_110577_a(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
*/
}
}
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
{
for (int j1 = 0; j1 < 2; ++j1)
{
if (j1 == 0)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
if (j1 == 1)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
float f = 0.00390625F;
float f1 = 0.00390625F;
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
float f3 = 0.0F;
Tessellator tessellator = Tessellator.instance;
float f4 = 4.0F;
if (j1 == 1)
{
f4 = -1.0F;
}
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
(double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
tessellator.draw();
}
}
/**
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
* specified position.
*/
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
}
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
{
if (par3ItemStack != null)
{
if (par3ItemStack.stackSize > 1 || par6Str != null)
{
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
if (par3ItemStack.isItemDamaged())
{
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator tessellator = Tessellator.instance;
int i1 = 255 - l << 16 | l << 8;
int j1 = (255 - l) / 4 << 16 | 16128;
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}
/**
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
* tessellator, x, y, width, height, color
*/
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
{
par1Tessellator.startDrawingQuads();
par1Tessellator.setColorOpaque_I(par6);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
par1Tessellator.draw();
}
public void renderIcon (int par1, int par2, Icon par3Icon, int par4, int par5)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
tessellator.draw();
}
protected ResourceLocation func_110775_a (Entity par1Entity)
{
return this.func_110796_a((ArrowEntity) par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
}
/**
* Items should spread out when rendered in 3d?
* @return
*/
public boolean shouldSpreadItems ()
{
return true;
}
/**
* Items should have a bob effect
* @return
*/
public boolean shouldBob ()
{
return true;
}
public byte getMiniBlockCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 5)
ret = 3;
if (stack.stackSize > 20)
ret = 4;
if (stack.stackSize > 40)
ret = 5;
return ret;
}
/**
* Allows for a subclass to override how many rendered items appear in a
* "mini item 3d stack"
* @param stack
* @return
*/
public byte getMiniItemCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 15)
ret = 3;
if (stack.stackSize > 31)
ret = 4;
return ret;
}
}
@@ -0,0 +1,633 @@
package tconstruct.client.entity.projectile;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.entity.projectile.DaggerEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class DaggerRender extends Render
{
private static final ResourceLocation field_110798_h = new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
public boolean renderWithColor = true;
/** Defines the zLevel of rendering of item on GUI. */
public float zLevel;
public static boolean renderInFrame;
public DaggerRender()
{
this.shadowSize = 0.15F;
this.shadowOpaque = 0.75F;
}
/**
* Renders the item
*/
public void doRenderItem (DaggerEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
{
this.func_110777_b(par1ArrowEntity);
this.random.setSeed(187L);
ItemStack itemstack = par1ArrowEntity.getEntityItem();
if (itemstack.getItem() != null)
{
GL11.glPushMatrix();
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9) / 10.0F + 0) * 0.1F + 0.1F : 0F;
float f3 = (((float) 0 + par9) / 20.0F + 0) * (180F / (float) Math.PI);
byte b0 = getMiniBlockCount(itemstack);
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float f4;
float f5;
float f6;
int i;
Block block = null;
if (itemstack.itemID < Block.blocksList.length)
{
block = Block.blocksList[itemstack.itemID];
}
if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
if (renderInFrame)
{
GL11.glScalef(1.25F, 1.25F, 1.25F);
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
float f7 = 0.25F;
int j = block.getRenderType();
if (j == 1 || j == 19 || j == 12 || j == 2)
{
f7 = 0.5F;
}
GL11.glScalef(f7, f7, f7);
for (i = 0; i < b0; ++i)
{
GL11.glPushMatrix();
if (i > 0)
{
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
GL11.glTranslatef(f5, f4, f6);
}
f5 = 1.0F;
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
GL11.glPopMatrix();
}
}
else
{
float f8;
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
{
if (renderInFrame)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
{
this.random.setSeed(187L);
Icon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
if (this.renderWithColor)
{
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
f5 = (float) (i >> 16 & 255) / 255.0F;
f4 = (float) (i >> 8 & 255) / 255.0F;
f6 = (float) (i & 255) / 255.0F;
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
}
else
{
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
}
}
}
else
{
if (renderInFrame)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
Icon icon1 = itemstack.getIconIndex();
if (this.renderWithColor)
{
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
f8 = (float) (l >> 16 & 255) / 255.0F;
float f9 = (float) (l >> 8 & 255) / 255.0F;
f5 = (float) (l & 255) / 255.0F;
f4 = 1.0F;
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
}
else
{
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
}
}
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
protected ResourceLocation func_110796_a (DaggerEntity par1ArrowEntity)
{
return this.renderManager.renderEngine.func_130087_a(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
}
/**
* Renders a dropped item
*/
private void renderDroppedItem (DaggerEntity par1ArrowEntity, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
{
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
}
private void renderDroppedItem (DaggerEntity dagger, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
{
Tessellator tessellator = Tessellator.instance;
if (par2Icon == null)
{
TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
ResourceLocation resourcelocation = texturemanager.func_130087_a(dagger.getEntityItem().getItemSpriteNumber());
par2Icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
}
float f4 = ((Icon) par2Icon).getMinU();
float f5 = ((Icon) par2Icon).getMaxU();
float f6 = ((Icon) par2Icon).getMinV();
float f7 = ((Icon) par2Icon).getMaxV();
float f8 = 1.0F;
float f9 = 0.5F;
float f10 = 0.25F;
float f11;
float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par7;
GL11.glPushMatrix();
if (renderInFrame)
{
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
}
else
{
GL11.glRotatef((((float) 0 + par4) / 20.0F + 0) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
float f12 = 0.0625F;
f11 = 0.021875F;
ItemStack itemstack = dagger.getEntityItem();
int j = itemstack.stackSize;
byte b0 = getMiniItemCount(itemstack);
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
for (int k = 0; k < b0; ++k)
{
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
if (k > 0 && shouldSpreadItems())
{
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
GL11.glTranslatef(x, y, f12 + f11);
}
else
{
GL11.glTranslatef(0f, 0f, f12 + f11);
}
if (itemstack.getItemSpriteNumber() == 0)
{
this.func_110776_a(TextureMap.field_110575_b);
}
else
{
this.func_110776_a(TextureMap.field_110576_c);
}
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getOriginX(), ((Icon) par2Icon).getOriginY(), f12);
if (itemstack.hasEffect(pass))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
this.renderManager.renderEngine.func_110577_a(field_110798_h);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f13 = 0.76F;
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f14 = 0.125F;
GL11.glScalef(f14, f14, f14);
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f15, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f14, f14, f14);
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f15, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
GL11.glPopMatrix();
}
/**
* Renders the item's icon or block into the UI at the specified position.
*/
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
}
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
{
int k = par3ItemStack.itemID;
int l = par3ItemStack.getItemDamage();
Object object = par3ItemStack.getIconIndex();
float f;
int i1;
float f1;
float f2;
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
{
par2TextureManager.func_110577_a(TextureMap.field_110575_b);
GL11.glPushMatrix();
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
GL11.glScalef(10.0F, 10.0F, 10.0F);
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
GL11.glScalef(1.0F, 1.0F, -1.0F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f = (float) (i1 >> 16 & 255) / 255.0F;
f1 = (float) (i1 >> 8 & 255) / 255.0F;
f2 = (float) (i1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f, f1, f2, 1.0F);
}
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
this.itemRenderBlocks.useInventoryTint = this.renderWithColor;
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
this.itemRenderBlocks.useInventoryTint = true;
GL11.glPopMatrix();
}
else if (Item.itemsList[k].requiresMultipleRenderPasses())
{
GL11.glDisable(GL11.GL_LIGHTING);
for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
{
par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1);
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
f1 = (float) (k1 >> 16 & 255) / 255.0F;
f2 = (float) (k1 >> 8 & 255) / 255.0F;
float f3 = (float) (k1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f1, f2, f3, 1.0F);
}
this.renderIcon(par4, par5, icon, 16, 16);
if (par3ItemStack.hasEffect(j1))
{
renderEffect(par2TextureManager, par4, par5);
}
}
GL11.glEnable(GL11.GL_LIGHTING);
}
else
{
GL11.glDisable(GL11.GL_LIGHTING);
ResourceLocation resourcelocation = par2TextureManager.func_130087_a(par3ItemStack.getItemSpriteNumber());
par2TextureManager.func_110577_a(resourcelocation);
if (object == null)
{
object = ((TextureMap) Minecraft.getMinecraft().func_110434_K().func_110581_b(resourcelocation)).func_110572_b("missingno");
}
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f = (float) (i1 >> 16 & 255) / 255.0F;
f1 = (float) (i1 >> 8 & 255) / 255.0F;
f2 = (float) (i1 & 255) / 255.0F;
if (this.renderWithColor)
{
GL11.glColor4f(f, f1, f2, 1.0F);
}
this.renderIcon(par4, par5, (Icon) object, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
if (par3ItemStack.hasEffect(0))
{
renderEffect(par2TextureManager, par4, par5);
}
}
GL11.glEnable(GL11.GL_CULL_FACE);
}
private void renderEffect (TextureManager manager, int x, int y)
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
manager.func_110577_a(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
/**
* Render the item's icon or block into the GUI, including the glint effect.
*/
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
if (par3ItemStack != null)
{
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
{
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
}
/* Modders must handle this themselves if they use custom renderers!
if (par3ItemStack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
par2TextureManager.func_110577_a(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
*/
}
}
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
{
for (int j1 = 0; j1 < 2; ++j1)
{
if (j1 == 0)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
if (j1 == 1)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
float f = 0.00390625F;
float f1 = 0.00390625F;
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
float f3 = 0.0F;
Tessellator tessellator = Tessellator.instance;
float f4 = 4.0F;
if (j1 == 1)
{
f4 = -1.0F;
}
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
(double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
tessellator.draw();
}
}
/**
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
* specified position.
*/
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
}
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
{
if (par3ItemStack != null)
{
if (par3ItemStack.stackSize > 1 || par6Str != null)
{
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
if (par3ItemStack.isItemDamaged())
{
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator tessellator = Tessellator.instance;
int i1 = 255 - l << 16 | l << 8;
int j1 = (255 - l) / 4 << 16 | 16128;
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}
/**
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
* tessellator, x, y, width, height, color
*/
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
{
par1Tessellator.startDrawingQuads();
par1Tessellator.setColorOpaque_I(par6);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
par1Tessellator.draw();
}
public void renderIcon (int par1, int par2, Icon par3Icon, int par4, int par5)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
tessellator.draw();
}
protected ResourceLocation func_110775_a (Entity par1Entity)
{
return this.func_110796_a((DaggerEntity) par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderItem((DaggerEntity) par1Entity, par2, par4, par6, par8, par9);
}
/**
* Items should spread out when rendered in 3d?
* @return
*/
public boolean shouldSpreadItems ()
{
return true;
}
/**
* Items should have a bob effect
* @return
*/
public boolean shouldBob ()
{
return true;
}
public byte getMiniBlockCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 5)
ret = 3;
if (stack.stackSize > 20)
ret = 4;
if (stack.stackSize > 40)
ret = 5;
return ret;
}
/**
* Allows for a subclass to override how many rendered items appear in a
* "mini item 3d stack"
* @param stack
* @return
*/
public byte getMiniItemCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 15)
ret = 3;
if (stack.stackSize > 31)
ret = 4;
return ret;
}
}
@@ -0,0 +1,68 @@
package tconstruct.client.entity.projectile;
import java.util.Random;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.entity.projectile.DaggerEntity;
public class DaggerRenderOld extends RangedRenderBase
{
public DaggerRenderOld(double d)
{
System.out.println("new renderer");
shadowSize = 0.15F;
shadowOpaque = 0.75F;
daggerRotation = (float) d;
}
public void doRender (DaggerEntity dagger, double d, double d1, double d2, float f, float f1)
{
if ((new Random()).nextFloat() > 0.8)
System.out.println("rendering dagger " + dagger.texID + " " + dagger.tex2ID);
GL11.glPushMatrix();
GL11.glTranslatef((float) d, (float) d1, (float) d2);
GL11.glRotatef(f, 0.0F, 1.0F, 0.0F);
float f2 = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * f1;
GL11.glRotatef(-f2, 1.0F, 0.0F, 0.0F);
if (!dagger.onGround)
{
float f3 = dagger.prevBoomerangRotation + (dagger.boomerangRotation - dagger.prevBoomerangRotation) * f1 * 1.1F;
GL11.glRotatef(f3, 1.0F, 0.0F, 0.0F);
}
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
//loadTexture("/infi2x2/daggers.png");
Tessellator tessellator = Tessellator.instance;
int i = 0;//dagger.getTexID();
float f4 = ((float) ((i % 16) * 16) + 0.0F) / 256F;
float f5 = ((float) ((i % 16) * 16) + 15.99F) / 256F;
float f6 = ((float) ((i / 16) * 16) + 0.0F) / 256F;
float f7 = ((float) ((i / 16) * 16) + 15.99F) / 256F;
float f8 = 1.0F;
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
float f9 = 0.0625F;
GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
renderItem(tessellator, f4, f5, f6, f7, f8, f9);
GL11.glPopMatrix();
}
@Override
public void doRender (Entity entity, double d, double d1, double d2, float f, float f1)
{
doRender((DaggerEntity) entity, d, d1, d2, f, f1);
}
public float daggerRotation;
@Override
protected ResourceLocation func_110775_a (Entity entity)
{
// TODO Auto-generated method stub
return null;
}
}
@@ -0,0 +1,100 @@
package tconstruct.client.entity.projectile;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPotion;
import net.minecraft.potion.PotionHelper;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.entity.projectile.LaunchedPotion;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class LaunchedItemRender extends Render
{
private Item field_94151_a;
private int field_94150_f;
public LaunchedItemRender(Item par1Item, int par2)
{
this.field_94151_a = par1Item;
this.field_94150_f = par2;
}
public LaunchedItemRender(Item par1Item)
{
this(par1Item, 0);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
if (icon != null)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.func_110777_b(par1Entity);
Tessellator tessellator = Tessellator.instance;
if (icon == ItemPotion.func_94589_d("bottle_splash"))
{
int i = PotionHelper.func_77915_a(((LaunchedPotion)par1Entity).getPotionDamage(), false);
float f2 = (float)(i >> 16 & 255) / 255.0F;
float f3 = (float)(i >> 8 & 255) / 255.0F;
float f4 = (float)(i & 255) / 255.0F;
GL11.glColor3f(f2, f3, f4);
GL11.glPushMatrix();
this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
GL11.glPopMatrix();
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
this.func_77026_a(tessellator, icon);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
protected ResourceLocation func_110775_a(Entity par1Entity)
{
return TextureMap.field_110576_c;
}
private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon)
{
float f = par2Icon.getMinU();
float f1 = par2Icon.getMaxU();
float f2 = par2Icon.getMinV();
float f3 = par2Icon.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
par1Tessellator.startDrawingQuads();
par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
par1Tessellator.draw();
}
}
@@ -0,0 +1,90 @@
package tconstruct.client.entity.projectile;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
public abstract class RangedRenderBase extends Render
{
public RangedRenderBase()
{
}
public void doRender (Entity entity, double d, double d1, double d2, float f, float f1)
{
}
public void renderItem (Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5)
{
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
tessellator.addVertexWithUV(0.0D, 0.0D - (double) f5, 0.0D, f1, f3);
tessellator.addVertexWithUV(f4, 0.0D - (double) f5, 0.0D, f, f3);
tessellator.addVertexWithUV(f4, 0.0D - (double) f5, 1.0D, f, f2);
tessellator.addVertexWithUV(0.0D, 0.0D - (double) f5, 1.0D, f1, f2);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
tessellator.addVertexWithUV(0.0D, 0.0D, 1.0D, f1, f2);
tessellator.addVertexWithUV(f4, 0.0D, 1.0D, f, f2);
tessellator.addVertexWithUV(f4, 0.0D, 0.0D, f, f3);
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, f1, f3);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
for (int i = 0; i < 16; i++)
{
float f6 = (float) i / 16F;
float f10 = (f1 + (f - f1) * f6) - 0.001953125F;
float f14 = f4 * f6 + 0.0625F;
tessellator.addVertexWithUV(f14, 0.0F - f5, 0.0D, f10, f3);
tessellator.addVertexWithUV(f14, 0.0D, 0.0D, f10, f3);
tessellator.addVertexWithUV(f14, 0.0D, 1.0D, f10, f2);
tessellator.addVertexWithUV(f14, 0.0F - f5, 1.0D, f10, f2);
}
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
for (int j = 0; j < 16; j++)
{
float f7 = (float) j / 16F;
float f11 = (f1 + (f - f1) * f7) - 0.001953125F;
float f15 = f4 * f7;
tessellator.addVertexWithUV(f15, 0.0F - f5, 1.0D, f11, f2);
tessellator.addVertexWithUV(f15, 0.0D, 1.0D, f11, f2);
tessellator.addVertexWithUV(f15, 0.0D, 0.0D, f11, f3);
tessellator.addVertexWithUV(f15, 0.0F - f5, 0.0D, f11, f3);
}
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
for (int k = 0; k < 16; k++)
{
float f8 = (float) k / 16F;
float f12 = (f3 + (f2 - f3) * f8) - 0.001953125F;
float f16 = f4 * f8;
tessellator.addVertexWithUV(0.0D, 0.0D, f16, f1, f12);
tessellator.addVertexWithUV(f4, 0.0D, f16, f, f12);
tessellator.addVertexWithUV(f4, 0.0F - f5, f16, f, f12);
tessellator.addVertexWithUV(0.0D, 0.0F - f5, f16, f1, f12);
}
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
for (int l = 0; l < 16; l++)
{
float f9 = (float) l / 16F;
float f13 = (f3 + (f2 - f3) * f9) - 0.001953125F;
float f17 = f4 * f9 + 0.0625F;
tessellator.addVertexWithUV(f4, 0.0D, f17, f, f13);
tessellator.addVertexWithUV(0.0D, 0.0D, f17, f1, f13);
tessellator.addVertexWithUV(0.0D, 0.0F - f5, f17, f1, f13);
tessellator.addVertexWithUV(f4, 0.0F - f5, f17, f, f13);
}
tessellator.draw();
}
}
+154
View File
@@ -0,0 +1,154 @@
package tconstruct.client.gui;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.InventoryEffectRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.common.TContent;
import tconstruct.inventory.ArmorExtendedContainer;
import tconstruct.util.player.ArmorExtended;
public class ArmorExtendedGui extends InventoryEffectRenderer
{
public InventoryPlayer inv;
public ArmorExtended stats;
private float xSize_lo;
private float ySize_lo;
public ArmorExtendedGui(InventoryPlayer inventoryplayer, ArmorExtended holder)
{
super(new ArmorExtendedContainer(inventoryplayer, holder));
inv = inventoryplayer;
stats = holder;
}
public void initGui ()
{
super.initGui();
int cornerX = guiLeft;
int cornerY = (this.height - this.ySize) / 2;
this.buttonList.clear();
InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0);
this.buttonList.add(tab);
tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1);
tab.enabled = false;
this.buttonList.add(tab);
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
//fontRenderer.drawString(StatCollector.translateToLocal("inventory.armorextended"), 60, 6, 0x404040);
//fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
}
public void drawScreen (int par1, int par2, float par3)
{
super.drawScreen(par1, par2, par3);
this.xSize_lo = (float) par1;
this.ySize_lo = (float) par2;
if (stats.inventory[2] != null && stats.inventory[2].getItem() == TContent.knapsack)
{
if (this.buttonList.size() < 3)
{
int cornerX = guiLeft;
int cornerY = (this.height - this.ySize) / 2;
InventoryTab tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1);
this.buttonList.add(tab);
}
}
else
{
if (this.buttonList.size() >= 3)
{
buttonList.remove(2);
}
}
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/armorextended.png");
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//mc.renderEngine.bindTexture("/mods/tinker/textures/gui/armorextended.png");
this.mc.func_110434_K().func_110577_a(background);
int cornerX = guiLeft;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
if (!stats.isStackInSlot(0))
drawTexturedModalRect(cornerX + 79, cornerY + 16, 176, 9, 18, 18);
if (!stats.isStackInSlot(1))
drawTexturedModalRect(cornerX + 79, cornerY + 34, 176, 27, 18, 18);
if (!stats.isStackInSlot(2))
drawTexturedModalRect(cornerX + 115, cornerY + 16, 212, 9, 18, 18);
if (!stats.isStackInSlot(3))
drawTexturedModalRect(cornerX + 115, cornerY + 34, 212, 27, 18, 18);
if (!stats.isStackInSlot(4))
drawTexturedModalRect(cornerX + 151, cornerY + 16, 230, 0, 18, 18);
if (!stats.isStackInSlot(5))
drawTexturedModalRect(cornerX + 151, cornerY + 34, 230, 18, 18, 18);
if (!stats.isStackInSlot(6))
drawTexturedModalRect(cornerX + 151, cornerY + 52, 230, 36, 18, 18);
cornerX = this.guiLeft;
cornerY = this.guiTop;
drawPlayerOnGui(this.mc, cornerX + 33, cornerY + 75, 30, (float) (cornerX + 51) - this.xSize_lo, (float) (cornerY + 75 - 50) - this.ySize_lo);
}
public static void drawPlayerOnGui (Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5)
{
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glPushMatrix();
GL11.glTranslatef((float) par1, (float) par2, 50.0F);
GL11.glScalef((float) (-par3), (float) par3, (float) par3);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
float f2 = par0Minecraft.thePlayer.renderYawOffset;
float f3 = par0Minecraft.thePlayer.rotationYaw;
float f4 = par0Minecraft.thePlayer.rotationPitch;
par4 -= 19;
GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-((float) Math.atan((double) (par5 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
par0Minecraft.thePlayer.renderYawOffset = (float) Math.atan((double) (par4 / 40.0F)) * 20.0F;
par0Minecraft.thePlayer.rotationYaw = (float) Math.atan((double) (par4 / 40.0F)) * 40.0F;
par0Minecraft.thePlayer.rotationPitch = -((float) Math.atan((double) (par5 / 40.0F))) * 20.0F;
par0Minecraft.thePlayer.rotationYawHead = par0Minecraft.thePlayer.rotationYaw;
GL11.glTranslatef(0.0F, par0Minecraft.thePlayer.yOffset, 0.0F);
RenderManager.instance.playerViewY = 180.0F;
RenderManager.instance.renderEntityWithPosYaw(par0Minecraft.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
par0Minecraft.thePlayer.renderYawOffset = f2;
par0Minecraft.thePlayer.rotationYaw = f3;
par0Minecraft.thePlayer.rotationPitch = f4;
GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
/*protected void keyTyped(char par1, int par2)
{
if (par2 == TControls.armorKey.keyCode)
{
this.mc.thePlayer.closeScreen();
}
super.keyTyped(par1, par2);
}*/
}
+40
View File
@@ -0,0 +1,40 @@
package tconstruct.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.DrawbridgeLogic;
public class DrawbridgeGui extends GuiContainer
{
public DrawbridgeLogic logic;
public DrawbridgeGui(InventoryPlayer inventoryplayer, DrawbridgeLogic frypan, World world, int x, int y, int z)
{
super(frypan.getGuiContainer(inventoryplayer, world, x, y, z));
logic = frypan;
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
//fontRenderer.drawString(StatCollector.translateToLocal("aggregator.glowstone"), 60, 6, 0x404040);
fontRenderer.drawString("Drawbridge", 8, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/drawbridge.png");
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
}
}
+46
View File
@@ -0,0 +1,46 @@
package tconstruct.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.FrypanLogic;
public class FrypanGui extends GuiContainer
{
public FrypanLogic logic;
public FrypanGui(InventoryPlayer inventoryplayer, FrypanLogic frypan, World world, int x, int y, int z)
{
super(frypan.getGuiContainer(inventoryplayer, world, x, y, z));
logic = frypan;
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
fontRenderer.drawString(StatCollector.translateToLocal("crafters.Frypan"), 60, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/frypan.png");
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
if (logic.fuel > 0)
{
int fuel = logic.gaugeFuelScaled(12);
drawTexturedModalRect(cornerX + 27, (cornerY + 40) - fuel, 176, 12 - fuel, 14, fuel + 2);
}
int fuelgague = logic.gaugeProgressScaled(24);
drawTexturedModalRect(cornerX + 140, cornerY + 8, 176, 14, fuelgague, 16);
}
}
@@ -0,0 +1,47 @@
package tconstruct.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.GlowstoneAggregator;
public class GlowstoneAggregatorGui extends GuiContainer
{
public GlowstoneAggregator logic;
public GlowstoneAggregatorGui(InventoryPlayer inventoryplayer, GlowstoneAggregator frypan, World world, int x, int y, int z)
{
super(frypan.getGuiContainer(inventoryplayer, world, x, y, z));
logic = frypan;
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
//fontRenderer.drawString(StatCollector.translateToLocal("aggregator.glowstone"), 60, 6, 0x404040);
fontRenderer.drawString("Glowstone Aggregator", 8, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/aggregator.png");
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
/*if (logic.fuel > 0)
{
int fuel = logic.gaugeFuelScaled(12);
drawTexturedModalRect(cornerX + 27, (cornerY + 40) - fuel, 176, 12 - fuel, 14, fuel + 2);
}
int fuelgague = logic.gaugeProgressScaled(24);
drawTexturedModalRect(cornerX + 140, cornerY + 8, 176, 14, fuelgague, 16);*/
}
}
+55
View File
@@ -0,0 +1,55 @@
package tconstruct.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.library.client.ToolGuiElement;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiButtonTool extends GuiButton
{
/**
* True for pointing right (next page), false for pointing left (previous page).
*/
int textureX;
int textureY;
public String texture;
public ToolGuiElement element;
private static ResourceLocation background;// = new ResourceLocation("tinker", "textures/gui/armorextended.png");
public GuiButtonTool(int id, int posX, int posY, int texX, int texY, String domain, String tex, ToolGuiElement e)
{
super(id, posX, posY, 18, 18, "");
textureX = texX;
textureY = texY;
texture = tex;
element = e;
background = new ResourceLocation(domain, tex);
}
/**
* Draws this button to the screen.
*/
public void drawButton (Minecraft mc, int mouseX, int mouseY)
{
if (this.drawButton)
{
boolean var4 = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.func_110434_K().func_110577_a(background);
this.field_82253_i = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int var5 = this.getHoverState(this.field_82253_i);
int index = 18 * getHoverState(field_82253_i);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 144 + index * 2, 216, 18, 18);
this.drawTexturedModalRect(this.xPosition, this.yPosition, textureX * 18, textureY * 18, 18, 18);
}
}
}
+193
View File
@@ -0,0 +1,193 @@
package tconstruct.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import tconstruct.client.RenderItemCopy;
import tconstruct.client.TProxyClient;
import tconstruct.client.block.SmallFontRenderer;
import tconstruct.client.pages.BookPage;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiManual extends GuiScreen
{
ItemStack itemstackBook;
Document manual;
public RenderItemCopy renderitem = new RenderItemCopy();
int bookImageWidth = 206;
int bookImageHeight = 200;
int bookTotalPages = 1;
int currentPage;
int maxPages;
private TurnPageButton buttonNextPage;
private TurnPageButton buttonPreviousPage;
BookPage pageLeft;
BookPage pageRight;
public SmallFontRenderer fonts = TProxyClient.smallFontRenderer;
public GuiManual(ItemStack stack, Document doc)
{
this.mc = Minecraft.getMinecraft();
this.itemstackBook = stack;
currentPage = 0; //Stack page
manual = doc;
//renderitem.renderInFrame = true;
}
/*@Override
public void setWorldAndResolution (Minecraft minecraft, int w, int h)
{
this.guiParticles = new GuiParticle(minecraft);
this.mc = minecraft;
this.width = w;
this.height = h;
this.buttonList.clear();
this.initGui();
}*/
public void initGui ()
{
maxPages = manual.getElementsByTagName("page").getLength();
updateText();
int xPos = (this.width) / 2;
this.buttonList.add(this.buttonNextPage = new TurnPageButton(1, xPos + bookImageWidth - 50, 180, true));
this.buttonList.add(this.buttonPreviousPage = new TurnPageButton(2, xPos - bookImageWidth + 24, 180, false));
}
protected void actionPerformed (GuiButton button)
{
if (button.enabled)
{
if (button.id == 1)
currentPage += 2;
if (button.id == 2)
currentPage -= 2;
updateText();
}
}
void updateText ()
{
if (maxPages % 2 == 1)
{
if (currentPage > maxPages)
currentPage = maxPages;
}
else
{
if (currentPage >= maxPages)
currentPage = maxPages - 2;
}
if (currentPage % 2 == 1)
currentPage--;
if (currentPage < 0)
currentPage = 0;
NodeList nList = manual.getElementsByTagName("page");
Node node = nList.item(currentPage);
if (node.getNodeType() == Node.ELEMENT_NODE)
{
Element element = (Element) node;
Class clazz = TProxyClient.getPageClass(element.getAttribute("type"));
if (clazz != null)
{
try
{
pageLeft = (BookPage) clazz.newInstance();
pageLeft.init(this, 0);
pageLeft.readPageFromXML(element);
}
catch (Exception e)
{
}
}
else
{
pageLeft = null;
}
}
node = nList.item(currentPage + 1);
if (node != null && node.getNodeType() == Node.ELEMENT_NODE)
{
Element element = (Element) node;
Class clazz = TProxyClient.getPageClass(element.getAttribute("type"));
if (clazz != null)
{
try
{
pageRight = (BookPage) clazz.newInstance();
pageRight.init(this, 1);
pageRight.readPageFromXML(element);
}
catch (Exception e)
{
}
}
else
{
pageLeft = null;
}
}
else
{
pageRight = null;
}
}
private static final ResourceLocation bookRight = new ResourceLocation("tinker", "textures/gui/bookright.png");
private static final ResourceLocation bookLeft = new ResourceLocation("tinker", "textures/gui/bookleft.png");
public void drawScreen (int par1, int par2, float par3)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(bookRight);
int localWidth = (this.width) / 2;
byte localHeight = 8;
this.drawTexturedModalRect(localWidth, localHeight, 0, 0, this.bookImageWidth, this.bookImageHeight);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(bookLeft);
localWidth = localWidth - this.bookImageWidth;
this.drawTexturedModalRect(localWidth, localHeight, 256 - this.bookImageWidth, 0, this.bookImageWidth, this.bookImageHeight);
super.drawScreen(par1, par2, par3); //16, 12, 220, 12
if (pageLeft != null)
pageLeft.renderBackgroundLayer(localWidth + 16, localHeight + 12);
if (pageRight != null)
pageRight.renderBackgroundLayer(localWidth + 220, localHeight + 12);
if (pageLeft != null)
pageLeft.renderContentLayer(localWidth + 16, localHeight + 12);
if (pageRight != null)
pageRight.renderContentLayer(localWidth + 220, localHeight + 12);
}
public Minecraft getMC ()
{
return mc;
}
public boolean doesGuiPauseGame ()
{
return false;
}
}
+77
View File
@@ -0,0 +1,77 @@
package tconstruct.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.client.TControls;
import tconstruct.client.TProxyClient;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class InventoryTab extends GuiButton
{
int textureX;
//String texture = "/gui/allitems.png";
ItemStack renderStack;
private static final ResourceLocation background = new ResourceLocation("gui/allitems.png");
public InventoryTab(int id, int posX, int posY, ItemStack stack, int texX)
{
super(id, posX, posY, 28, 32, "");
textureX = texX;
renderStack = stack;
}
/**
* Draws this button to the screen.
*/
public void drawButton (Minecraft mc, int mouseX, int mouseY)
{
if (this.drawButton)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.func_110434_K().func_110577_a(background);
//mc.renderEngine.bindTexture(texture);
int yTexPos = this.enabled ? 0 : 32;
int ySize = this.enabled ? 28 : 32;
this.drawTexturedModalRect(this.xPosition, this.yPosition, textureX * 28, yTexPos, 28, ySize);
RenderHelper.enableGUIStandardItemLighting();
this.zLevel = 100.0F;
TProxyClient.itemRenderer.zLevel = 100.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
TProxyClient.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
TProxyClient.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
GL11.glDisable(GL11.GL_LIGHTING);
TProxyClient.itemRenderer.zLevel = 0.0F;
this.zLevel = 0.0F;
RenderHelper.disableStandardItemLighting();
}
}
public boolean mousePressed (Minecraft mc, int mouseX, int mouseY)
{
boolean inWindow = this.enabled && this.drawButton && mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
if (inWindow)
{
if (this.id == 2)
TProxyClient.openInventoryGui();
if (this.id == 3)
TControls.openArmorGui();
if (this.id == 4)
TControls.openKnapsackGui();
}
return inWindow;
}
}
+72
View File
@@ -0,0 +1,72 @@
package tconstruct.client.gui;
import net.minecraft.block.Block;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import tconstruct.common.TContent;
import tconstruct.inventory.KnapsackContainer;
import tconstruct.util.player.KnapsackInventory;
public class KnapsackGui extends GuiContainer
{
public InventoryPlayer inv;
public KnapsackInventory stats;
public KnapsackGui(InventoryPlayer inventoryplayer, KnapsackInventory holder)
{
super(new KnapsackContainer(inventoryplayer, holder));
inv = inventoryplayer;
stats = holder;
}
public void initGui ()
{
super.initGui();
int cornerX = guiLeft;
int cornerY = (this.height - this.ySize) / 2;
this.buttonList.clear();
InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0);
this.buttonList.add(tab);
tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1);
this.buttonList.add(tab);
tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1);
tab.enabled = false;
this.buttonList.add(tab);
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
fontRenderer.drawString(StatCollector.translateToLocal("inventory.knapsack"), 8, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/knapsack.png");
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = guiLeft;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
}
/*protected void keyTyped(char par1, int par2)
{
if (par2 == TControls.armorKey.keyCode)
{
this.mc.thePlayer.closeScreen();
}
super.keyTyped(par1, par2);
}*/
}
+39
View File
@@ -0,0 +1,39 @@
package tconstruct.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import tconstruct.entity.MiniGardy;
import tconstruct.inventory.MiniGardyContainer;
public class MiniGardyGui extends GuiContainer
{
public MiniGardy gardy;
public MiniGardyGui(InventoryPlayer inventoryplayer, MiniGardy gardy)
{
super(new MiniGardyContainer(inventoryplayer, gardy));
this.gardy = gardy;
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
fontRenderer.drawString(gardy.getEntityName(), 8, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/googirl.png");
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
}
}
+904
View File
@@ -0,0 +1,904 @@
package tconstruct.client.gui;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.inventory.ActiveContainer;
import tconstruct.inventory.ActiveSlot;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public abstract class NewContainerGui extends GuiScreen
{
/** Stacks renderer. Icons, stack size, health, etc... */
protected static RenderItem itemRenderer = new RenderItem();
/** The X/Y size of the inventory window in stretched pixels. */
protected int xSize = 176;
protected int ySize = 166;
/** A list of the players inventory slots. */
public ActiveContainer container;
/**
* Starting X/Y position for the Gui. Inconsistent use for Gui backgrounds.
*/
protected int guiLeft;
protected int guiTop;
protected Slot mainSlot;
/** Used when touchscreen is enabled */
protected Slot clickedSlot = null;
protected boolean isRightMouseClick = false;
protected ItemStack draggedStack = null;
protected int field_85049_r = 0;
protected int field_85048_s = 0;
protected Slot returningStackDestSlot = null;
protected long returningStackTime = 0L;
/** Used when touchscreen is enabled */
protected ItemStack returningStack = null;
protected Slot field_92033_y = null;
protected long field_92032_z = 0L;
protected final Set field_94077_p = new HashSet();
protected boolean field_94076_q;
protected int field_94071_C = 0;
protected int field_94067_D = 0;
protected boolean field_94068_E = false;
protected int field_94069_F;
protected long field_94070_G = 0L;
protected Slot field_94072_H = null;
protected int field_94073_I = 0;
protected boolean field_94074_J;
protected ItemStack field_94075_K = null;
public NewContainerGui(ActiveContainer container)
{
this.container = container;
this.field_94068_E = true;
}
/**
* Adds the buttons (and other controls) to the screen in question.
*/
public void initGui ()
{
super.initGui();
this.mc.thePlayer.openContainer = this.container;
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
}
/**
* Draws the screen and all the components in it.
*/
public void drawScreen (int mouseX, int mouseY, float par3)
{
this.drawDefaultBackground();
int gLeft = this.guiLeft;
int gTop = this.guiTop;
this.drawGuiContainerBackgroundLayer(par3, mouseX, mouseY);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
super.drawScreen(mouseX, mouseY, par3);
RenderHelper.enableGUIStandardItemLighting();
GL11.glPushMatrix();
GL11.glTranslatef((float) gLeft, (float) gTop, 0.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
this.mainSlot = null;
short short1 = 240;
short short2 = 240;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) short1 / 1.0F, (float) short2 / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int slotXPos;
int slotYPos;
for (int slotIter = 0; slotIter < this.container.inventorySlots.size(); ++slotIter)
{
Slot slot = (Slot) this.container.inventorySlots.get(slotIter);
if (!(slot instanceof ActiveSlot) || ((ActiveSlot) slot).getActive())
{
this.drawSlotInventory(slot);
if (this.isMouseOverSlot(slot, mouseX, mouseY))
{
this.mainSlot = slot;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
slotXPos = slot.xDisplayPosition;
slotYPos = slot.yDisplayPosition;
this.drawGradientRect(slotXPos, slotYPos, slotXPos + 16, slotYPos + 16, -2130706433, -2130706433);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
}
}
/*for (int slotIter = 0; slotIter < this.container.otherInventorySlots.size(); ++slotIter)
{
ActiveSlot slot = (ActiveSlot) this.container.otherInventorySlots.get(slotIter);
if (slot.getActive())
{
this.drawSlotInventory(slot);
if (this.isMouseOverSlot(slot, mouseX, mouseY))
{
this.mainSlot = slot;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
slotXPos = slot.xDisplayPosition;
slotYPos = slot.yDisplayPosition;
this.drawGradientRect(slotXPos, slotYPos, slotXPos + 16, slotYPos + 16, -2130706433, -2130706433);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
}
}*/
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory;
ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack;
if (itemstack != null)
{
byte b0 = 8;
slotYPos = this.draggedStack == null ? 8 : 16;
String s = null;
if (this.draggedStack != null && this.isRightMouseClick)
{
itemstack = itemstack.copy();
itemstack.stackSize = MathHelper.ceiling_float_int((float) itemstack.stackSize / 2.0F);
}
else if (this.field_94076_q && this.field_94077_p.size() > 1)
{
itemstack = itemstack.copy();
itemstack.stackSize = this.field_94069_F;
if (itemstack.stackSize == 0)
{
s = "" + EnumChatFormatting.YELLOW + "0";
}
}
this.drawItemStack(itemstack, mouseX - gLeft - b0, mouseY - gTop - slotYPos, s);
}
if (this.returningStack != null)
{
float f1 = (float) (Minecraft.getSystemTime() - this.returningStackTime) / 100.0F;
if (f1 >= 1.0F)
{
f1 = 1.0F;
this.returningStack = null;
}
slotXPos = this.returningStackDestSlot.xDisplayPosition - this.field_85049_r;
slotYPos = this.returningStackDestSlot.yDisplayPosition - this.field_85048_s;
int xPos = this.field_85049_r + (int) ((float) slotXPos * f1);
int yPos = this.field_85048_s + (int) ((float) slotYPos * f1);
this.drawItemStack(this.returningStack, xPos, yPos, (String) null);
}
GL11.glPopMatrix();
if (inventoryplayer.getItemStack() == null && this.mainSlot != null && this.mainSlot.getHasStack())
{
ItemStack itemstack1 = this.mainSlot.getStack();
this.drawItemStackTooltip(itemstack1, mouseX, mouseY);
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
}
protected void drawItemStack (ItemStack par1ItemStack, int par2, int par3, String par4Str)
{
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
itemRenderer.zLevel = 200.0F;
itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, par1ItemStack, par2, par3);
itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str);
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
}
protected void drawItemStackTooltip (ItemStack par1ItemStack, int par2, int par3)
{
List list = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
for (int k = 0; k < list.size(); ++k)
{
if (k == 0)
{
list.set(k, "\u00a7" + Integer.toHexString(par1ItemStack.getRarity().rarityColor) + (String) list.get(k));
}
else
{
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
}
}
this.func_102021_a(list, par2, par3);
}
/**
* Draws the text when mouse is over creative inventory tab. Params: current creative tab to be checked, current
* mouse x position, current mouse y position.
*/
protected void drawCreativeTabHoveringText (String par1Str, int par2, int par3)
{
this.func_102021_a(Arrays.asList(new String[] { par1Str }), par2, par3);
}
protected void func_102021_a (List par1List, int par2, int par3)
{
if (!par1List.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
int k = 0;
Iterator iterator = par1List.iterator();
while (iterator.hasNext())
{
String s = (String) iterator.next();
int l = this.fontRenderer.getStringWidth(s);
if (l > k)
{
k = l;
}
}
int i1 = par2 + 12;
int j1 = par3 - 12;
int k1 = 8;
if (par1List.size() > 1)
{
k1 += 2 + (par1List.size() - 1) * 10;
}
if (i1 + k > this.width)
{
i1 -= 28 + k;
}
if (j1 + k1 + 6 > this.height)
{
j1 = this.height - k1 - 6;
}
this.zLevel = 300.0F;
itemRenderer.zLevel = 300.0F;
int l1 = -267386864;
this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
int i2 = 1347420415;
int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
for (int k2 = 0; k2 < par1List.size(); ++k2)
{
String s1 = (String) par1List.get(k2);
this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1);
if (k2 == 0)
{
j1 += 2;
}
j1 += 10;
}
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
}
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected abstract void drawGuiContainerBackgroundLayer (float f, int i, int j);
/**
* Draws an inventory slot
*/
protected void drawSlotInventory (Slot par1Slot)
{
int i = par1Slot.xDisplayPosition;
int j = par1Slot.yDisplayPosition;
ItemStack itemstack = par1Slot.getStack();
boolean flag = false;
boolean flag1 = par1Slot == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick;
ItemStack itemstack1 = this.mc.thePlayer.inventory.getItemStack();
String s = null;
if (par1Slot == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
{
itemstack = itemstack.copy();
itemstack.stackSize /= 2;
}
else if (this.field_94076_q && this.field_94077_p.contains(par1Slot) && itemstack1 != null)
{
if (this.field_94077_p.size() == 1)
{
return;
}
if (Container.func_94527_a(par1Slot, itemstack1, true) && this.container.canDragIntoSlot(par1Slot))
{
itemstack = itemstack1.copy();
flag = true;
Container.func_94525_a(this.field_94077_p, this.field_94071_C, itemstack, par1Slot.getStack() == null ? 0 : par1Slot.getStack().stackSize);
if (itemstack.stackSize > itemstack.getMaxStackSize())
{
s = EnumChatFormatting.YELLOW + "" + itemstack.getMaxStackSize();
itemstack.stackSize = itemstack.getMaxStackSize();
}
if (itemstack.stackSize > par1Slot.getSlotStackLimit())
{
s = EnumChatFormatting.YELLOW + "" + par1Slot.getSlotStackLimit();
itemstack.stackSize = par1Slot.getSlotStackLimit();
}
}
else
{
this.field_94077_p.remove(par1Slot);
this.func_94066_g();
}
}
this.zLevel = 100.0F;
itemRenderer.zLevel = 100.0F;
if (itemstack == null)
{
Icon icon = par1Slot.getBackgroundIconIndex();
if (icon != null)
{
GL11.glDisable(GL11.GL_LIGHTING);
this.mc.func_110434_K().func_110577_a(TextureMap.field_110576_c);
this.drawTexturedModelRectFromIcon(i, j, icon, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
flag1 = true;
}
}
if (!flag1)
{
if (flag)
{
drawRect(i, j, i + 16, j + 16, -2130706433);
}
GL11.glEnable(GL11.GL_DEPTH_TEST);
itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, i, j);
itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, i, j, s);
}
itemRenderer.zLevel = 0.0F;
this.zLevel = 0.0F;
}
protected void func_94066_g ()
{
ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
if (itemstack != null && this.field_94076_q)
{
this.field_94069_F = itemstack.stackSize;
ItemStack itemstack1;
int i;
for (Iterator iterator = this.field_94077_p.iterator(); iterator.hasNext(); this.field_94069_F -= itemstack1.stackSize - i)
{
Slot slot = (Slot) iterator.next();
itemstack1 = itemstack.copy();
i = slot.getStack() == null ? 0 : slot.getStack().stackSize;
Container.func_94525_a(this.field_94077_p, this.field_94071_C, itemstack1, i);
if (itemstack1.stackSize > itemstack1.getMaxStackSize())
{
itemstack1.stackSize = itemstack1.getMaxStackSize();
}
if (itemstack1.stackSize > slot.getSlotStackLimit())
{
itemstack1.stackSize = slot.getSlotStackLimit();
}
}
}
}
/**
* Returns the slot at the given coordinates or null if there is none.
*/
protected Slot getSlotAtPosition (int mouseX, int mouseY)
{
for (int k = 0; k < this.container.inventorySlots.size(); ++k)
{
Slot slot = (Slot) this.container.inventorySlots.get(k);
if (this.isMouseOverSlot(slot, mouseX, mouseY))
{
return slot;
}
}
return null;
}
/**
* Called when the mouse is clicked.
*/
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
{
super.mouseClicked(mouseX, mouseY, mouseButton);
boolean flag = mouseButton == this.mc.gameSettings.keyBindPickBlock.keyCode + 100;
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
long l = Minecraft.getSystemTime();
this.field_94074_J = this.field_94072_H == slot && l - this.field_94070_G < 250L && this.field_94073_I == mouseButton;
this.field_94068_E = false;
if (mouseButton == 0 || mouseButton == 1 || flag)
{
int gLeft = this.guiLeft;
int gTop = this.guiTop;
boolean flag1 = mouseX < gLeft || mouseY < gTop || mouseX >= gLeft + this.xSize || mouseY >= gTop + this.ySize;
int k1 = -1;
if (slot != null)
{
k1 = slot.slotNumber;
}
if (flag1)
{
k1 = -999;
}
if (this.mc.gameSettings.touchscreen && flag1 && this.mc.thePlayer.inventory.getItemStack() == null)
{
this.mc.displayGuiScreen((GuiScreen) null);
return;
}
if (k1 != -1)
{
if (this.mc.gameSettings.touchscreen)
{
if (slot != null && slot.getHasStack())
{
this.clickedSlot = slot;
this.draggedStack = null;
this.isRightMouseClick = mouseButton == 1;
}
else
{
this.clickedSlot = null;
}
}
else if (!this.field_94076_q)
{
if (this.mc.thePlayer.inventory.getItemStack() == null)
{
if (mouseButton == this.mc.gameSettings.keyBindPickBlock.keyCode + 100)
{
this.handleMouseClick(slot, k1, mouseButton, 3);
}
else
{
boolean flag2 = k1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
byte b0 = 0;
if (flag2)
{
this.field_94075_K = slot != null && slot.getHasStack() ? slot.getStack() : null;
b0 = 1;
}
else if (k1 == -999)
{
b0 = 4;
}
this.handleMouseClick(slot, k1, mouseButton, b0);
}
this.field_94068_E = true;
}
else
{
this.field_94076_q = true;
this.field_94067_D = mouseButton;
this.field_94077_p.clear();
if (mouseButton == 0)
{
this.field_94071_C = 0;
}
else if (mouseButton == 1)
{
this.field_94071_C = 1;
}
}
}
}
}
this.field_94072_H = slot;
this.field_94070_G = l;
this.field_94073_I = mouseButton;
}
protected void func_85041_a (int par1, int par2, int par3, long par4)
{
Slot slot = this.getSlotAtPosition(par1, par2);
ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen)
{
if (par3 == 0 || par3 == 1)
{
if (this.draggedStack == null)
{
if (slot != this.clickedSlot)
{
this.draggedStack = this.clickedSlot.getStack().copy();
}
}
else if (this.draggedStack.stackSize > 1 && slot != null && Container.func_94527_a(slot, this.draggedStack, false))
{
long i1 = Minecraft.getSystemTime();
if (this.field_92033_y == slot)
{
if (i1 - this.field_92032_z > 500L)
{
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
this.handleMouseClick(slot, slot.slotNumber, 1, 0);
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
this.field_92032_z = i1 + 750L;
--this.draggedStack.stackSize;
}
}
else
{
this.field_92033_y = slot;
this.field_92032_z = i1;
}
}
}
}
else if (this.field_94076_q && slot != null && itemstack != null && itemstack.stackSize > this.field_94077_p.size() && Container.func_94527_a(slot, itemstack, true)
&& slot.isItemValid(itemstack) && this.container.canDragIntoSlot(slot))
{
this.field_94077_p.add(slot);
this.func_94066_g();
}
}
/**
* Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is
* mouseMove, which==0 or which==1 is mouseUp
*/
protected void mouseMovedOrUp (int par1, int par2, int par3)
{
Slot slot = this.getSlotAtPosition(par1, par2);
int l = this.guiLeft;
int i1 = this.guiTop;
boolean flag = par1 < l || par2 < i1 || par1 >= l + this.xSize || par2 >= i1 + this.ySize;
int j1 = -1;
if (slot != null)
{
j1 = slot.slotNumber;
}
if (flag)
{
j1 = -999;
}
Slot slot1;
Iterator iterator;
if (this.field_94074_J && slot != null && par3 == 0 && this.container.func_94530_a((ItemStack) null, slot))
{
if (isShiftKeyDown())
{
if (slot != null && slot.inventory != null && this.field_94075_K != null)
{
iterator = this.container.inventorySlots.iterator();
while (iterator.hasNext())
{
slot1 = (Slot) iterator.next();
if (slot1 != null && slot1.canTakeStack(this.mc.thePlayer) && slot1.getHasStack() && slot1.inventory == slot.inventory
&& Container.func_94527_a(slot1, this.field_94075_K, true))
{
this.handleMouseClick(slot1, slot1.slotNumber, par3, 1);
}
}
}
}
else
{
this.handleMouseClick(slot, j1, par3, 6);
}
this.field_94074_J = false;
this.field_94070_G = 0L;
}
else
{
if (this.field_94076_q && this.field_94067_D != par3)
{
this.field_94076_q = false;
this.field_94077_p.clear();
this.field_94068_E = true;
return;
}
if (this.field_94068_E)
{
this.field_94068_E = false;
return;
}
boolean flag1;
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen)
{
if (par3 == 0 || par3 == 1)
{
if (this.draggedStack == null && slot != this.clickedSlot)
{
this.draggedStack = this.clickedSlot.getStack();
}
flag1 = Container.func_94527_a(slot, this.draggedStack, false);
if (j1 != -1 && this.draggedStack != null && flag1)
{
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, par3, 0);
this.handleMouseClick(slot, j1, 0, 0);
if (this.mc.thePlayer.inventory.getItemStack() != null)
{
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, par3, 0);
this.field_85049_r = par1 - l;
this.field_85048_s = par2 - i1;
this.returningStackDestSlot = this.clickedSlot;
this.returningStack = this.draggedStack;
this.returningStackTime = Minecraft.getSystemTime();
}
else
{
this.returningStack = null;
}
}
else if (this.draggedStack != null)
{
this.field_85049_r = par1 - l;
this.field_85048_s = par2 - i1;
this.returningStackDestSlot = this.clickedSlot;
this.returningStack = this.draggedStack;
this.returningStackTime = Minecraft.getSystemTime();
}
this.draggedStack = null;
this.clickedSlot = null;
}
}
else if (this.field_94076_q && !this.field_94077_p.isEmpty())
{
this.handleMouseClick((Slot) null, -999, Container.func_94534_d(0, this.field_94071_C), 5);
iterator = this.field_94077_p.iterator();
while (iterator.hasNext())
{
slot1 = (Slot) iterator.next();
this.handleMouseClick(slot1, slot1.slotNumber, Container.func_94534_d(1, this.field_94071_C), 5);
}
this.handleMouseClick((Slot) null, -999, Container.func_94534_d(2, this.field_94071_C), 5);
}
else if (this.mc.thePlayer.inventory.getItemStack() != null)
{
if (par3 == this.mc.gameSettings.keyBindPickBlock.keyCode + 100)
{
this.handleMouseClick(slot, j1, par3, 3);
}
else
{
flag1 = j1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
if (flag1)
{
this.field_94075_K = slot != null && slot.getHasStack() ? slot.getStack() : null;
}
this.handleMouseClick(slot, j1, par3, flag1 ? 1 : 0);
}
}
}
if (this.mc.thePlayer.inventory.getItemStack() == null)
{
this.field_94070_G = 0L;
}
this.field_94076_q = false;
}
/**
* Returns if the passed mouse position is over the specified slot.
*/
protected boolean isMouseOverSlot (Slot slot, int mouseX, int mouseY)
{
if (!(slot instanceof ActiveSlot) || ((ActiveSlot) slot).getActive())
{
return this.isPointInRegion(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY);
}
return false;
}
/**
* Args: left, top, width, height, pointX, pointY. Note: left, top are local to Gui, pointX, pointY are local to
* screen
*/
protected boolean isPointInRegion (int par1, int par2, int par3, int par4, int par5, int par6)
{
int k1 = this.guiLeft;
int l1 = this.guiTop;
par5 -= k1;
par6 -= l1;
return par5 >= par1 - 1 && par5 < par1 + par3 + 1 && par6 >= par2 - 1 && par6 < par2 + par4 + 1;
}
protected void handleMouseClick (Slot par1Slot, int par2, int par3, int par4)
{
if (par1Slot != null)
{
par2 = par1Slot.slotNumber;
}
this.mc.playerController.windowClick(this.container.windowId, par2, par3, par4, this.mc.thePlayer);
}
/**
* Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
*/
protected void keyTyped (char par1, int par2)
{
if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.keyCode)
{
this.mc.thePlayer.closeScreen();
}
this.checkHotbarKeys(par2);
if (this.mainSlot != null && this.mainSlot.getHasStack())
{
if (par2 == this.mc.gameSettings.keyBindPickBlock.keyCode)
{
this.handleMouseClick(this.mainSlot, this.mainSlot.slotNumber, 0, 3);
}
else if (par2 == this.mc.gameSettings.keyBindDrop.keyCode)
{
this.handleMouseClick(this.mainSlot, this.mainSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, 4);
}
}
}
/**
* This function is what controls the hotbar shortcut check when you press a number key when hovering a stack.
*/
protected boolean checkHotbarKeys (int par1)
{
if (this.mc.thePlayer.inventory.getItemStack() == null && this.mainSlot != null)
{
for (int j = 0; j < 9; ++j)
{
if (par1 == 2 + j)
{
this.handleMouseClick(this.mainSlot, this.mainSlot.slotNumber, j, 2);
return true;
}
}
}
return false;
}
/**
* Called when the screen is unloaded. Used to disable keyboard repeat events
*/
public void onGuiClosed ()
{
if (this.mc.thePlayer != null)
{
this.container.onContainerClosed(this.mc.thePlayer);
}
}
/**
* Returns true if this GUI should pause the game when it is displayed in single-player
*/
public boolean doesGuiPauseGame ()
{
return false;
}
/**
* Called from the main game loop to update the screen.
*/
public void updateScreen ()
{
super.updateScreen();
if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead)
{
this.mc.thePlayer.closeScreen();
}
}
}
+297
View File
@@ -0,0 +1,297 @@
package tconstruct.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.PartCrafterLogic;
import tconstruct.inventory.ActiveContainer;
import tconstruct.inventory.PartCrafterChestContainer;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.tools.ToolMaterial;
public class PartCrafterGui extends NewContainerGui
{
PartCrafterLogic logic;
String title, otherTitle = "";
boolean drawChestPart;
boolean hasTop, hasBottom;
ItemStack topMaterial, bottomMaterial;
ToolMaterial topEnum, bottomEnum;
public PartCrafterGui(InventoryPlayer inventoryplayer, PartCrafterLogic partlogic, World world, int x, int y, int z)
{
super((ActiveContainer) partlogic.getGuiContainer(inventoryplayer, world, x, y, z));
logic = partlogic;
drawChestPart = container instanceof PartCrafterChestContainer;
title = "\u00A7nTool Part Crafting";
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("crafters.PartBuilder"), 6, 6, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
if (drawChestPart)
this.fontRenderer.drawString(StatCollector.translateToLocal("inventory.PatternChest"), -108, this.ySize - 148, 4210752);
drawMaterialInformation();
}
void drawDefaultInformation ()
{
title = "\u00A7nTool Part Building";
this.drawCenteredString(fontRenderer, title, xSize + 63, 8, 16777215);
fontRenderer.drawSplitString("Place a pattern and a material on the left to get started.", xSize + 8, 24, 115, 16777215);
}
void drawMaterialInformation ()
{
ItemStack top = logic.getStackInSlot(2);
ItemStack bottom = logic.getStackInSlot(3);
if (topMaterial != top)
{
topMaterial = top;
int topID = PatternBuilder.instance.getPartID(top);
if (topID != Short.MAX_VALUE)
{
topEnum = TConstructRegistry.getMaterial(topID);
hasTop = true;
title = "\u00A7n" + topEnum.name();
}
else
hasTop = false;
}
if (bottomMaterial != bottom)
{
bottomMaterial = bottom;
int bottomID = PatternBuilder.instance.getPartID(bottom);
if (bottomID != Short.MAX_VALUE)
{
bottomEnum = TConstructRegistry.getMaterial(bottomID);
hasBottom = true;
otherTitle = "\u00A7n" + bottomEnum.name();
}
else
hasBottom = false;
}
int offset = 8;
if (hasTop)
{
this.drawCenteredString(fontRenderer, title, xSize + 63, offset, 16777215);
this.fontRenderer.drawString("Base Durability: " + topEnum.durability(), xSize + 8, offset + 16, 16777215);
this.fontRenderer.drawString("Handle Modifier: " + topEnum.handleDurability() + "x", xSize + 8, offset + 27, 16777215);
this.fontRenderer.drawString("Mining Speed: " + topEnum.toolSpeed() / 100f, xSize + 8, offset + 38, 16777215);
this.fontRenderer.drawString("Mining Level: " + getHarvestLevelName(topEnum.harvestLevel()), xSize + 8, offset + 49, 16777215);
int attack = topEnum.attack();
String heart = attack == 2 ? " Heart" : " Hearts";
if (attack % 2 == 0)
this.fontRenderer.drawString("Attack: " + attack / 2 + heart, xSize + 8, offset + 60, 0xffffff);
else
this.fontRenderer.drawString("Attack: " + attack / 2f + heart, xSize + 8, offset + 60, 0xffffff);
}
offset = 90;
if (hasBottom)
{
this.drawCenteredString(fontRenderer, otherTitle, xSize + 63, offset, 16777215);
this.fontRenderer.drawString("Base Durability: " + bottomEnum.durability(), xSize + 8, offset + 16, 16777215);
this.fontRenderer.drawString("Handle Modifier: " + bottomEnum.handleDurability() + "x", xSize + 8, offset + 27, 16777215);
this.fontRenderer.drawString("Mining Speed: " + bottomEnum.toolSpeed() / 100f, xSize + 8, offset + 38, 16777215);
this.fontRenderer.drawString("Mining Level: " + getHarvestLevelName(bottomEnum.harvestLevel()), xSize + 8, offset + 49, 16777215);
int attack = bottomEnum.attack();
String heart = attack == 2 ? " Heart" : " Hearts";
if (attack % 2 == 0)
this.fontRenderer.drawString("Attack: " + attack / 2 + heart, xSize + 8, offset + 60, 0xffffff);
else
this.fontRenderer.drawString("Attack: " + attack / 2f + heart, xSize + 8, offset + 60, 0xffffff);
}
if (!hasTop && !hasBottom)
drawDefaultInformation();
}
public static String getHarvestLevelName (int num)
{
switch (num)
{
case 0:
return "Stone";
case 1:
return "Iron";
case 2:
return "Redstone";
case 3:
return "Obsidian";
case 4:
return "Cobalt";
case 5:
return "Manyullyn";
default:
return String.valueOf(num);
}
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/toolparts.png");
private static final ResourceLocation minichest = new ResourceLocation("tinker", "textures/gui/patternchestmini.png");
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
{
// Draw the background
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
// Draw Slots
this.drawTexturedModalRect(cornerX + 39, cornerY + 26, 0, 166, 98, 36);
if (!logic.isStackInSlot(0))
{
this.drawTexturedModalRect(cornerX + 39, cornerY + 26, 176, 0, 18, 18);
}
if (!logic.isStackInSlot(2))
{
this.drawTexturedModalRect(cornerX + 57, cornerY + 26, 176, 18, 18, 18);
}
if (!logic.isStackInSlot(1))
{
this.drawTexturedModalRect(cornerX + 39, cornerY + 44, 176, 0, 18, 18);
}
if (!logic.isStackInSlot(3))
{
this.drawTexturedModalRect(cornerX + 57, cornerY + 44, 176, 36, 18, 18);
}
// Draw chest
if (drawChestPart)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(minichest);
this.drawTexturedModalRect(cornerX - 116, cornerY + 11, 0, 0, this.xSize, this.ySize);
}
// Draw description
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(description);
cornerX = (this.width + this.xSize) / 2;
cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 126, 0, 126, this.ySize);
}
@Override
protected void mouseClicked (int mouseX, int mouseY, int clickNum)
{
boolean flag = clickNum == this.mc.gameSettings.keyBindPickBlock.keyCode + 100;
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
long l = Minecraft.getSystemTime();
this.field_94074_J = this.field_94072_H == slot && l - this.field_94070_G < 250L && this.field_94073_I == clickNum;
this.field_94068_E = false;
int offsetLeft = drawChestPart ? 108 : 0;
if (clickNum == 0 || clickNum == 1 || flag)
{
int i1 = this.guiLeft;
int j1 = this.guiTop;
boolean flag1 = mouseX < i1 - offsetLeft || mouseY < j1 || mouseX >= i1 + this.xSize || mouseY >= j1 + this.ySize;
int k1 = -1;
if (slot != null)
{
k1 = slot.slotNumber;
}
if (flag1)
{
k1 = -999;
}
if (this.mc.gameSettings.touchscreen && flag1 && this.mc.thePlayer.inventory.getItemStack() == null)
{
this.mc.displayGuiScreen((GuiScreen) null);
return;
}
if (k1 != -1)
{
if (this.mc.gameSettings.touchscreen)
{
if (slot != null && slot.getHasStack())
{
this.clickedSlot = slot;
this.draggedStack = null;
this.isRightMouseClick = clickNum == 1;
}
else
{
this.clickedSlot = null;
}
}
else if (!this.field_94076_q)
{
if (this.mc.thePlayer.inventory.getItemStack() == null)
{
if (clickNum == this.mc.gameSettings.keyBindPickBlock.keyCode + 100)
{
this.handleMouseClick(slot, k1, clickNum, 3);
}
else
{
boolean flag2 = k1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
byte b0 = 0;
if (flag2)
{
this.field_94075_K = slot != null && slot.getHasStack() ? slot.getStack() : null;
b0 = 1;
}
else if (k1 == -999)
{
b0 = 4;
}
this.handleMouseClick(slot, k1, clickNum, b0);
}
this.field_94068_E = true;
}
else
{
this.field_94076_q = true;
this.field_94067_D = clickNum;
this.field_94077_p.clear();
if (clickNum == 0)
{
this.field_94071_C = 0;
}
else if (clickNum == 1)
{
this.field_94071_C = 1;
}
}
}
}
}
this.field_94072_H = slot;
this.field_94070_G = l;
this.field_94073_I = clickNum;
}
}
@@ -0,0 +1,41 @@
package tconstruct.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.PatternChestLogic;
public class PatternChestGui extends GuiContainer
{
public PatternChestLogic logic;
public PatternChestGui(InventoryPlayer inventoryplayer, PatternChestLogic holder, World world, int x, int y, int z)
{
super(holder.getGuiContainer(inventoryplayer, world, x, y, z));
logic = holder;
xSize = 194;
ySize = 168;
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
fontRenderer.drawString(StatCollector.translateToLocal("inventory.PatternChest"), 60, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternchest.png");
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
}
}
+384
View File
@@ -0,0 +1,384 @@
package tconstruct.client.gui;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.blocks.logic.SmelteryLogic;
import tconstruct.inventory.ActiveContainer;
import tconstruct.inventory.SmelteryContainer;
public class SmelteryGui extends NewContainerGui
{
public SmelteryLogic logic;
String username;
boolean isScrolling = false;
boolean wasClicking;
float currentScroll = 0.0F;
int slotPos = 0;
int prevSlotPos = 0;
public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, World world, int x, int y, int z)
{
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
logic = smeltery;
username = inventoryplayer.player.username;
xSize = 248;
smeltery.updateFuelDisplay();
}
public void drawScreen (int mouseX, int mouseY, float par3)
{
super.drawScreen(mouseX, mouseY, par3);
updateScrollbar(mouseX, mouseY, par3);
}
protected void updateScrollbar (int mouseX, int mouseY, float par3)
{
if (logic.layers > 2)
{
boolean mouseDown = Mouse.isButtonDown(0);
int lefto = this.guiLeft;
int topo = this.guiTop;
int xScroll = lefto + 67;
int yScroll = topo + 8;
int scrollWidth = xScroll + 14;
int scrollHeight = yScroll + 144;
if (!this.wasClicking && mouseDown && mouseX >= xScroll && mouseY >= yScroll && mouseX < scrollWidth && mouseY < scrollHeight)
{
this.isScrolling = true;
}
if (!mouseDown)
{
this.isScrolling = false;
}
if (wasClicking && !isScrolling && slotPos != prevSlotPos)
{
prevSlotPos = slotPos;
}
this.wasClicking = mouseDown;
if (this.isScrolling)
{
this.currentScroll = ((float) (mouseY - yScroll) - 7.5F) / ((float) (scrollHeight - yScroll) - 15.0F);
if (this.currentScroll < 0.0F)
{
this.currentScroll = 0.0F;
}
if (this.currentScroll > 1.0F)
{
this.currentScroll = 1.0F;
}
int s = ((SmelteryContainer) this.container).scrollTo(this.currentScroll);
if (s != -1)
slotPos = s;
}
}
}
protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
{
fontRenderer.drawString(StatCollector.translateToLocal("crafters.Smeltery"), 86, 5, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 90, (ySize - 96) + 2, 0x404040);
int base = 0;
int cornerX = (width - xSize) / 2 + 36;
int cornerY = (height - ySize) / 2;
for (FluidStack liquid : logic.moltenMetal)
{
int basePos = 54;
int initialLiquidSize = 0;
int liquidSize = 0;//liquid.amount * 52 / liquidLayers;
if (logic.getCapacity() > 0)
{
int total = logic.getTotalLiquid();
int liquidLayers = (total / 20000 + 1) * 20000;
liquidSize = liquid.amount * 52 / liquidLayers;
if (liquidSize == 0)
liquidSize = 1;
base += liquidSize;
}
int leftX = cornerX + basePos;
int topY = (cornerY + 68) - base;
int sizeX = 52;
int sizeY = liquidSize;
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
{
drawFluidStackTooltip(liquid, mouseX - cornerX + 36, mouseY - cornerY);
}
}
if (logic.fuelGague > 0)
{
int leftX = cornerX + 117;
int topY = (cornerY + 68) - logic.getScaledFuelGague(52);
int sizeX = 12;
int sizeY = logic.getScaledFuelGague(52);
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
{
drawFluidStackTooltip(new FluidStack(Block.lavaStill.blockID, logic.fuelAmount), mouseX - cornerX + 36, mouseY - cornerY);
}
}
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/smeltery.png");
private static final ResourceLocation backgroundSide = new ResourceLocation("tinker", "textures/gui/smelteryside.png");
private static final ResourceLocation terrain = new ResourceLocation("terrain.png");
protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (width - xSize) / 2 + 36;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize);
//Fuel - Lava
this.mc.func_110434_K().func_110577_a(TextureMap.field_110575_b);
if (logic.fuelGague > 0)
{
Icon lavaIcon = Block.lavaStill.getIcon(0, 0);
int fuel = logic.getScaledFuelGague(52);
int count = 0;
while (fuel > 0)
{
int size = fuel >= 16 ? 16 : fuel;
fuel -= size;
drawLiquidRect(cornerX + 117, (cornerY + 68) - size - 16 * count, lavaIcon, 12, size);
count++;
}
}
//Liquids - molten metal
int base = 0;
for (FluidStack liquid : logic.moltenMetal)
{
Icon renderIndex = liquid.getFluid().getStillIcon();
int basePos = 54;
if (logic.getCapacity() > 0)
{
int total = logic.getTotalLiquid();
int liquidLayers = (total / 20000 + 1) * 20000;
int liquidSize = liquid.amount * 52 / liquidLayers;
if (liquidSize == 0)
liquidSize = 1;
while (liquidSize > 0)
{
int size = liquidSize >= 16 ? 16 : liquidSize;
drawLiquidRect(cornerX + basePos, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 16, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 32, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 48, (cornerY + 68) - size - base, renderIndex, 4, size);
liquidSize -= size;
base += size;
}
}
}
//Liquid gague
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
drawTexturedModalRect(cornerX + 54, cornerY + 16, 176, 76, 52, 52);
//Side inventory
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(backgroundSide);
if (logic.layers > 0)
{
if (logic.layers == 1)
{
drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 43);
drawTexturedModalRect(cornerX - 46, cornerY + 43, 0, 133, 98, 25);
}
else if (logic.layers == 2)
{
drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 61);
drawTexturedModalRect(cornerX - 46, cornerY + 61, 0, 97, 98, 61);
}
else
{
drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, ySize - 8);
}
drawTexturedModalRect(cornerX + 32, (int) (cornerY + 8 + 127 * currentScroll), 98, 0, 12, 15);
}
//Temperature
int slotSize = logic.layers * 9;
if (slotSize > 24)
slotSize = 24;
for (int iter = 0; iter < slotSize; iter++)
{
int slotTemp = logic.getTempForSlot(iter + slotPos * 3) - 20;
int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * 3) - 20;
if (slotTemp > 0 && maxTemp > 0)
{
int size = 16 * slotTemp / maxTemp + 1;
drawTexturedModalRect(cornerX - 38 + (iter % 3 * 22), cornerY + 8 + (iter / 3 * 18) + 16 - size, 98, 15 + 16 - size, 5, size);
}
}
}
protected void drawFluidStackTooltip (FluidStack par1ItemStack, int par2, int par3)
{
this.zLevel = 100;
List list = getLiquidTooltip(par1ItemStack, this.mc.gameSettings.advancedItemTooltips);
for (int k = 0; k < list.size(); ++k)
{
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
}
this.drawToolTip(list, par2, par3);
this.zLevel = 0;
}
public List getLiquidTooltip (FluidStack liquid, boolean par2)
{
ArrayList list = new ArrayList();
if (liquid.getFluid().getBlockID() == Block.lavaStill.blockID)
{
list.add("\u00A7fFuel");
int mB = liquid.amount;
if (mB > 0)
list.add("mB: " + mB);
}
else
{
String name = FluidRegistry.getFluidName(liquid);
list.add("\u00A7f" + name);
if (name.equals("Liquified Emerald"))
{
float emeralds = liquid.amount / 320f;
list.add("Emeralds: " + emeralds);
}
else
{
int ingots = liquid.amount / 144;
if (ingots > 0)
list.add("Ingots: " + ingots);
int mB = liquid.amount % 144;
if (mB > 0)
{
if (mB % 72 == 0)
list.add("Chunks: " + liquid.amount % 144 / 72);
else if (mB % 16 == 0)
list.add("Nuggets: " + liquid.amount % 144 / 16);
else
list.add("mB: " + mB);
}
}
}
return list;
}
protected void drawToolTip (List par1List, int par2, int par3)
{
if (!par1List.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
int k = 0;
Iterator iterator = par1List.iterator();
while (iterator.hasNext())
{
String s = (String) iterator.next();
int l = this.fontRenderer.getStringWidth(s);
if (l > k)
{
k = l;
}
}
int i1 = par2 + 12;
int j1 = par3 - 12;
int k1 = 8;
if (par1List.size() > 1)
{
k1 += 2 + (par1List.size() - 1) * 10;
}
if (i1 + k > this.width)
{
i1 -= 28 + k;
}
if (j1 + k1 + 6 > this.height)
{
j1 = this.height - k1 - 6;
}
this.zLevel = 300.0F;
itemRenderer.zLevel = 300.0F;
int l1 = -267386864;
this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
int i2 = 1347420415;
int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
for (int k2 = 0; k2 < par1List.size(); ++k2)
{
String s1 = (String) par1List.get(k2);
this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1);
if (k2 == 0)
{
j1 += 2;
}
j1 += 10;
}
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
}
}
public void drawLiquidRect (int startU, int startV, Icon par3Icon, int endU, int endV)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (startU + 0), (double) (startV + endV), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());//Bottom left
tessellator.addVertexWithUV((double) (startU + endU), (double) (startV + endV), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());//Bottom right
tessellator.addVertexWithUV((double) (startU + endU), (double) (startV + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());//Top right
tessellator.addVertexWithUV((double) (startU + 0), (double) (startV + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV()); //Top left
tessellator.draw();
}
}
+148
View File
@@ -0,0 +1,148 @@
package tconstruct.client.gui;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.StencilTableLogic;
import tconstruct.common.TContent;
import tconstruct.inventory.PatternShaperContainer;
import cpw.mods.fml.common.network.PacketDispatcher;
public class StencilTableGui extends GuiContainer
{
StencilTableLogic logic;
int patternIndex;
public StencilTableGui(InventoryPlayer inventoryplayer, StencilTableLogic shaper, World world, int x, int y, int z)
{
super(new PatternShaperContainer(inventoryplayer, shaper));
logic = shaper;
patternIndex = 0;
}
public void onGuiClosed ()
{
super.onGuiClosed();
}
@Override
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
fontRenderer.drawString(StatCollector.translateToLocal("crafters.PatternShaper"), 50, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternshaper.png");
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
if (!logic.isStackInSlot(0))
{
this.drawTexturedModalRect(cornerX + 47, cornerY + 34, 176, 0, 18, 18);
}
}
public void initGui ()
{
super.initGui();
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.buttonList.clear();
/*ToolGuiElement repair = TConstruct.toolButtons.get(0);
GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.texture); // Repair
repairButton.enabled = false;
this.buttonList.add(repairButton);*/
this.buttonList.add(new GuiButton(0, cornerX - 120, cornerY, 120, 20, "Next Pattern"));
this.buttonList.add(new GuiButton(1, cornerX - 120, cornerY + 20, 120, 20, "Previous Pattern"));
//for (int iter = 0; iter < TConstructContent.patternOutputs.length; iter++)
//{
/*ToolGuiElement element = TConstruct.toolButtons.get(iter);
GuiButtonTool button = new GuiButtonTool(iter, cornerX - 110 + 22 * (iter % 5), cornerY + 22 * (iter / 5), element.buttonIconX, element.buttonIconY, element.texture); // Repair
this.buttonList.add(button);*/
//}
}
protected void actionPerformed (GuiButton button)
{
ItemStack pattern = logic.getStackInSlot(0);
if (pattern != null && pattern.getItem() == TContent.blankPattern)
{
int meta = pattern.getItemDamage();
if (meta == 0)
{
if (button.id == 0)
{
patternIndex++;
if (patternIndex == 21)
patternIndex++;
if (patternIndex >= TContent.patternOutputs.length)
patternIndex = 0;
}
else if (button.id == 1)
{
patternIndex--;
if (patternIndex == 21)
patternIndex--;
if (patternIndex < 0)
patternIndex = TContent.patternOutputs.length - 1;
}
ItemStack stack = new ItemStack(TContent.woodPattern, 1, patternIndex + 1);
logic.setInventorySlotContents(1, stack);
updateServer(stack);
}
else if (meta == 1 || meta == 2)
{
ItemStack stack = new ItemStack(TContent.metalPattern, 1, 0);
logic.setInventorySlotContents(1, stack);
updateServer(stack);
}
}
}
void updateServer (ItemStack stack)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(2);
outputStream.writeInt(logic.worldObj.provider.dimensionId);
outputStream.writeInt(logic.xCoord);
outputStream.writeInt(logic.yCoord);
outputStream.writeInt(logic.zCoord);
outputStream.writeShort(stack.itemID);
outputStream.writeShort(stack.getItemDamage());
}
catch (Exception ex)
{
ex.printStackTrace();
}
Packet250CustomPayload packet = new Packet250CustomPayload();
packet.channel = "TConstruct";
packet.data = bos.toByteArray();
packet.length = bos.size();
PacketDispatcher.sendPacketToServer(packet);
}
}
+130
View File
@@ -0,0 +1,130 @@
package tconstruct.client.gui;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.library.client.TConstructClientRegistry;
import tconstruct.library.client.ToolGuiElement;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ToolForgeGui extends ToolStationGui
{
int selectedButton;
public ToolForgeGui(InventoryPlayer inventoryplayer, ToolForgeLogic stationlogic, World world, int x, int y, int z)
{
super(inventoryplayer, stationlogic, world, x, y, z);
}
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
{
super.mouseClicked(mouseX, mouseY, mouseButton);
if (mouseButton == 0)
{
int gLeft = this.guiLeft + 68;
int gTop = this.guiTop + 6;
int gWidth = 102;
int gHeight = 12;
active = mouseX > gLeft && mouseX < gLeft + gWidth && mouseY > gTop && mouseY < gTop + gHeight;
}
}
public void initGui ()
{
super.initGui();
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.buttonList.clear();
ToolGuiElement repair = TConstructClientRegistry.toolButtons.get(0);
GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.domain, repair.texture, repair); // Repair
repairButton.enabled = false;
this.buttonList.add(repairButton);
int offset = TConstructClientRegistry.tierTwoButtons.size();
for (int iter = 0; iter < TConstructClientRegistry.tierTwoButtons.size(); iter++)
{
ToolGuiElement element = TConstructClientRegistry.tierTwoButtons.get(iter);
GuiButtonTool button = new GuiButtonTool(iter + 1, cornerX - 110 + 22 * ((iter + 1) % 5), cornerY + 22 * ((iter + 1) / 5), element.buttonIconX, element.buttonIconY, repair.domain,
element.texture, element);
this.buttonList.add(button);
}
for (int iter = 1; iter < TConstructClientRegistry.toolButtons.size(); iter++)
{
ToolGuiElement element = TConstructClientRegistry.toolButtons.get(iter);
GuiButtonTool button = new GuiButtonTool(iter + offset, cornerX - 110 + 22 * ((iter + offset) % 5), cornerY + 22 * ((iter + offset) / 5), element.buttonIconX, element.buttonIconY,
repair.domain, element.texture, element);
this.buttonList.add(button);
}
}
protected void actionPerformed (GuiButton button)
{
GuiButtonTool b = (GuiButtonTool) button;
((GuiButton) this.buttonList.get(selectedButton)).enabled = true;
selectedButton = button.id;
button.enabled = false;
setSlotType(b.element.slotType);
iconX = b.element.iconsX;
iconY = b.element.iconsY;
title = "\u00A7n" + b.element.title;
body = b.element.body;
}
@Override
void resetGui ()
{
this.text.setText("");
selectedButton = 0;
setSlotType(0);
iconX = new int[] { 0, 1, 2, 13 };
iconY = new int[] { 13, 13, 13, 13 };
title = "\u00A7nRepair and Modification";
body = "The main way to repair or change your tools. Place a tool and a material on the left to get started.";
}
void setSlotType (int type)
{
switch (type)
{
case 0:
slotX = new int[] { 56, 38, 38, 14 }; // Repair
slotY = new int[] { 37, 28, 46, 37 };
break;
case 1:
slotX = new int[] { 56, 56, 56, 14 }; // Three parts
slotY = new int[] { 19, 55, 37, 37 };
break;
case 2:
slotX = new int[] { 56, 56, 14, 14 }; // Two parts
slotY = new int[] { 28, 46, 28, 46 };
break;
case 3:
slotX = new int[] { 38, 47, 56, 14 }; // Double head
slotY = new int[] { 28, 46, 28, 37 };
break;
case 4:
slotX = new int[] { 47, 38, 56, 47 }; // Four parts
slotY = new int[] { 19, 37, 37, 55 };
break;
case 5:
slotX = new int[] { 38, 47, 56, 47 }; // Four parts, double head
slotY = new int[] { 19, 55, 19, 37 };
break;
case 6:
slotX = new int[] { 38, 38, 20, 56 }; // Double head
slotY = new int[] { 28, 46, 28, 28 };
break;
case 7:
slotX = new int[] { 56, 56, 56, 14 }; // Three parts reverse
slotY = new int[] { 19, 37, 55, 37 };
break;
}
toolSlots.resetSlots(slotX, slotY);
}
}
+514
View File
@@ -0,0 +1,514 @@
package tconstruct.client.gui;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import tconstruct.blocks.logic.ToolStationLogic;
import tconstruct.inventory.ActiveContainer;
import tconstruct.inventory.ToolStationContainer;
import tconstruct.library.client.TConstructClientRegistry;
import tconstruct.library.client.ToolGuiElement;
import tconstruct.library.tools.ToolCore;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ToolStationGui extends NewContainerGui
{
public ToolStationLogic logic;
public ToolStationContainer toolSlots;
public GuiTextField text;
public String toolName;
public int guiType;
public int[] slotX, slotY, iconX, iconY;
public boolean active;
public String title, body = "";
public ToolStationGui(InventoryPlayer inventoryplayer, ToolStationLogic stationlogic, World world, int x, int y, int z)
{
super((ActiveContainer) stationlogic.getGuiContainer(inventoryplayer, world, x, y, z));
this.logic = stationlogic;
toolSlots = (ToolStationContainer) container;
text = new GuiTextField(this.fontRenderer, this.xSize / 2 - 5, 8, 30, 12);
this.text.setMaxStringLength(40);
this.text.setEnableBackgroundDrawing(false);
this.text.setVisible(true);
this.text.setCanLoseFocus(false);
this.text.setFocused(true);
this.text.setTextColor(0xffffff);
toolName = "";
resetGui();
Keyboard.enableRepeatEvents(true);
}
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
{
super.mouseClicked(mouseX, mouseY, mouseButton);
if (mouseButton == 0)
{
int gLeft = this.guiLeft + 68;
int gTop = this.guiTop + 6;
int gWidth = 102;
int gHeight = 12;
active = mouseX > gLeft && mouseX < gLeft + gWidth && mouseY > gTop && mouseY < gTop + gHeight;
}
}
void resetGui ()
{
this.text.setText("");
guiType = 0;
setSlotType(0);
iconX = new int[] { 0, 1, 2 };
iconY = new int[] { 13, 13, 13 };
title = "\u00A7nRepair and Modification";
body = "The main way to repair or change your tools. Place a tool and a material on the left to get started.";
}
public void initGui ()
{
super.initGui();
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.buttonList.clear();
ToolGuiElement repair = TConstructClientRegistry.toolButtons.get(0);
GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.domain, repair.texture, repair); // Repair
repairButton.enabled = false;
this.buttonList.add(repairButton);
for (int iter = 1; iter < TConstructClientRegistry.toolButtons.size(); iter++)
{
ToolGuiElement element = TConstructClientRegistry.toolButtons.get(iter);
GuiButtonTool button = new GuiButtonTool(iter, cornerX - 110 + 22 * (iter % 5), cornerY + 22 * (iter / 5), element.buttonIconX, element.buttonIconY, repair.domain, element.texture, element);
this.buttonList.add(button);
}
}
protected void actionPerformed (GuiButton button)
{
((GuiButton) this.buttonList.get(guiType)).enabled = true;
guiType = button.id;
button.enabled = false;
ToolGuiElement element = TConstructClientRegistry.toolButtons.get(guiType);
setSlotType(element.slotType);
iconX = element.iconsX;
iconY = element.iconsY;
title = "\u00A7n" + element.title;
body = element.body;
}
void setSlotType (int type)
{
switch (type)
{
case 0:
slotX = new int[] { 56, 38, 38 }; // Repair
slotY = new int[] { 37, 28, 46 };
break;
case 1:
slotX = new int[] { 56, 56, 56 }; // Three parts
slotY = new int[] { 19, 55, 37 };
break;
case 2:
slotX = new int[] { 56, 56, 14 }; // Two parts
slotY = new int[] { 28, 46, 37 };
break;
case 3:
slotX = new int[] { 38, 47, 56 }; // Double head
slotY = new int[] { 28, 46, 28 };
break;
case 7:
slotX = new int[] { 56, 56, 56 }; // Three parts reverse
slotY = new int[] { 19, 37, 55 };
break;
}
toolSlots.resetSlots(slotX, slotY);
}
public void updateScreen ()
{
super.updateScreen();
this.text.updateCursorCounter();
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("crafters.ToolStation"), 6, 8, 0x000000);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 0x000000);
this.fontRenderer.drawString(toolName + "_", this.xSize / 2 - 18, 8, 0xffffff);
if (logic.isStackInSlot(0))
drawToolStats();
else
drawToolInformation();
//this.fontRenderer.drawString("Namebox active: "+active, this.xSize / 2 - 18, -10, 0xffffff);
}
void drawToolStats ()
{
ItemStack stack = logic.getStackInSlot(0);
if (stack.getItem() instanceof ToolCore)
{
ToolCore tool = (ToolCore) stack.getItem();
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
this.drawCenteredString(fontRenderer, "\u00A7n" + tool.getToolName(), xSize + 63, 8, 0xffffff);
drawModularToolStats(stack, tool, tags);
}
}
void drawModularToolStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
{
List categories = Arrays.asList(tool.toolCategories());
final int durability = tags.getInteger("Damage");
final int maxDur = tags.getInteger("TotalDurability");
int availableDurability = maxDur - durability;
//Durability
int base = 24;
int offset = 0;
if (maxDur > 0)
{
if (maxDur >= 10000)
{
fontRenderer.drawString("Durability:", xSize + 8, base + offset * 11, 0xffffff);
offset++;
fontRenderer.drawString("- " + availableDurability + "/" + maxDur, xSize + 8, base + offset * 10, 0xffffff);
offset++;
}
else
{
fontRenderer.drawString("Durability: " + availableDurability + "/" + maxDur, xSize + 8, base + offset * 10, 0xffffff);
offset++;
}
}
final float stonebound = tags.getFloat("Shoddy");
//Attack
if (categories.contains("weapon"))
{
int attack = (int) (tags.getInteger("Attack"));
float stoneboundDamage = (float) Math.log(durability / 72f + 1) * -2 * stonebound;
attack += stoneboundDamage;
if (attack < 1)
attack = 1;
String heart = attack == 2 ? " Heart" : " Hearts";
if (attack % 2 == 0)
this.fontRenderer.drawString("Attack: " + attack / 2 + heart, xSize + 8, base + offset * 10, 0xffffff);
else
this.fontRenderer.drawString("Attack: " + attack / 2f + heart, xSize + 8, base + offset * 10, 0xffffff);
offset++;
if (stoneboundDamage != 0)
{
heart = stoneboundDamage == 2 ? " Heart" : " Hearts";
String bloss = stoneboundDamage > 0 ? "Bonus: " : "Loss: ";
this.fontRenderer.drawString(bloss + (int) stoneboundDamage / 2 + heart, xSize + 8, base + offset * 10, 0xffffff);
offset++;
}
offset++;
}
if (categories.contains("bow"))
{
DecimalFormat df = new DecimalFormat("##.##");
df.setRoundingMode(RoundingMode.DOWN);
int drawSpeed = tags.getInteger("DrawSpeed");
float flightSpeed = tags.getFloat("FlightSpeed");
float trueDraw = drawSpeed / 20f * flightSpeed;
this.fontRenderer.drawString("Draw Speed: " + df.format(trueDraw) + "s", xSize + 8, base + offset * 10, 0xffffff);
offset++;
this.fontRenderer.drawString("Arrow Speed: " + df.format(flightSpeed) + "x", xSize + 8, base + offset * 10, 0xffffff);
offset++;
offset++;
}
if (categories.contains("ammo"))
{
DecimalFormat df = new DecimalFormat("##.##");
df.setRoundingMode(RoundingMode.DOWN);
int attack = (int) (tags.getInteger("Attack"));
float mass = tags.getFloat("Mass");
float shatter = tags.getFloat("BreakChance");
float accuracy = tags.getFloat("Accuracy");
this.fontRenderer.drawString("Base Attack:", xSize + 8, base + offset * 10, 0xffffff);
offset++;
String heart = attack == 2 ? " Heart" : " Hearts";
if (attack % 2 == 0)
this.fontRenderer.drawString("- " + attack / 2 + heart, xSize + 8, base + offset * 10, 0xffffff);
else
this.fontRenderer.drawString("- " + attack / 2f + heart, xSize + 8, base + offset * 10, 0xffffff);
offset++;
int minAttack = attack;
int maxAttack = attack * 2;
heart = " Hearts";
this.fontRenderer.drawString("Shortbow Attack:", xSize + 8, base + offset * 10, 0xffffff);
offset++;
this.fontRenderer.drawString(df.format(minAttack / 2f) + "-" + df.format(maxAttack / 2f) + heart, xSize + 8, base + offset * 10, 0xffffff);
offset++;
offset++;
this.fontRenderer.drawString("Weight: " + df.format(mass), xSize + 8, base + offset * 10, 0xffffff);
offset++;
this.fontRenderer.drawString("Accuracy: " + df.format(accuracy - 4) + "%", xSize + 8, base + offset * 10, 0xffffff);
offset++;
/*this.fontRenderer.drawString("Chance to break: " + df.format(shatter)+"%", xSize + 8, base + offset * 10, 0xffffff);
offset++;*/
offset++;
}
//Mining
if (categories.contains("dualharvest"))
{
float mineSpeed = tags.getInteger("MiningSpeed") / 100f;
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f;
float stoneboundSpeed = (float) Math.log(durability / 90f + 1) * 2 * stonebound;
DecimalFormat df = new DecimalFormat("##.##");
df.setRoundingMode(RoundingMode.DOWN);
float trueSpeed = mineSpeed + stoneboundSpeed;
float trueSpeed2 = mineSpeed + stoneboundSpeed;
fontRenderer.drawString("Mining Speeds: ", xSize + 8, base + offset * 10, 0xffffff);
offset++;
fontRenderer.drawString("- " + df.format(trueSpeed) + ", " + df.format(trueSpeed2), xSize + 8, base + offset * 10, 0xffffff);
offset++;
if (stoneboundSpeed != 0)
{
String bloss = stoneboundSpeed > 0 ? "Bonus: " : "Loss: ";
fontRenderer.drawString(bloss + df.format(stoneboundSpeed), xSize + 8, base + offset * 10, 0xffffff);
offset++;
}
offset++;
fontRenderer.drawString("Harvest Levels:", xSize + 8, base + offset * 10, 0xffffff);
offset++;
fontRenderer
.drawString("- " + getHarvestLevelName(tags.getInteger("HarvestLevel")) + ", " + getHarvestLevelName(tags.getInteger("HarvestLevel2")), xSize + 8, base + offset * 10, 0xffffff);
offset++;
offset++;
}
else if (categories.contains("harvest"))
{
float mineSpeed = tags.getInteger("MiningSpeed");
int heads = 1;
if (tags.hasKey("MiningSpeed2"))
{
mineSpeed += tags.getInteger("MiningSpeed2");
heads++;
}
if (tags.hasKey("MiningSpeedHandle"))
{
mineSpeed += tags.getInteger("MiningSpeedHandle");
heads++;
}
if (tags.hasKey("MiningSpeedExtra"))
{
mineSpeed += tags.getInteger("MiningSpeedExtra");
heads++;
}
float trueSpeed = mineSpeed / (heads * 100f);
float stoneboundSpeed = (float) Math.log(durability / 90f + 1) * 2 * stonebound;
DecimalFormat df = new DecimalFormat("##.##");
df.setRoundingMode(RoundingMode.DOWN);
trueSpeed += stoneboundSpeed;
if (trueSpeed < 0)
trueSpeed = 0;
fontRenderer.drawString("Mining Speed: " + df.format(trueSpeed), xSize + 8, base + offset * 10, 0xffffff);
offset++;
if (stoneboundSpeed != 0)
{
String bloss = stoneboundSpeed > 0 ? "Bonus: " : "Loss: ";
fontRenderer.drawString(bloss + df.format(stoneboundSpeed), xSize + 8, base + offset * 10, 0xffffff);
offset++;
}
fontRenderer.drawString("Mining Level: " + getHarvestLevelName(tags.getInteger("HarvestLevel")), xSize + 8, base + offset * 10, 0xffffff);
offset++;
offset++;
}
else if (categories.contains("utility"))
{
float mineSpeed = tags.getInteger("MiningSpeed");
float trueSpeed = mineSpeed / (100f);
fontRenderer.drawString("Usage Speed: " + trueSpeed, xSize + 8, base + offset * 10, 0xffffff);
offset++;
offset++;
}
int modifiers = tags.getInteger("Modifiers");
if (modifiers > 0)
{
fontRenderer.drawString("Modifiers remaining: " + tags.getInteger("Modifiers"), xSize + 8, base + offset * 10, 0xffffff);
offset++;
}
if (tags.hasKey("Tooltip1"))
{
fontRenderer.drawString("Modifiers:", xSize + 8, base + offset * 10, 0xffffff);
}
boolean displayToolTips = true;
int tipNum = 0;
while (displayToolTips)
{
tipNum++;
String tooltip = "ModifierTip" + tipNum;
if (tags.hasKey(tooltip))
{
String tipName = tags.getString(tooltip);
fontRenderer.drawString("- " + tipName, xSize + 8, base + (offset + tipNum) * 10, 0xffffff);
}
else
displayToolTips = false;
}
}
void drawToolInformation ()
{
this.drawCenteredString(fontRenderer, title, xSize + 63, 8, 0xffffff);
fontRenderer.drawSplitString(body, xSize + 8, 24, 115, 0xffffff);
}
String getHarvestLevelName (int num)
{
switch (num)
{
case 0:
return "Stone";
case 1:
return "Iron";
case 2:
return "Redstone";
case 3:
return "Obsidian"; //Mithril
case 4:
return "Cobalt";
case 5:
return "Manyullyn";
default:
return String.valueOf(num);
}
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/toolstation.png");
private static final ResourceLocation icons = new ResourceLocation("tinker", "textures/gui/icons.png");
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
{
// Draw the background
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(background);
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
if (active)
{
this.drawTexturedModalRect(cornerX + 62, cornerY, 0, this.ySize, 112, 22);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(icons);
// Draw the slots
for (int i = 0; i < slotX.length; i++)
{
this.drawTexturedModalRect(cornerX + slotX[i] - 4, cornerY + slotY[i] - 4, 140, 212, 28, 28);
if (!logic.isStackInSlot(i + 1))
{
this.drawTexturedModalRect(cornerX + slotX[i], cornerY + slotY[i], 18 * iconX[i], 18 * iconY[i], 18, 18);
}
}
// Draw description
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(description);
cornerX = (this.width + this.xSize) / 2;
cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, 126, this.ySize + 30);
}
protected void keyTyped (char par1, int keyCode)
{
if (keyCode == 1 || (!active && keyCode == this.mc.gameSettings.keyBindInventory.keyCode))
{
logic.setToolname("");
updateServer("");
Keyboard.enableRepeatEvents(false);
this.mc.thePlayer.closeScreen();
}
else if (active)
{
text.textboxKeyTyped(par1, keyCode);
toolName = text.getText().trim();
logic.setToolname(toolName);
updateServer(toolName);
}
}
void updateServer (String name)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(1);
outputStream.writeInt(logic.worldObj.provider.dimensionId);
outputStream.writeInt(logic.xCoord);
outputStream.writeInt(logic.yCoord);
outputStream.writeInt(logic.zCoord);
outputStream.writeUTF(name);
}
catch (Exception ex)
{
ex.printStackTrace();
}
Packet250CustomPayload packet = new Packet250CustomPayload();
packet.channel = "TConstruct";
packet.data = bos.toByteArray();
packet.length = bos.size();
PacketDispatcher.sendPacketToServer(packet);
}
/*protected void mouseClicked(int par1, int par2, int par3)
{
super.mouseClicked(par1, par2, par3);
text.mouseClicked(par1, par2, par3);
}*/
}
+54
View File
@@ -0,0 +1,54 @@
package tconstruct.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class TurnPageButton extends GuiButton
{
/**
* True for pointing right (next page), false for pointing left (previous page).
*/
private final boolean nextPage;
public TurnPageButton(int par1, int par2, int par3, boolean par4)
{
super(par1, par2, par3, 23, 13, "");
this.nextPage = par4;
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookleft.png");
/**
* Draws this button to the screen.
*/
public void drawButton (Minecraft par1Minecraft, int par2, int par3)
{
if (this.drawButton)
{
boolean var4 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
par1Minecraft.func_110434_K().func_110577_a(background);
int var5 = 0;
int var6 = 192;
if (var4)
{
var5 += 23;
}
if (!this.nextPage)
{
var6 += 13;
}
this.drawTexturedModalRect(this.xPosition, this.yPosition, var5, var6, 23, 13);
}
}
}
+18
View File
@@ -0,0 +1,18 @@
package tconstruct.client.pages;
import org.w3c.dom.Element;
public class BlankPage extends BookPage
{
@Override
public void readPageFromXML (Element element)
{
}
@Override
public void renderContentLayer (int localwidth, int localheight)
{
}
}
@@ -0,0 +1,67 @@
package tconstruct.client.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import tconstruct.library.client.TConstructClientRegistry;
public class BlockCastPage extends BookPage
{
String text;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("recipe");
if (nodes != null)
icons = TConstructClientRegistry.getRecipeIcons(nodes.item(0).getTextContent());
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
if (text != null)
manual.fonts.drawString("\u00a7n" + text, localWidth + 70, localHeight + 4, 0);
GL11.glScalef(2f, 2f, 2f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 138) / 2, (localHeight + 110) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 70) / 2, (localHeight + 74) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 70) / 2, (localHeight + 110) / 2);
if (icons[0].stackSize > 1)
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2, String.valueOf(icons[0].stackSize));
manual.renderitem.zLevel = 0;
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
manual.fonts.drawString("Ingredients:", localWidth + 120, localHeight + 32, 0);
manual.fonts.drawString("- " + icons[1].getDisplayName(), localWidth + 120, localHeight + 42, 0);
if (icons[2] != null)
manual.fonts.drawString("- " + icons[2].getDisplayName(), localWidth + 120, localHeight + 50, 0);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/booksmeltery.png");
public void renderBackgroundLayer (int localWidth, int localHeight)
{
manual.getMC().func_110434_K().func_110577_a(background);
manual.drawTexturedModalRect(localWidth, localHeight + 32, 0, 0, 174, 115);
manual.drawTexturedModalRect(localWidth + 62, localHeight + 105, 2, 118, 45, 45);
}
}
+26
View File
@@ -0,0 +1,26 @@
package tconstruct.client.pages;
import org.w3c.dom.Element;
import tconstruct.client.gui.GuiManual;
public abstract class BookPage
{
protected GuiManual manual;
protected int side;
public void init (GuiManual manual, int side)
{
this.manual = manual;
this.side = side;
}
public abstract void readPageFromXML (Element element);
public void renderBackgroundLayer (int localwidth, int localheight)
{
}
public abstract void renderContentLayer (int localwidth, int localheight);
}
@@ -0,0 +1,58 @@
package tconstruct.client.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import tconstruct.library.client.TConstructClientRegistry;
public class ContentsTablePage extends BookPage
{
String text;
String[] iconText;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("link");
iconText = new String[nodes.getLength()];
icons = new ItemStack[nodes.getLength()];
for (int i = 0; i < nodes.getLength(); i++)
{
NodeList children = nodes.item(i).getChildNodes();
iconText[i] = children.item(1).getTextContent();
icons[i] = TConstructClientRegistry.getManualIcon(children.item(3).getTextContent());
}
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
if (text != null)
manual.fonts.drawString("\u00a7n" + text, localWidth + 25 + manual.fonts.getStringWidth(text) / 2, localHeight + 4, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
for (int i = 0; i < icons.length; i++)
{
manual.renderitem.renderItemIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 16, localHeight + 18 * i + 18);
int yOffset = 18;
if (iconText[i].length() > 40)
yOffset = 13;
manual.fonts.drawString(iconText[i], localWidth + 38, localHeight + 18 * i + yOffset, 0);
}
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
}
+105
View File
@@ -0,0 +1,105 @@
package tconstruct.client.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import tconstruct.library.client.TConstructClientRegistry;
public class CraftingPage extends BookPage
{
String text;
String size;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("name");
if (nodes != null)
icons = TConstructClientRegistry.getRecipeIcons(nodes.item(0).getTextContent());
nodes = element.getElementsByTagName("size");
if (nodes != null)
size = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
if (size.equals("two"))
drawCraftingPage(text, icons, 2, localWidth, localHeight + 12);
if (size.equals("three"))
drawCraftingPage(text, icons, 3, localWidth + (side != 1 ? 6 : 0), localHeight + 12);
}
public void drawCraftingPage (String info, ItemStack[] icons, int recipeSize, int localWidth, int localHeight)
{
if (info != null)
manual.fonts.drawString("\u00a7n" + info, localWidth + 50, localHeight + 4, 0);
GL11.glScalef(2f, 2f, 2f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
if (recipeSize == 2)
{
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 126) / 2, (localHeight + 68) / 2);
if (icons[0].stackSize > 1)
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 126) / 2, (localHeight + 68) / 2, String.valueOf(icons[0].stackSize));
for (int i = 0; i < icons.length - 1; i++)
{
if (icons[i + 1] != null)
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i + 1], (localWidth + 14 + 36 * (i % 2)) / 2, (localHeight + 36 * (i / 2) + 52) / 2);
}
}
if (recipeSize == 3)
{
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 138) / 2, (localHeight + 70) / 2);
if (icons[0].stackSize > 1)
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 126) / 2, (localHeight + 68) / 2, String.valueOf(icons[0].stackSize));
for (int i = 0; i < icons.length - 1; i++)
{
if (icons[i + 1] != null)
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i + 1], (localWidth - 2 + 36 * (i % 3)) / 2, (localHeight + 36 * (i / 3) + 34) / 2);
}
}
manual.renderitem.zLevel = 0;
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
public void renderBackgroundLayer (int localwidth, int localheight)
{
if (size.equals("two"))
drawBackground(2, localwidth, localheight + 12);
if (size.equals("three"))
drawBackground(3, localwidth + (side != 1 ? 6 : 0), localheight + 12);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookcrafting.png");
public void drawBackground (int size, int localWidth, int localHeight)
{
manual.getMC().func_110434_K().func_110577_a(background);
if (size == 2)
manual.drawTexturedModalRect(localWidth + 8, localHeight + 46, 0, 116, 154, 78);
if (size == 3)
manual.drawTexturedModalRect(localWidth - 8, localHeight + 28, 0, 0, 183, 114);
}
}
+62
View File
@@ -0,0 +1,62 @@
package tconstruct.client.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import tconstruct.library.client.TConstructClientRegistry;
public class FurnacePage extends BookPage
{
String text;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("recipe");
if (nodes != null)
icons = TConstructClientRegistry.getRecipeIcons(nodes.item(0).getTextContent());
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
if (text != null)
manual.fonts.drawString("\u00a7n" + text, localWidth + 50, localHeight + 4, 0);
GL11.glScalef(2f, 2f, 2f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, TConstructClientRegistry.getManualIcon("coal"), (localWidth + 38) / 2, (localHeight + 110) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 38) / 2, (localHeight + 38) / 2);
if (icons[0].stackSize > 1)
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2, String.valueOf(icons[0].stackSize));
manual.renderitem.zLevel = 0;
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookfurnace.png");
public void renderBackgroundLayer (int localWidth, int localHeight)
{
manual.getMC().func_110434_K().func_110577_a(background);
manual.drawTexturedModalRect(localWidth + 32, localHeight + 32, 0, 0, 111, 114);
}
}
+134
View File
@@ -0,0 +1,134 @@
package tconstruct.client.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import tconstruct.client.gui.PartCrafterGui;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.client.TConstructClientRegistry;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.tools.ToolMaterial;
public class MaterialPage extends BookPage
{
String title;
ItemStack[] icons;
String iconText;
ToolMaterial material;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("title");
if (nodes != null)
title = nodes.item(0).getTextContent();
icons = new ItemStack[4];
nodes = element.getElementsByTagName("text");
if (nodes != null)
iconText = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("icon");
if (nodes != null)
icons[0] = TConstructClientRegistry.getManualIcon(nodes.item(0).getTextContent());
nodes = element.getElementsByTagName("toolmaterial");
if (nodes != null && nodes.getLength() > 0)
material = TConstructRegistry.getMaterial(nodes.item(0).getTextContent());
else
material = TConstructRegistry.getMaterial(title);
nodes = element.getElementsByTagName("material").item(0).getChildNodes();
icons[1] = TConstructClientRegistry.getManualIcon(nodes.item(1).getTextContent());
icons[2] = PatternBuilder.instance.getShardFromSet(material.name());
icons[3] = PatternBuilder.instance.getRodFromSet(material.name());
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawString("\u00a7n" + title, localWidth + 70, localHeight + 4, 0);
manual.fonts.drawSplitString(iconText, localWidth, localHeight + 16, 178, 0);
manual.fonts.drawString("Material: ", localWidth + 108, localHeight + 40, 0);
manual.fonts.drawString("Shard: ", localWidth + 108, localHeight + 72, 0);
manual.fonts.drawString("Rod: ", localWidth + 108, localHeight + 104, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
//renderitem.renderItemAndEffectIntoGUI(fonts, getMC().renderEngine, icons[0], localWidth + 50, localHeight + 0);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], localWidth + 108, localHeight + 50);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], localWidth + 108, localHeight + 82);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[3], localWidth + 108, localHeight + 114);
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
String icon = icons[1].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
int iconOffset = icon.length() > 12 ? 0 : 3;
manual.fonts.drawSplitString(icon, localWidth + 128, localHeight + 50 + iconOffset, 52, 0);
if (icons[2] != null)
{
icon = icons[2].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
iconOffset = icon.length() > 12 ? 0 : 3;
manual.fonts.drawSplitString(icons[2].getTooltip(manual.getMC().thePlayer, false).get((0)).toString(), localWidth + 128, localHeight + 82 + iconOffset, 52, 0);
}
if (icons[3] != null)
{
icon = icons[3].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
iconOffset = icon.length() > 12 ? 0 : 3;
manual.fonts.drawSplitString(icons[3].getTooltip(manual.getMC().thePlayer, false).get((0)).toString(), localWidth + 128, localHeight + 114 + iconOffset, 52, 0);
}
manual.fonts.drawString("Durability: " + material.durability(), localWidth, localHeight + 40, 0);
manual.fonts.drawString("Handle Modifier: " + material.handleDurability() + "x", localWidth, localHeight + 50, 0);
manual.fonts.drawString("Full Tool Durability: " + (int) (material.durability() * material.handleDurability()), localWidth, localHeight + 60, 0);
manual.fonts.drawString("Mining Speed: " + material.toolSpeed() / 100f, localWidth, localHeight + 80, 0);
manual.fonts.drawString("Mining Level: " + material.harvestLevel() + " (" + PartCrafterGui.getHarvestLevelName(material.harvestLevel()) + ")", localWidth, localHeight + 90, 0);
int attack = material.attack();
String heart = attack == 2 ? " Heart" : " Hearts";
if (attack % 2 == 0)
manual.fonts.drawString("Base Attack: " + material.attack() / 2 + heart, localWidth, localHeight + 100, 0);
else
manual.fonts.drawString("Base Attack: " + material.attack() / 2f + heart, localWidth, localHeight + 100, 0);
int offset = 0;
String ability = material.ability();
if (!ability.equals(""))
{
manual.fonts.drawString("Material ability: " + material.ability(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
if (ability.equals("Writable"))
manual.fonts.drawString("+1 Modifiers", localWidth, localHeight + 120 + 10 * offset, 0);
}
if (material.reinforced() > 0)
{
manual.fonts.drawString("Material ability: Reinforced", localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
manual.fonts.drawString("Reinforced level: " + material.reinforced(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
}
if (material.shoddy() > 0)
{
manual.fonts.drawString("Stonebound level: " + material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
}
else if (material.shoddy() < 0)
{
manual.fonts.drawString("Splintering level: " + -material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
}
}
}
+63
View File
@@ -0,0 +1,63 @@
package tconstruct.client.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import tconstruct.library.client.TConstructClientRegistry;
public class ModifierPage extends BookPage
{
String type;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("tooltype");
if (nodes != null)
type = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("recipe");
if (nodes != null)
icons = TConstructClientRegistry.getRecipeIcons(nodes.item(0).getTextContent());
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawString("\u00a7nTool Station", localWidth + 60, localHeight + 4, 0);
GL11.glScalef(2f, 2f, 2f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
ItemStack toolstack = TConstructClientRegistry.getManualIcon("ironpick");
if (type.equals("weapon"))
toolstack = TConstructClientRegistry.getManualIcon("ironlongsword");
manual.renderitem.zLevel = 100;
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 54) / 2, (localHeight + 54) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 130) / 2, (localHeight + 54) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
if (icons[2] != null)
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 18) / 2, (localHeight + 74) / 2);
manual.renderitem.zLevel = 0;
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookmodify.png");
public void renderBackgroundLayer (int localWidth, int localHeight)
{
manual.getMC().func_110434_K().func_110577_a(background);
manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
}
}
+38
View File
@@ -0,0 +1,38 @@
package tconstruct.client.pages;
import net.minecraft.util.ResourceLocation;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class PicturePage extends BookPage
{
String text;
String location;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("location");
if (nodes != null)
location = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString(text, localWidth + 8, localHeight, 178, 0);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookcrafting.png");
public void renderBackgroundLayer (int localWidth, int localHeight)
{
manual.getMC().func_110434_K().func_110577_a(background);
//manual.getMC().renderEngine.bindTexture(location);
manual.drawTexturedModalRect(localWidth, localHeight + 12, 0, 0, 170, 144);
}
}
+29
View File
@@ -0,0 +1,29 @@
package tconstruct.client.pages;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class SectionPage extends BookPage
{
String title;
String body;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("title");
if (nodes != null)
title = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("text");
if (nodes != null)
body = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString("\u00a7n" + title, localWidth + 70, localHeight + 4, 178, 0);
manual.fonts.drawSplitString(body, localWidth, localHeight + 16, 190, 0);
}
}
+58
View File
@@ -0,0 +1,58 @@
package tconstruct.client.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import tconstruct.library.client.TConstructClientRegistry;
public class SidebarPage extends BookPage
{
String text;
String[] iconText;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("item");
iconText = new String[nodes.getLength()];
icons = new ItemStack[nodes.getLength()];
for (int i = 0; i < nodes.getLength(); i++)
{
NodeList children = nodes.item(i).getChildNodes();
iconText[i] = children.item(1).getTextContent();
icons[i] = TConstructClientRegistry.getManualIcon(children.item(3).getTextContent());
}
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString(text, localWidth, localHeight, 178, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
int offset = text.length() / 4 + 10;
for (int i = 0; i < icons.length; i++)
{
manual.renderitem.renderItemIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 8, localHeight + 18 * i + offset);
int yOffset = 39;
if (iconText[i].length() > 40)
yOffset = 34;
manual.fonts.drawSplitString(iconText[i], localWidth + 30, localHeight + 18 * i + offset, 140, 0);
}
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
}
+23
View File
@@ -0,0 +1,23 @@
package tconstruct.client.pages;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class TextPage extends BookPage
{
String text;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString(text, localWidth, localHeight, 178, 0);
}
}
+23
View File
@@ -0,0 +1,23 @@
package tconstruct.client.pages;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class TitlePage extends BookPage
{
String text;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString(text, localWidth, localHeight, 178, 0);
}
}
+94
View File
@@ -0,0 +1,94 @@
package tconstruct.client.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import tconstruct.library.client.TConstructClientRegistry;
public class ToolPage extends BookPage
{
String title;
ItemStack[] icons;
String[] iconText;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("title");
if (nodes != null)
title = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("item");
iconText = new String[nodes.getLength() + 2];
icons = new ItemStack[nodes.getLength() + 1];
for (int i = 0; i < nodes.getLength(); i++)
{
NodeList children = nodes.item(i).getChildNodes();
iconText[i + 2] = children.item(1).getTextContent();
icons[i + 1] = TConstructClientRegistry.getManualIcon(children.item(3).getTextContent());
}
nodes = element.getElementsByTagName("text");
if (nodes != null)
{
iconText[0] = nodes.item(0).getTextContent();
iconText[1] = nodes.item(1).getTextContent();
}
nodes = element.getElementsByTagName("icon");
if (nodes != null)
icons[0] = TConstructClientRegistry.getManualIcon(nodes.item(0).getTextContent());
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawString("\u00a7n" + title, localWidth + 70, localHeight + 4, 0);
manual.fonts.drawSplitString(iconText[0], localWidth, localHeight + 16, 178, 0);
int size = iconText[0].length() / 48;
manual.fonts.drawSplitString(iconText[1], localWidth, localHeight + 28 + 10 * size, 118, 0);
manual.fonts.drawString("Crafting Parts: ", localWidth + 124, localHeight + 28 + 10 * size, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], localWidth + 50, localHeight + 0);
for (int i = 1; i < icons.length; i++)
{
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 120, localHeight + 20 + 10 * size + 18 * i);
int partOffset = iconText[i + 1].length() > 11 ? -3 : 0;
manual.fonts.drawSplitString(iconText[i + 1], localWidth + 140, localHeight + 24 + 10 * size + 18 * i + partOffset, 44, 0);
}
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
/*manual.fonts.drawString("\u00a7n" + title, localWidth + 70, localHeight + 4, 0);
manual.fonts.drawSplitString(iconText[0], localWidth, localHeight + 16, 178, 0);
int size = iconText[0].length() / 48;
manual.fonts.drawSplitString(iconText[1], localWidth, localHeight + 28 + 10 * size, 118, 0);
manual.fonts.drawString("Crafting Parts: ", localWidth + 124, localHeight + 28 + 10 * size, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], localWidth + 50, localHeight + 0);
for (int i = 1; i < icons.length; i++)
{
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 120, localHeight + 20 + 10 * size + 18 * i);
int partOffset = iconText[i + 1].length() > 11 ? -3 : 0;
manual.fonts.drawSplitString(iconText[i + 1], localWidth + 140, localHeight + 24 + 10 * size + 18 * i + partOffset, 44, 0);
}
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);*/
}
}