mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-27 15:33:03 +00:00
Merge 1.7 prep into master.
This was one hell of a messy merge; things may very well explode. Signed-off-by: Sunstrike <[email protected]>
This commit is contained in:
commit
6ad0723020
559 files changed
+4502
-1777
No files matched your search
@@ -0,0 +1,111 @@
|
||||
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;
|
||||
}
|
||||
TextureManager texturemanager = this.mc.getTextureManager();
|
||||
texturemanager.bindTexture(texturemanager.getResourceLocation(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.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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.bindEntityTexture(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.getResourceLocation(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().getTextureManager();
|
||||
ResourceLocation resourcelocation = texturemanager.getResourceLocation(par1EntityItem.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("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.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getIconWidth(), ((Icon) par2Icon).getIconHeight(), f12);
|
||||
|
||||
if (itemstack.hasEffect(pass))
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.bindTexture(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.getItem() == null ? null : par3ItemStack.getIconIndex();
|
||||
float f;
|
||||
int i1;
|
||||
float f1;
|
||||
float f2;
|
||||
|
||||
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
|
||||
if (block != null && par3ItemStack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
|
||||
{
|
||||
par2TextureManager.bindTexture(TextureMap.locationBlocksTexture);
|
||||
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] != null && Item.itemsList[k].requiresMultipleRenderPasses())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
|
||||
{
|
||||
par2TextureManager.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
|
||||
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.getResourceLocation(par3ItemStack.getItemSpriteNumber());
|
||||
par2TextureManager.bindTexture(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("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.bindTexture(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.bindTexture(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 getEntityTexture (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,30 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import net.minecraft.block.StepSound;
|
||||
|
||||
public class StepSoundSlime extends StepSound
|
||||
{
|
||||
|
||||
public StepSoundSlime(String par1Str, float par2, float par3)
|
||||
{
|
||||
super(par1Str, par2, par3);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a block breaks, EXA: Player break, Shep eating grass, etc..
|
||||
*/
|
||||
public String getBreakSound ()
|
||||
{
|
||||
return this.stepSoundName + ".big";
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a entity walks over, or otherwise interacts with the block.
|
||||
*/
|
||||
public String getStepSound ()
|
||||
{
|
||||
return this.stepSoundName + ".small";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.potion.*;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraftforge.client.GuiIngameForge;
|
||||
import net.minecraftforge.client.event.*;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.client.armor.WingModel;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TClientEvents
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
/* Sounds */
|
||||
|
||||
boolean initSounds;
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onSound (SoundLoadEvent event)
|
||||
{
|
||||
if (!initSounds)
|
||||
{
|
||||
initSounds = true;
|
||||
try
|
||||
{
|
||||
SoundManager soundmanager = event.manager;
|
||||
soundmanager.addSound("tinker:frypan_hit.ogg");
|
||||
soundmanager.addSound("tinker:little_saw.ogg");
|
||||
soundmanager.addSound("tinker:launcher_clank.ogg");
|
||||
TConstruct.logger.info("Successfully loaded sounds.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
TConstruct.logger.warning("Failed to register one or more sounds");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Liquids */
|
||||
|
||||
Icon[] stillIcons = new Icon[2];
|
||||
Icon[] flowIcons = new Icon[2];
|
||||
|
||||
@ForgeSubscribe
|
||||
public void preStitch (TextureStitchEvent.Pre event)
|
||||
{
|
||||
TextureMap register = event.map;
|
||||
if (register.textureType == 0)
|
||||
{
|
||||
stillIcons[0] = register.registerIcon("tinker:liquid_pigiron");
|
||||
flowIcons[0] = register.registerIcon("tinker:liquid_pigiron");
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void postStitch (TextureStitchEvent.Post event)
|
||||
{
|
||||
if (event.map.textureType == 0)
|
||||
{
|
||||
for (int i = 0; i < TContent.fluidBlocks.length; i++)
|
||||
{
|
||||
TContent.fluids[i].setIcons(TContent.fluidBlocks[i].getIcon(0, 0), TContent.fluidBlocks[i].getIcon(2, 0));
|
||||
}
|
||||
TContent.pigIronFluid.setIcons(stillIcons[0], flowIcons[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation hearts = new ResourceLocation("tinker", "textures/gui/newhearts.png");
|
||||
private static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png");
|
||||
public static int left_height = 39;
|
||||
public static int right_height = 39;
|
||||
Random rand = new Random();
|
||||
int updateCounter = 0;
|
||||
|
||||
/* HUD */
|
||||
@ForgeSubscribe
|
||||
public void renderHealthbar (RenderGameOverlayEvent.Pre event)
|
||||
{
|
||||
if (!Loader.isModLoaded("tukmc_Vz"))// Loader check to avoid conflicting with a GUI mod (thanks Vazkii!)
|
||||
{
|
||||
if (event.type == ElementType.HEALTH)
|
||||
{
|
||||
updateCounter++;
|
||||
|
||||
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);
|
||||
|
||||
boolean highlight = mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
|
||||
|
||||
if (mc.thePlayer.hurtResistantTime < 10)
|
||||
{
|
||||
highlight = false;
|
||||
}
|
||||
|
||||
AttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
|
||||
int health = MathHelper.ceiling_float_int(mc.thePlayer.getHealth());
|
||||
int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth);
|
||||
float healthMax = (float) attrMaxHealth.getAttributeValue();
|
||||
if (healthMax > 20)
|
||||
healthMax = 20;
|
||||
float absorb = this.mc.thePlayer.getAbsorptionAmount();
|
||||
|
||||
int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
|
||||
int rowHeight = Math.max(10 - (healthRows - 2), 3);
|
||||
|
||||
this.rand.setSeed((long) (updateCounter * 312871));
|
||||
|
||||
int left = scaledWidth / 2 - 91;
|
||||
int top = scaledHeight - left_height;
|
||||
|
||||
int regen = -1;
|
||||
if (mc.thePlayer.isPotionActive(Potion.regeneration))
|
||||
{
|
||||
regen = updateCounter % 25;
|
||||
}
|
||||
|
||||
final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
|
||||
final int BACKGROUND = (highlight ? 25 : 16);
|
||||
int MARGIN = 16;
|
||||
if (mc.thePlayer.isPotionActive(Potion.poison))
|
||||
MARGIN += 36;
|
||||
else if (mc.thePlayer.isPotionActive(Potion.wither))
|
||||
MARGIN += 72;
|
||||
float absorbRemaining = absorb;
|
||||
|
||||
for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
|
||||
{
|
||||
int b0 = (highlight ? 1 : 0);
|
||||
int row = MathHelper.ceiling_float_int((float) (i + 1) / 10.0F) - 1;
|
||||
int x = left + i % 10 * 8;
|
||||
int y = top - row * rowHeight;
|
||||
|
||||
if (health <= 4)
|
||||
y += rand.nextInt(2);
|
||||
if (i == regen)
|
||||
y -= 2;
|
||||
|
||||
drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9);
|
||||
|
||||
if (highlight)
|
||||
{
|
||||
if (i * 2 + 1 < healthLast)
|
||||
drawTexturedModalRect(x, y, MARGIN + 54, TOP, 9, 9); //6
|
||||
else if (i * 2 + 1 == healthLast)
|
||||
drawTexturedModalRect(x, y, MARGIN + 63, TOP, 9, 9); //7
|
||||
}
|
||||
|
||||
if (absorbRemaining > 0.0F)
|
||||
{
|
||||
if (absorbRemaining == absorb && absorb % 2.0F == 1.0F)
|
||||
drawTexturedModalRect(x, y, MARGIN + 153, TOP, 9, 9); //17
|
||||
else
|
||||
drawTexturedModalRect(x, y, MARGIN + 144, TOP, 9, 9); //16
|
||||
absorbRemaining -= 2.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i * 2 + 1 < health)
|
||||
drawTexturedModalRect(x, y, MARGIN + 36, TOP, 9, 9); //4
|
||||
else if (i * 2 + 1 == health)
|
||||
drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); //5
|
||||
}
|
||||
}
|
||||
|
||||
PotionEffect potion = mc.thePlayer.getActivePotionEffect(Potion.wither);
|
||||
if (potion != null)
|
||||
return;
|
||||
potion = mc.thePlayer.getActivePotionEffect(Potion.poison);
|
||||
if (potion != null)
|
||||
return;
|
||||
|
||||
//Extra hearts
|
||||
this.mc.getTextureManager().bindTexture(hearts);
|
||||
|
||||
int hp = MathHelper.ceiling_float_int(this.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.getTextureManager().bindTexture(icons);
|
||||
GuiIngameForge.left_height += 10;
|
||||
if (absorb > 0)
|
||||
GuiIngameForge.left_height += 10;
|
||||
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TContent;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
||||
public class TClientTickHandler implements ITickHandler
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
//TControls controlInstance = ((TProxyClient)TConstruct.proxy).controlInstance;
|
||||
|
||||
@Override
|
||||
public void tickEnd (EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
TContent.oreBerry.setGraphicsLevel(Block.leaves.graphicsLevel);
|
||||
TContent.oreBerrySecond.setGraphicsLevel(Block.leaves.graphicsLevel);
|
||||
TContent.slimeLeaves.setGraphicsLevel(Block.leaves.graphicsLevel);
|
||||
/*if (mc.thePlayer != null && !mc.thePlayer.isAirBorne)
|
||||
controlInstance.landOnGround();*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks ()
|
||||
{
|
||||
return EnumSet.of(TickType.RENDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickStart (EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.EnumSet;
|
||||
|
||||
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.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.potion.Potion;
|
||||
import tconstruct.client.event.EventCloakRender;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
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 refreshCapes = new KeyBinding("key.tcapes.reload", 88);
|
||||
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, refreshCapes }, new boolean[] { false, false }, getVanillaKeyBindings(), new boolean[] { false, false });
|
||||
//TConstruct.logger.info("Controls registered");
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
TabRegistry.addTabsToInventory((GuiContainer) mc.currentScreen);
|
||||
}
|
||||
if (kb == refreshCapes && mc.currentScreen == null)
|
||||
{
|
||||
EventCloakRender.instance.refreshCapes();
|
||||
}
|
||||
/*if (kb == jumpKey) //Double jump
|
||||
{
|
||||
if (mc.thePlayer.capabilities.isCreativeMode)
|
||||
return;
|
||||
|
||||
if (jumping && !doubleJump)
|
||||
{
|
||||
System.out.println("Jump!");
|
||||
//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);
|
||||
}
|
||||
|
||||
static void updateServer (ByteArrayOutputStream bos)
|
||||
{
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "TConstruct";
|
||||
packet.data = bos.toByteArray();
|
||||
packet.length = bos.size();
|
||||
|
||||
PacketDispatcher.sendPacketToServer(packet);
|
||||
}
|
||||
}
|
||||
@@ -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 ();
|
||||
}
|
||||
@@ -0,0 +1,972 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.client.registry.*;
|
||||
import cpw.mods.fml.common.registry.*;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import javax.xml.parsers.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.model.ModelSlime;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.entity.*;
|
||||
import net.minecraft.client.settings.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.RenderBlockFluid;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.w3c.dom.Document;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.SlimeExplosive;
|
||||
import tconstruct.blocks.logic.*;
|
||||
import tconstruct.client.armor.RenderArmorCast;
|
||||
import tconstruct.client.block.*;
|
||||
import tconstruct.client.entity.*;
|
||||
import tconstruct.client.entity.item.ExplosiveRender;
|
||||
import tconstruct.client.entity.projectile.*;
|
||||
import tconstruct.client.gui.*;
|
||||
import tconstruct.client.pages.*;
|
||||
import tconstruct.client.tabs.*;
|
||||
import tconstruct.common.*;
|
||||
import tconstruct.entity.*;
|
||||
import tconstruct.entity.item.*;
|
||||
import tconstruct.entity.item.*;
|
||||
import tconstruct.entity.projectile.*;
|
||||
import tconstruct.inventory.ContainerLandmine;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.client.*;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.util.player.*;
|
||||
|
||||
public class TProxyClient extends TProxyCommon
|
||||
{
|
||||
public static SmallFontRenderer smallFontRenderer;
|
||||
public static Icon metalBall;
|
||||
public static Minecraft mc;
|
||||
public static RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
public static ArmorExtended armorExtended = new ArmorExtended();
|
||||
public static KnapsackInventory knapsack = new KnapsackInventory();
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
if (ID == toolStationID)
|
||||
return new ToolStationGui(player.inventory, (ToolStationLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == partBuilderID)
|
||||
return new PartCrafterGui(player.inventory, (PartBuilderLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == patternChestID)
|
||||
return new PatternChestGui(player.inventory, (PatternChestLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == frypanGuiID)
|
||||
return new FrypanGui(player.inventory, (FrypanLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == smelteryGuiID)
|
||||
{
|
||||
if (PHConstruct.newSmeltery)
|
||||
return new AdaptiveSmelteryGui(player.inventory, (AdaptiveSmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
else
|
||||
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
}
|
||||
if (ID == stencilTableID)
|
||||
return new StencilTableGui(player.inventory, (StencilTableLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == toolForgeID)
|
||||
return new ToolForgeGui(player.inventory, (ToolForgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
|
||||
if (ID == landmineID)
|
||||
return new GuiLandmine(new ContainerLandmine(player, (TileEntityLandmine) world.getBlockTileEntity(x, y, z)));
|
||||
if (ID == craftingStationID)
|
||||
return new CraftingStationGui(player.inventory, (CraftingStationLogic) world.getBlockTileEntity(x, y, z), x, y, z);
|
||||
|
||||
if (ID == furnaceID)
|
||||
return new FurnaceGui(player.inventory, (FurnaceLogic) world.getBlockTileEntity(x, y, z));
|
||||
|
||||
if (ID == manualGuiID)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
return new GuiManual(stack, TProxyClient.getManualFromStack(stack));
|
||||
}
|
||||
if (ID == inventoryGui)
|
||||
{
|
||||
GuiInventory inventory = new GuiInventory(player);
|
||||
TabRegistry.addTabsToInventory(inventory);
|
||||
return inventory;
|
||||
}
|
||||
if (ID == armorGuiID)
|
||||
{
|
||||
TProxyClient.armorExtended.init(Minecraft.getMinecraft().thePlayer);
|
||||
return new ArmorExtendedGui(player.inventory, TProxyClient.armorExtended);
|
||||
}
|
||||
if (ID == knapsackGuiID)
|
||||
{
|
||||
TProxyClient.knapsack.init(Minecraft.getMinecraft().thePlayer);
|
||||
return new KnapsackGui(player.inventory, TProxyClient.knapsack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public static void renderInvBlockFace (RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glRotatef(45, 0, 1, 0);
|
||||
GL11.glRotatef(60, 1, 0, 0);
|
||||
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);
|
||||
}
|
||||
|
||||
public static boolean classMatches (Object paramObject, String paramString)
|
||||
{
|
||||
try
|
||||
{
|
||||
return paramObject.getClass().getName().equals(paramString);
|
||||
}
|
||||
catch (Exception localException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerTickHandler ()
|
||||
{
|
||||
TickRegistry.registerTickHandler(new TClientTickHandler(), Side.CLIENT);
|
||||
// TickRegistry.registerTickHandler(new TimeTicker(), Side.CLIENT);
|
||||
// TickRegistry.registerTickHandler(new TCommonTickHandler(),
|
||||
// Side.CLIENT);
|
||||
}
|
||||
|
||||
/* Registers any rendering code. */
|
||||
public void registerRenderer ()
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
MinecraftForge.EVENT_BUS.register(new TClientEvents());
|
||||
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.renderEngine, false);
|
||||
RenderingRegistry.registerBlockHandler(new TableRender());
|
||||
RenderingRegistry.registerBlockHandler(new TableForgeRender());
|
||||
RenderingRegistry.registerBlockHandler(new FrypanRender());
|
||||
RenderingRegistry.registerBlockHandler(new TankRender());
|
||||
RenderingRegistry.registerBlockHandler(new TankAirRender());
|
||||
RenderingRegistry.registerBlockHandler(new SearedRender());
|
||||
RenderingRegistry.registerBlockHandler(new OreberryRender());
|
||||
RenderingRegistry.registerBlockHandler(new BarricadeRender());
|
||||
RenderingRegistry.registerBlockHandler(new DryingRackRender());
|
||||
RenderingRegistry.registerBlockHandler(new PaneRender());
|
||||
RenderingRegistry.registerBlockHandler(new PaneConnectedRender());
|
||||
RenderingRegistry.registerBlockHandler(new RenderLandmine());
|
||||
RenderingRegistry.registerBlockHandler(new PunjiRender());
|
||||
RenderingRegistry.registerBlockHandler(new RenderBlockFluid());
|
||||
RenderingRegistry.registerBlockHandler(new BlockRenderCastingChannel());
|
||||
RenderingRegistry.registerBlockHandler(new SlimeChannelRender());
|
||||
RenderingRegistry.registerBlockHandler(new SlimePadRender());
|
||||
|
||||
if (!PHConstruct.newSmeltery)
|
||||
RenderingRegistry.registerBlockHandler(new SmelteryRender());
|
||||
|
||||
// Special Renderers
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(CastingTableLogic.class, new CastingTableSpecialRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(CastingBasinLogic.class, new CastingBasinSpecialRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(DryingRackLogic.class, new DryingRackSpecialRender());
|
||||
// ClientRegistry.bindTileEntitySpecialRenderer(GolemCoreLogic.class,
|
||||
// new GolemCoreSpecialRender());
|
||||
|
||||
// Entities
|
||||
RenderingRegistry.registerEntityRenderingHandler(FancyEntityItem.class, new FancyItemRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(BlueSlime.class, new SlimeRender(new ModelSlime(16), new ModelSlime(0), 0.25F));
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(LaunchedPotion.class, new LaunchedItemRender(Item.potion, 16384));
|
||||
RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRenderCustom());
|
||||
RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowRenderCustom());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLandmineFirework.class, new RenderSnowball(Item.firework));
|
||||
RenderingRegistry.registerEntityRenderingHandler(ExplosivePrimed.class, new ExplosiveRender());
|
||||
// RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class,
|
||||
// new PlayerArmorRender()); // <-- Works, woo!
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(TContent.shortbow.itemID, new CustomBowRenderer());
|
||||
VillagerRegistry.instance().registerVillagerSkin(78943, new ResourceLocation("tinker", "textures/mob/villagertools.png"));
|
||||
|
||||
ToolCoreRenderer renderer = new ToolCoreRenderer();
|
||||
MinecraftForgeClient.registerItemRenderer(TContent.arrow.itemID, renderer);
|
||||
MinecraftForgeClient.registerItemRenderer(TContent.dagger.itemID, renderer);
|
||||
|
||||
addRenderMappings();
|
||||
addToolButtons();
|
||||
}
|
||||
|
||||
public static Document diary;
|
||||
public static Document volume1;
|
||||
public static Document volume2;
|
||||
public static Document smelter;
|
||||
|
||||
public void readManuals ()
|
||||
{
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
diary = readManual("/assets/tinker/manuals/diary.xml", dbFactory);
|
||||
volume1 = readManual("/assets/tinker/manuals/firstday.xml", dbFactory);
|
||||
volume2 = readManual("/assets/tinker/manuals/materials.xml", dbFactory);
|
||||
smelter = readManual("/assets/tinker/manuals/smeltery.xml", dbFactory);
|
||||
initManualIcons();
|
||||
initManualRecipes();
|
||||
initManualPages();
|
||||
}
|
||||
|
||||
Document readManual (String location, DocumentBuilderFactory dbFactory)
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream stream = TConstruct.class.getResourceAsStream(location);
|
||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||
Document doc = dBuilder.parse(stream);
|
||||
doc.getDocumentElement().normalize();
|
||||
return doc;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void initManualIcons ()
|
||||
{
|
||||
TConstructClientRegistry.registerManualIcon("smelterybook", new ItemStack(TContent.manualBook, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("smeltery", new ItemStack(TContent.smeltery));
|
||||
TConstructClientRegistry.registerManualIcon("blankcast", new ItemStack(TContent.blankPattern, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("castingtable", new ItemStack(TContent.searedBlock));
|
||||
// TConstructClientRegistry.registerManualIcon("liquidiron", new
|
||||
// ItemStack(TContent.liquidMetalStill));
|
||||
TConstructClientRegistry.registerManualIcon("lavatank", new ItemStack(TContent.lavaTank));
|
||||
TConstructClientRegistry.registerManualIcon("searedbrick", new ItemStack(TContent.smeltery, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("drain", new ItemStack(TContent.smeltery, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("faucet", new ItemStack(TContent.searedBlock, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("bronzeingot", new ItemStack(TContent.materials, 1, 13));
|
||||
TConstructClientRegistry.registerManualIcon("alubrassingot", new ItemStack(TContent.materials, 1, 14));
|
||||
TConstructClientRegistry.registerManualIcon("manyullyningot", new ItemStack(TContent.materials, 1, 5));
|
||||
TConstructClientRegistry.registerManualIcon("alumiteingot", new ItemStack(TContent.materials, 1, 15));
|
||||
TConstructClientRegistry.registerManualIcon("blankpattern", new ItemStack(TContent.blankPattern, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("toolstation", new ItemStack(TContent.toolStationWood, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("partcrafter", new ItemStack(TContent.toolStationWood, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("patternchest", new ItemStack(TContent.toolStationWood, 1, 5));
|
||||
TConstructClientRegistry.registerManualIcon("stenciltable", new ItemStack(TContent.toolStationWood, 1, 10));
|
||||
TConstructClientRegistry.registerManualIcon("torch", new ItemStack(Block.torchWood));
|
||||
TConstructClientRegistry.registerManualIcon("sapling", new ItemStack(Block.sapling));
|
||||
TConstructClientRegistry.registerManualIcon("workbench", new ItemStack(Block.workbench));
|
||||
TConstructClientRegistry.registerManualIcon("coal", new ItemStack(Item.coal));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("obsidianingot", new ItemStack(TContent.materials, 1, 18));
|
||||
TConstructClientRegistry.registerManualIcon("lavacrystal", new ItemStack(TContent.materials, 1, 7));
|
||||
|
||||
// Tool Materials
|
||||
TConstructClientRegistry.registerManualIcon("woodplanks", new ItemStack(Block.planks));
|
||||
TConstructClientRegistry.registerManualIcon("stoneblock", new ItemStack(Block.stone));
|
||||
TConstructClientRegistry.registerManualIcon("ironingot", new ItemStack(Item.ingotIron));
|
||||
TConstructClientRegistry.registerManualIcon("flint", new ItemStack(Item.flint));
|
||||
TConstructClientRegistry.registerManualIcon("cactus", new ItemStack(Block.cactus));
|
||||
TConstructClientRegistry.registerManualIcon("bone", new ItemStack(Item.bone));
|
||||
TConstructClientRegistry.registerManualIcon("obsidian", new ItemStack(Block.obsidian));
|
||||
TConstructClientRegistry.registerManualIcon("netherrack", new ItemStack(Block.netherrack));
|
||||
TConstructClientRegistry.registerManualIcon("blueslimecrystal", new ItemStack(TContent.materials, 1, 17));
|
||||
TConstructClientRegistry.registerManualIcon("slimecrystal", new ItemStack(TContent.materials, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("paperstack", new ItemStack(TContent.materials, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("cobaltingot", new ItemStack(TContent.materials, 1, 3));
|
||||
TConstructClientRegistry.registerManualIcon("arditeingot", new ItemStack(TContent.materials, 1, 4));
|
||||
TConstructClientRegistry.registerManualIcon("copperingot", new ItemStack(TContent.materials, 1, 9));
|
||||
TConstructClientRegistry.registerManualIcon("steelingot", new ItemStack(TContent.materials, 1, 16));
|
||||
TConstructClientRegistry.registerManualIcon("pigironingot", new ItemStack(TContent.materials, 1, 34));
|
||||
|
||||
|
||||
// Tool parts
|
||||
TConstructClientRegistry.registerManualIcon("pickhead", new ItemStack(TContent.pickaxeHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("shovelhead", new ItemStack(TContent.shovelHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("axehead", new ItemStack(TContent.hatchetHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("swordblade", new ItemStack(TContent.swordBlade, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("pan", new ItemStack(TContent.frypanHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("board", new ItemStack(TContent.signHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("knifeblade", new ItemStack(TContent.knifeBlade, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("chiselhead", new ItemStack(TContent.chiselHead, 1, 2));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("hammerhead", new ItemStack(TContent.hammerHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("excavatorhead", new ItemStack(TContent.excavatorHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("scythehead", new ItemStack(TContent.scytheBlade, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("broadaxehead", new ItemStack(TContent.broadAxeHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("largeswordblade", new ItemStack(TContent.largeSwordBlade, 1, 2));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("toolrod", new ItemStack(Item.stick));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("binding", new ItemStack(TContent.binding, 1, 4));
|
||||
TConstructClientRegistry.registerManualIcon("wideguard", new ItemStack(TContent.wideGuard, 1, 4));
|
||||
TConstructClientRegistry.registerManualIcon("handguard", new ItemStack(TContent.handGuard, 1, 4));
|
||||
TConstructClientRegistry.registerManualIcon("crossbar", new ItemStack(TContent.crossbar, 1, 4));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("toughrod", new ItemStack(TContent.toughRod, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("toughbinding", new ItemStack(TContent.toughBinding, 1, 17));
|
||||
TConstructClientRegistry.registerManualIcon("largeplate", new ItemStack(TContent.largePlate, 1, 17));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("bowstring", new ItemStack(TContent.bowstring, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("arrowhead", new ItemStack(TContent.arrowhead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("fletching", new ItemStack(TContent.fletching, 1, 0));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("bloodbucket", new ItemStack(TContent.buckets, 1, 16));
|
||||
TConstructClientRegistry.registerManualIcon("emeraldbucket", new ItemStack(TContent.buckets, 1, 15));
|
||||
TConstructClientRegistry.registerManualIcon("gluebucket", new ItemStack(TContent.buckets, 1, 25));
|
||||
TConstructClientRegistry.registerManualIcon("slimebucket", new ItemStack(TContent.buckets, 1, 24));
|
||||
TConstructClientRegistry.registerManualIcon("enderbucket", new ItemStack(TContent.buckets, 1, 23));
|
||||
|
||||
// ToolIcons
|
||||
TConstructClientRegistry.registerManualIcon("pickicon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.pickaxeHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.binding, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("shovelicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.shovelHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("axeicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.hatchetHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("mattockicon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.hatchetHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.shovelHead, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("swordicon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.swordBlade, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.wideGuard, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("longswordicon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.swordBlade, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.handGuard, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("rapiericon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.swordBlade, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.crossbar, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("daggerIcon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.knifeBlade, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.crossbar, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("frypanicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.frypanHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("battlesignicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.signHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("chiselicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.chiselHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("shortbowIcon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.toolRod, 1, 10), new ItemStack(TContent.bowstring, 1, 0), new ItemStack(TContent.toolRod, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("arrowIcon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.arrowhead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.fletching, 1, 0), ""));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("hammericon", ToolBuilder.instance.buildTool(new ItemStack(TContent.hammerHead, 1, 10), new ItemStack(TContent.toughRod, 1, 11), new ItemStack(
|
||||
TContent.largePlate, 1, 12), new ItemStack(TContent.largePlate, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("lumbericon", ToolBuilder.instance.buildTool(new ItemStack(TContent.broadAxeHead, 1, 10), new ItemStack(TContent.toughRod, 1, 11), new ItemStack(
|
||||
TContent.largePlate, 1, 12), new ItemStack(TContent.toughBinding, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("excavatoricon", ToolBuilder.instance.buildTool(new ItemStack(TContent.excavatorHead, 1, 10), new ItemStack(TContent.toughRod, 1, 11),
|
||||
new ItemStack(TContent.largePlate, 1, 12), new ItemStack(TContent.toughBinding, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("scytheicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.scytheBlade, 1, 10), new ItemStack(TContent.toughRod, 1, 11), new ItemStack(
|
||||
TContent.toughBinding, 1, 12), new ItemStack(TContent.toughRod, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("cleavericon", ToolBuilder.instance.buildTool(new ItemStack(TContent.largeSwordBlade, 1, 10), new ItemStack(TContent.toughRod, 1, 11),
|
||||
new ItemStack(TContent.largePlate, 1, 12), new ItemStack(TContent.toughRod, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("battleaxeicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.broadAxeHead, 1, 10), new ItemStack(TContent.toughRod, 1, 11),
|
||||
new ItemStack(TContent.broadAxeHead, 1, 12), new ItemStack(TContent.toughBinding, 8), ""));
|
||||
}
|
||||
|
||||
public void initManualRecipes ()
|
||||
{
|
||||
ItemStack pattern = new ItemStack(TContent.blankPattern, 1, 0);
|
||||
|
||||
ItemStack stick = new ItemStack(Item.stick, 1, 0);
|
||||
ItemStack plank = new ItemStack(Block.planks, 1, 0);
|
||||
ItemStack plankSlab = new ItemStack(Block.woodSingleSlab, 1, 0);
|
||||
ItemStack workbench = new ItemStack(Block.workbench, 1, 0);
|
||||
ItemStack chest = new ItemStack(Block.chest, 1, 0);
|
||||
ItemStack log = new ItemStack(Block.wood, 1, 0);
|
||||
ItemStack mossycobble = new ItemStack(Block.cobblestoneMossy);
|
||||
ItemStack netherrack = new ItemStack(Block.netherrack);
|
||||
|
||||
ItemStack dirt = new ItemStack(Block.dirt, 1, 0);
|
||||
ItemStack sand = new ItemStack(Block.sand, 1, 0);
|
||||
ItemStack gravel = new ItemStack(Block.gravel, 1, 0);
|
||||
ItemStack clay = new ItemStack(Item.clay, 1, 0);
|
||||
ItemStack glass = new ItemStack(Block.glass, 1, 0);
|
||||
ItemStack ironblock = new ItemStack(Block.blockIron, 1, 0);
|
||||
|
||||
ItemStack grout = new ItemStack(TContent.craftedSoil, 2, 1);
|
||||
ItemStack searedbrick = new ItemStack(TContent.materials, 1, 2);
|
||||
ItemStack searedbrickBlock = new ItemStack(TContent.smeltery, 1, 2);
|
||||
|
||||
ItemStack coal = new ItemStack(Item.coal);
|
||||
ItemStack paper = new ItemStack(Item.paper);
|
||||
ItemStack slimeball = new ItemStack(Item.slimeBall);
|
||||
ItemStack slimyMud = new ItemStack(TContent.craftedSoil);
|
||||
ItemStack blazerod = new ItemStack(Item.blazeRod);
|
||||
ItemStack firecharge = new ItemStack(Item.fireballCharge);
|
||||
ItemStack string = new ItemStack(Item.silk);
|
||||
|
||||
ItemStack silkyCloth = new ItemStack(TContent.materials, 1, 25);
|
||||
|
||||
ItemStack graveyardsoil = new ItemStack(TContent.craftedSoil, 1, 3);
|
||||
ItemStack consecratedsoil = new ItemStack(TContent.craftedSoil, 1, 4);
|
||||
|
||||
// TConstruct recipes
|
||||
TConstructClientRegistry.registerManualLargeRecipe("alternatebook", new ItemStack(Item.book), paper, paper, paper, string, pattern, pattern, null, null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("patternbook1", new ItemStack(TContent.manualBook, 1, 0), new ItemStack(Item.paper), pattern, null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("patternbook2", new ItemStack(TContent.manualBook, 1, 1), new ItemStack(TContent.manualBook, 1, 0), null, null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("patternbook3", new ItemStack(TContent.manualBook, 1, 2), new ItemStack(TContent.manualBook, 1, 1), null, null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("blankpattern", pattern, plank, stick, stick, plank);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("toolstation", new ItemStack(TContent.toolStationWood, 1, 0), null, pattern, null, workbench);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("partcrafter", new ItemStack(TContent.toolStationWood, 1, 1), null, pattern, null, log);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("patternchest", new ItemStack(TContent.toolStationWood, 1, 5), null, pattern, null, chest);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("stenciltable", new ItemStack(TContent.toolStationWood, 1, 10), null, pattern, null, plank);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("slimechannel", new ItemStack(TContent.slimeChannel, 1, 0), new ItemStack(TContent.slimeGel, 1, 0), new ItemStack(Item.redstone), null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("bouncepad", new ItemStack(TContent.slimePad, 1, 0), new ItemStack(TContent.slimeChannel), new ItemStack(Item.slimeBall), null, null);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("toolforge", new ItemStack(TContent.toolForge, 1, 0), searedbrickBlock, searedbrickBlock, searedbrickBlock, ironblock, new ItemStack(
|
||||
TContent.toolStationWood, 1, 0), ironblock, ironblock, null, ironblock);
|
||||
|
||||
TConstructClientRegistry.registerManualLargeRecipe("slimymud", slimyMud, null, slimeball, slimeball, null, slimeball, slimeball, null, dirt, sand);
|
||||
TConstructClientRegistry.registerManualFurnaceRecipe("slimecrystal", new ItemStack(TContent.materials, 1, 1), slimyMud);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("paperstack", new ItemStack(TContent.materials, 1, 0), paper, paper, paper, paper);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("mossball", new ItemStack(TContent.materials, 1, 6), mossycobble, mossycobble, mossycobble, mossycobble, mossycobble, mossycobble,
|
||||
mossycobble, mossycobble, mossycobble);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("lavacrystal", new ItemStack(TContent.materials, 1, 7), blazerod, firecharge, blazerod, firecharge, new ItemStack(Item.bucketLava),
|
||||
firecharge, blazerod, firecharge, blazerod);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("silkycloth", silkyCloth, string, string, string, string, new ItemStack(TContent.materials, 1, 24), string, string, string, string);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("silkyjewel", new ItemStack(TContent.materials, 1, 26), null, silkyCloth, null, silkyCloth, new ItemStack(Item.emerald), silkyCloth, null,
|
||||
silkyCloth, null);
|
||||
|
||||
TConstructClientRegistry.registerManualSmallRecipe("graveyardsoil", graveyardsoil, new ItemStack(Block.dirt), new ItemStack(Item.rottenFlesh), new ItemStack(Item.dyePowder, 1, 15), null);
|
||||
TConstructClientRegistry.registerManualFurnaceRecipe("consecratedsoil", consecratedsoil, graveyardsoil);
|
||||
|
||||
TConstructClientRegistry.registerManualSmallRecipe("grout", grout, sand, gravel, null, clay);
|
||||
TConstructClientRegistry.registerManualFurnaceRecipe("searedbrick", searedbrick, grout);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("searedbricks", new ItemStack(TContent.smeltery, 1, 2), searedbrick, searedbrick, searedbrick, searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterycontroller", new ItemStack(TContent.smeltery, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, null, searedbrick,
|
||||
searedbrick, searedbrick, searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("dryingrack", new ItemStack(TContent.dryingRack, 1, 0), null, null, null, plankSlab, plankSlab, plankSlab, null, null,
|
||||
null);
|
||||
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterydrain", new ItemStack(TContent.smeltery, 1, 1), searedbrick, null, searedbrick, searedbrick, null, searedbrick, searedbrick, null,
|
||||
searedbrick);
|
||||
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterytank1", new ItemStack(TContent.lavaTank, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, glass, searedbrick,
|
||||
searedbrick, searedbrick, searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterytank2", new ItemStack(TContent.lavaTank, 1, 1), searedbrick, glass, searedbrick, glass, glass, glass, searedbrick, glass,
|
||||
searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterytank3", new ItemStack(TContent.lavaTank, 1, 2), searedbrick, glass, searedbrick, searedbrick, glass, searedbrick, searedbrick,
|
||||
glass, searedbrick);
|
||||
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterytable", new ItemStack(TContent.searedBlock, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, null, searedbrick,
|
||||
searedbrick, null, searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelteryfaucet", new ItemStack(TContent.searedBlock, 1, 1), searedbrick, null, searedbrick, null, searedbrick, null, null, null, null);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("castingchannel", new ItemStack(TContent.castingChannel), null, null, null, searedbrick, null, searedbrick, searedbrick, searedbrick,
|
||||
searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterybasin", new ItemStack(TContent.searedBlock, 1, 2), searedbrick, null, searedbrick, searedbrick, null, searedbrick, searedbrick,
|
||||
searedbrick, searedbrick);
|
||||
|
||||
//Traps
|
||||
ItemStack reed = new ItemStack(Item.reed);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("punji", new ItemStack(TContent.punji), reed, null, reed, null, reed, null, reed, null, reed);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("barricade", new ItemStack(TContent.barricadeOak), null, log, null, log);
|
||||
|
||||
//Machines
|
||||
ItemStack alubrassIngot = new ItemStack(TContent.materials, 1, 14);
|
||||
ItemStack bronzeIngot = new ItemStack(TContent.materials, 1, 13);
|
||||
ItemStack blankCast = new ItemStack(TContent.blankPattern, 1, 1);
|
||||
ItemStack redstone = new ItemStack(Item.redstone);
|
||||
|
||||
// Modifier recipes
|
||||
ItemStack ironpick = ToolBuilder.instance.buildTool(new ItemStack(TContent.pickaxeHead, 1, 6), new ItemStack(TContent.toolRod, 1, 2), new ItemStack(TContent.binding, 1, 6), "");
|
||||
TConstructClientRegistry.registerManualIcon("ironpick", ironpick);
|
||||
ItemStack ironlongsword = ToolBuilder.instance.buildTool(new ItemStack(TContent.swordBlade, 1, 6), new ItemStack(TContent.toolRod, 1, 2), new ItemStack(TContent.handGuard, 1, 10), "");
|
||||
TConstructClientRegistry.registerManualIcon("ironlongsword", ironlongsword);
|
||||
|
||||
TConstructClientRegistry.registerManualModifier("diamondmod", ironpick.copy(), new ItemStack(Item.diamond));
|
||||
TConstructClientRegistry.registerManualModifier("emeraldmod", ironpick.copy(), new ItemStack(Item.emerald));
|
||||
TConstructClientRegistry.registerManualModifier("redstonemod", ironpick.copy(), new ItemStack(Item.redstone), new ItemStack(Block.blockRedstone));
|
||||
TConstructClientRegistry.registerManualModifier("lavacrystalmod", ironpick.copy(), new ItemStack(TContent.materials, 1, 7));
|
||||
TConstructClientRegistry.registerManualModifier("lapismod", ironpick.copy(), new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Block.blockLapis));
|
||||
TConstructClientRegistry.registerManualModifier("mossmod", ironpick.copy(), new ItemStack(TContent.materials, 1, 6));
|
||||
TConstructClientRegistry.registerManualModifier("quartzmod", ironlongsword.copy(), new ItemStack(Item.netherQuartz), new ItemStack(Block.blockNetherQuartz));
|
||||
TConstructClientRegistry.registerManualModifier("blazemod", ironlongsword.copy(), new ItemStack(Item.blazePowder));
|
||||
TConstructClientRegistry.registerManualModifier("necroticmod", ironlongsword.copy(), new ItemStack(TContent.materials, 1, 8));
|
||||
TConstructClientRegistry.registerManualModifier("silkymod", ironpick.copy(), new ItemStack(TContent.materials, 1, 26));
|
||||
TConstructClientRegistry.registerManualModifier("reinforcedmod", ironpick.copy(), new ItemStack(TContent.largePlate, 1, 6));
|
||||
|
||||
TConstructClientRegistry.registerManualModifier("pistonmod", ironlongsword.copy(), new ItemStack(Block.pistonBase));
|
||||
TConstructClientRegistry.registerManualModifier("beheadingmod", ironlongsword.copy(), new ItemStack(Item.enderPearl), new ItemStack(Block.obsidian));
|
||||
TConstructClientRegistry.registerManualModifier("spidermod", ironlongsword.copy(), new ItemStack(Item.fermentedSpiderEye));
|
||||
TConstructClientRegistry.registerManualModifier("smitemod", ironlongsword.copy(), new ItemStack(TContent.craftedSoil, 1, 4));
|
||||
|
||||
TConstructClientRegistry.registerManualModifier("fluxmod", ironpick.copy(), new ItemStack(Block.dirt));
|
||||
TConstructClientRegistry.registerManualModifier("fluxmod2", ironpick.copy(), new ItemStack(Block.dirt));
|
||||
|
||||
TConstructClientRegistry.registerManualModifier("tier1free", ironpick.copy(), new ItemStack(Item.diamond), new ItemStack(Block.blockGold));
|
||||
TConstructClientRegistry.registerManualModifier("tier2free", ironpick.copy(), new ItemStack(Item.netherStar));
|
||||
|
||||
TConstructClientRegistry.registerManualSmeltery("brownstone", new ItemStack(TContent.speedBlock), new ItemStack(TContent.moltenTin, 1), new ItemStack(Block.gravel));
|
||||
TConstructClientRegistry.registerManualSmeltery("clearglass", new ItemStack(TContent.clearGlass), new ItemStack(TContent.moltenGlass, 1), null);
|
||||
TConstructClientRegistry.registerManualSmeltery("searedstone", new ItemStack(TContent.smeltery, 1, 4), new ItemStack(TContent.moltenStone, 1), null);
|
||||
TConstructClientRegistry.registerManualSmeltery("endstone", new ItemStack(Block.whiteStone), new ItemStack(TContent.moltenEnder, 1), new ItemStack(Block.obsidian));
|
||||
TConstructClientRegistry.registerManualSmeltery("glueball", new ItemStack(TContent.materials, 1, 36), new ItemStack(TContent.glueFluidBlock, 1), null);
|
||||
|
||||
}
|
||||
|
||||
public static Map<String, Class<? extends BookPage>> pageClasses = new HashMap<String, Class<? extends BookPage>>();
|
||||
|
||||
public static void registerManualPage (String type, Class<? extends BookPage> clazz)
|
||||
{
|
||||
pageClasses.put(type, clazz);
|
||||
}
|
||||
|
||||
public static Class<? extends BookPage> getPageClass (String type)
|
||||
{
|
||||
return pageClasses.get(type);
|
||||
}
|
||||
|
||||
void initManualPages ()
|
||||
{
|
||||
TProxyClient.registerManualPage("crafting", CraftingPage.class);
|
||||
TProxyClient.registerManualPage("picture", PicturePage.class);
|
||||
TProxyClient.registerManualPage("text", TextPage.class);
|
||||
TProxyClient.registerManualPage("intro", TextPage.class);
|
||||
TProxyClient.registerManualPage("sectionpage", SectionPage.class);
|
||||
TProxyClient.registerManualPage("intro", TitlePage.class);
|
||||
TProxyClient.registerManualPage("contents", ContentsTablePage.class);
|
||||
TProxyClient.registerManualPage("furnace", FurnacePage.class);
|
||||
TProxyClient.registerManualPage("sidebar", SidebarPage.class);
|
||||
TProxyClient.registerManualPage("materialstats", MaterialPage.class);
|
||||
TProxyClient.registerManualPage("toolpage", ToolPage.class);
|
||||
TProxyClient.registerManualPage("modifier", ModifierPage.class);
|
||||
TProxyClient.registerManualPage("blockcast", BlockCastPage.class);
|
||||
|
||||
TProxyClient.registerManualPage("blank", BlankPage.class);
|
||||
}
|
||||
|
||||
public static Document getManualFromStack (ItemStack stack)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
return volume1;
|
||||
case 1:
|
||||
return volume2;
|
||||
case 2:
|
||||
return smelter;
|
||||
case 3:
|
||||
return diary;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static int[][] itemIcons = { new int[] { 0, 3, 0 }, // Repair
|
||||
new int[] { 1, 4, 0 }, // Pickaxe
|
||||
new int[] { 2, 5, 0 }, // Shovel
|
||||
new int[] { 2, 6, 0 }, // Axe
|
||||
// new int[] {2, 9, 0}, //Lumber Axe
|
||||
// new int[] {1, 7, 0}, //Ice Axe
|
||||
new int[] { 3, 8, 0 }, // Mattock
|
||||
new int[] { 1, 0, 1 }, // Broadsword
|
||||
new int[] { 1, 1, 1 }, // Longsword
|
||||
new int[] { 1, 2, 1 }, // Rapier
|
||||
new int[] { 1, 5, 1 }, // Dagger
|
||||
new int[] { 2, 3, 1 }, // Frying pan
|
||||
new int[] { 2, 4, 1 }, // Battlesign
|
||||
new int[] { 2, 6, 1 } // Chisel
|
||||
};
|
||||
|
||||
static int[][] iconCoords = { new int[] { 0, 1, 2, 13 }, new int[] { 13, 13, 13, 13 }, // Repair
|
||||
new int[] { 0, 0, 1, 13 }, new int[] { 2, 3, 3, 13 }, // Pickaxe
|
||||
new int[] { 3, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Shovel
|
||||
new int[] { 2, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Axe
|
||||
// new int[] { 6, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, //Lumber
|
||||
// Axe
|
||||
// new int[] { 0, 0, 5, 13 }, new int[] { 2, 3, 3, 13 }, //Ice Axe
|
||||
new int[] { 2, 0, 3, 13 }, new int[] { 2, 3, 2, 13 }, // Mattock
|
||||
new int[] { 1, 0, 2, 13 }, new int[] { 2, 3, 3, 13 }, // Broadsword
|
||||
new int[] { 1, 0, 3, 13 }, new int[] { 2, 3, 3, 13 }, // Longsword
|
||||
new int[] { 1, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, // Rapier
|
||||
new int[] { 7, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, // Dagger
|
||||
new int[] { 4, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Frying
|
||||
// Pan
|
||||
new int[] { 5, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Battlesign
|
||||
new int[] { 7, 0, 13, 13 }, new int[] { 3, 3, 13, 13 } // Chisel
|
||||
};
|
||||
|
||||
static String[] toolNames = { "Repair and Modification", "Pickaxe", "Shovel", "Hatchet",
|
||||
// "Lumber Axe",
|
||||
// "Ice Axe",
|
||||
"Mattock", "Broadsword", "Longsword", "Rapier", "Dagger", "Frying Pan", "Battlesign", "Chisel" };
|
||||
|
||||
static String[] toolDescriptions = {
|
||||
"The main way to repair or change your tools. Place a tool and a material on the left to get started.",
|
||||
"The Pickaxe is a precise mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle",
|
||||
"The Shovel is a precise digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle",
|
||||
"The Hatchet is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle",
|
||||
// "The Lumber Axe is a broad chopping tool. It harvests wood in a wide range and can fell entire trees.\n\nRequired parts:\n- Broad Axe Head\n- Handle",
|
||||
// "The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle",
|
||||
"The Cutter Mattock is a versatile farming tool. It is effective on wood, dirt, and plants.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle",
|
||||
"The Broadsword is a defensive weapon. Blocking cuts damage in half.\n\nSpecial Ability: Block\nDamage: Moderate\nDurability: High\n\nRequired parts:\n- Sword Blade\n- Wide Guard\n- Handle",
|
||||
"The Longsword is an offensive weapon. It is often used for charging into battle at full speed.\n\nNatural Ability:\n- Charge Boost\nSpecial Ability: Lunge\n\nDamage: Moderate\nDurability: Moderate",
|
||||
"The Rapier is a special weapon that relies on quick strikes to defeat foes.\n\nNatural Abilities:\n- Armor Pierce\n- Quick Strike\n- Charge Boost\nSpecial Ability:\n- Backpedal\n\nDamage: Low\nDurability: Low",
|
||||
"The Dagger is a short blade that can be thrown.\n\nSpecial Ability:\n- Throw Item\n\nDamage: Low\nDurability: Moderate\n\nRequired parts:\n- Knife Blade\n- Crossbar\n- Handle",
|
||||
"The Frying is a heavy weapon that uses sheer weight to stun foes.\n\nSpecial Ability: Block\nNatural Ability: Heavy\nShift+rClick: Place Frying Pan\nDamage: Low\nDurability: High\n\nRequired parts:\n- Pan\n- Handle",
|
||||
// "The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle"
|
||||
"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Sign Board\n- Handle",
|
||||
"The Chisel is a utility tool that carves shapes into blocks.\n\nCrafting Grid:\n- Shape Items\nSpecial Ability: Chisel\nDurability: Average\n\nRequired parts:\n- Chisel Head\n- Handle" };
|
||||
|
||||
void addToolButtons ()
|
||||
{
|
||||
for (int i = 0; i < toolNames.length; i++)
|
||||
{
|
||||
addToolButton(itemIcons[i][0], itemIcons[i][1], itemIcons[i][2], iconCoords[i * 2], iconCoords[i * 2 + 1], toolNames[i], toolDescriptions[i]);
|
||||
}
|
||||
|
||||
addToolButton(3, 9, 1, new int[] { 0, 10, 0, 13 }, new int[] { 3, 3, 3, 13 }, "Shortbow",
|
||||
"The Shortbow is a ranged weapon. It fires arrows quickly and precisely at its foes.\n\nDraw Speed: Quick\n\nRequired parts:\n- Tool Rod\n- Bowstring\n- Tool Rod");
|
||||
addToolButton(7, 10, 1, new int[] { 11, 0, 12, 13 }, new int[] { 3, 3, 3, 13 }, "Arrow",
|
||||
"Arrows are projectiles usually fired from bows.\n\nRequired parts:\n- Arrowhead\n- Tool Rod\n- Fletching");
|
||||
addTierTwoButton(6, 13, 0, new int[] { 11, 8, 9, 9 }, new int[] { 2, 3, 2, 2 }, "Hammer",
|
||||
"The Hammer is a broad mining tool. It harvests blocks in a wide range and is effective against undead.\n\nNatural Abilities:\nArea of Effect\n- (3x3)\n- Smite\n\nDurability: High");
|
||||
addTierTwoButton(5, 11, 0, new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, "Lumber Axe",
|
||||
"The Lumber Axe is a broad chopping tool. It can fell entire trees or gather wood in a wide range.\n\nNatural Abilities:\nArea of Effect\n- Fell Trees\n- (3x3x3)\n\nDurability: Average");
|
||||
addTierTwoButton(5, 12, 0, new int[] { 10, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, "Excavator",
|
||||
"The Excavator is a broad digging tool. It harvests soil and snow in a wide range.\n\nNatural Ability:\n- Area of Effect\n- (3x3)\n\nDurability: Average");
|
||||
addTierTwoButton(4, 10, 0, new int[] { 8, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, "Scythe",
|
||||
"The Scythe is a broad reaping tool. It is effective on plants and attacks enemies in a wide range.\n\nNatural Ability:\nArea of Effect\n- (3x3x3)\n\nDurability: Average\nDamage: Low, AoE");
|
||||
addTierTwoButton(5, 7, 1, new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, "Cleaver",
|
||||
"The Cleaver is a heavy defensive weapon. It has powerful strikes, but is difficult to wield.\n\nSpecial Ability: Block\nNatural Ability:\n- Beheading\n\nDamage: High\nDurability: Average");
|
||||
addTierTwoButton(5, 8, 1, new int[] { 6, 8, 6, 9 }, new int[] { 2, 3, 2, 3 }, "Battleaxe",
|
||||
"The Battleaxe is a heavy offensive weapon. It is capable of bringing down small trees and can send foes flying.\n\nSpecial Ability: Block\nNatural Abilities:"
|
||||
+ "\n- Knockback\n- Area of Effect\n- (1x9)\n\nDamage: Average\nDurability: Average");
|
||||
}
|
||||
|
||||
void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body)
|
||||
{
|
||||
TConstructClientRegistry.addToolButton(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, "tinker", "textures/gui/icons.png"));
|
||||
}
|
||||
|
||||
void addTierTwoButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body)
|
||||
{
|
||||
TConstructClientRegistry.addTierTwoButton(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, "tinker", "textures/gui/icons.png"));
|
||||
}
|
||||
|
||||
void addRenderMappings ()
|
||||
{
|
||||
String[] partTypes = { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn", "copper", "bronze", "alumite", "steel",
|
||||
"blueslime", "pigiron" };
|
||||
String[] effectTypes = { "diamond", "emerald", "redstone", "piston", "moss", "ice", "lava", "blaze", "necrotic", "flux", "lapis", "quartz", "silk", "beheading", "smite", "spider",
|
||||
"reinforced", "flux" };
|
||||
int[] universalEffects = { 0, 1, 4, 9, 16 };
|
||||
int[] weaponEffects = { 3, 5, 7, 13, 14, 15 };
|
||||
int[] harvestEffects = { 2 };
|
||||
int[] nonUtility = { 6, 8, 10, 11, 12 };
|
||||
|
||||
for (int partIter = 0; partIter < partTypes.length; partIter++)
|
||||
{
|
||||
TConstructClientRegistry.addMaterialRenderMapping(partIter, "tinker", partTypes[partIter], true);
|
||||
}
|
||||
|
||||
for (ToolCore tool : TConstructRegistry.getToolMapping())
|
||||
{
|
||||
for (int i = 0; i < effectTypes.length; i++)
|
||||
{
|
||||
TConstructClientRegistry.addEffectRenderMapping(tool, i, "tinker", effectTypes[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
String[] bowstringTypes = { "string", "magicfabric", "flamestring" };
|
||||
for (int bowIter = 0; bowIter < bowstringTypes.length; bowIter++)
|
||||
{
|
||||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TContent.shortbow, bowIter, "tinker", bowstringTypes[bowIter], true);
|
||||
}
|
||||
|
||||
String[] fletching = { "feather", "leaf", "slime", "blueslime" };
|
||||
for (int arrowIter = 0; arrowIter < fletching.length; arrowIter++)
|
||||
{
|
||||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TContent.arrow, arrowIter, "tinker", fletching[arrowIter], true);
|
||||
}
|
||||
}
|
||||
|
||||
/* Keybindings */
|
||||
public static TControls controlInstance;
|
||||
|
||||
public void registerKeys ()
|
||||
{
|
||||
controlInstance = new TControls();
|
||||
TickRegistry.registerTickHandler(controlInstance, Side.CLIENT);
|
||||
uploadKeyBindingsToGame(Minecraft.getMinecraft().gameSettings, controlInstance);
|
||||
|
||||
TabRegistry.registerTab(new InventoryTabVanilla());
|
||||
TabRegistry.registerTab(new InventoryTabArmorExtended());
|
||||
TabRegistry.registerTab(new InventoryTabKnapsack());
|
||||
}
|
||||
|
||||
public void uploadKeyBindingsToGame (GameSettings settings, TKeyHandler keyhandler)
|
||||
{
|
||||
ArrayList<KeyBinding> harvestedBindings = Lists.newArrayList();
|
||||
for (KeyBinding kb : keyhandler.keyBindings)
|
||||
{
|
||||
harvestedBindings.add(kb);
|
||||
}
|
||||
|
||||
KeyBinding[] modKeyBindings = harvestedBindings.toArray(new KeyBinding[harvestedBindings.size()]);
|
||||
KeyBinding[] allKeys = new KeyBinding[settings.keyBindings.length + modKeyBindings.length];
|
||||
System.arraycopy(settings.keyBindings, 0, allKeys, 0, settings.keyBindings.length);
|
||||
System.arraycopy(modKeyBindings, 0, allKeys, settings.keyBindings.length, modKeyBindings.length);
|
||||
settings.keyBindings = allKeys;
|
||||
settings.loadOptions();
|
||||
}
|
||||
|
||||
public void spawnParticle (String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ)
|
||||
{
|
||||
this.doSpawnParticle(particle, xPos, yPos, zPos, velX, velY, velZ);
|
||||
}
|
||||
|
||||
public EntityFX doSpawnParticle (String par1Str, double par2, double par4, double par6, double par8, double par10, double par12)
|
||||
{
|
||||
if (this.mc == null)
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
|
||||
if (this.mc.renderViewEntity != null && this.mc.effectRenderer != null)
|
||||
{
|
||||
int i = this.mc.gameSettings.particleSetting;
|
||||
|
||||
if (i == 1 && mc.theWorld.rand.nextInt(3) == 0)
|
||||
{
|
||||
i = 2;
|
||||
}
|
||||
|
||||
double d6 = this.mc.renderViewEntity.posX - par2;
|
||||
double d7 = this.mc.renderViewEntity.posY - par4;
|
||||
double d8 = this.mc.renderViewEntity.posZ - par6;
|
||||
EntityFX entityfx = null;
|
||||
|
||||
if (par1Str.equals("hugeexplosion"))
|
||||
{
|
||||
this.mc.effectRenderer.addEffect(entityfx = new EntityHugeExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12));
|
||||
}
|
||||
else if (par1Str.equals("largeexplode"))
|
||||
{
|
||||
this.mc.effectRenderer.addEffect(entityfx = new EntityLargeExplodeFX(mc.renderEngine, mc.theWorld, par2, par4, par6, par8, par10, par12));
|
||||
}
|
||||
else if (par1Str.equals("fireworksSpark"))
|
||||
{
|
||||
this.mc.effectRenderer.addEffect(entityfx = new EntityFireworkSparkFX(mc.theWorld, par2, par4, par6, par8, par10, par12, this.mc.effectRenderer));
|
||||
}
|
||||
|
||||
if (entityfx != null)
|
||||
{
|
||||
return (EntityFX) entityfx;
|
||||
}
|
||||
else
|
||||
{
|
||||
double d9 = 16.0D;
|
||||
|
||||
if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (i > 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par1Str.equals("bubble"))
|
||||
{
|
||||
entityfx = new EntityBubbleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("suspended"))
|
||||
{
|
||||
entityfx = new EntitySuspendFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("depthsuspend"))
|
||||
{
|
||||
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("townaura"))
|
||||
{
|
||||
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("crit"))
|
||||
{
|
||||
entityfx = new EntityCritFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("smoke"))
|
||||
{
|
||||
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("mobSpell"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
|
||||
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
|
||||
}
|
||||
else if (par1Str.equals("mobSpellAmbient"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
|
||||
((EntityFX) entityfx).setAlphaF(0.15F);
|
||||
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
|
||||
}
|
||||
else if (par1Str.equals("spell"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("instantSpell"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
|
||||
}
|
||||
else if (par1Str.equals("witchMagic"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
|
||||
float f = mc.theWorld.rand.nextFloat() * 0.5F + 0.35F;
|
||||
((EntityFX) entityfx).setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
|
||||
}
|
||||
else if (par1Str.equals("note"))
|
||||
{
|
||||
entityfx = new EntityNoteFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("portal"))
|
||||
{
|
||||
entityfx = new EntityPortalFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("enchantmenttable"))
|
||||
{
|
||||
entityfx = new EntityEnchantmentTableParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("explode"))
|
||||
{
|
||||
entityfx = new EntityExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("flame"))
|
||||
{
|
||||
entityfx = new EntityFlameFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("lava"))
|
||||
{
|
||||
entityfx = new EntityLavaFX(mc.theWorld, par2, par4, par6);
|
||||
}
|
||||
else if (par1Str.equals("footstep"))
|
||||
{
|
||||
entityfx = new EntityFootStepFX(mc.renderEngine, mc.theWorld, par2, par4, par6);
|
||||
}
|
||||
else if (par1Str.equals("splash"))
|
||||
{
|
||||
entityfx = new EntitySplashFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("largesmoke"))
|
||||
{
|
||||
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12, 2.5F);
|
||||
}
|
||||
else if (par1Str.equals("cloud"))
|
||||
{
|
||||
entityfx = new EntityCloudFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("reddust"))
|
||||
{
|
||||
entityfx = new EntityReddustFX(mc.theWorld, par2, par4, par6, (float) par8, (float) par10, (float) par12);
|
||||
}
|
||||
else if (par1Str.equals("snowballpoof"))
|
||||
{
|
||||
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, Item.snowball);
|
||||
}
|
||||
else if (par1Str.equals("dripWater"))
|
||||
{
|
||||
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.water);
|
||||
}
|
||||
else if (par1Str.equals("dripLava"))
|
||||
{
|
||||
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.lava);
|
||||
}
|
||||
else if (par1Str.equals("snowshovel"))
|
||||
{
|
||||
entityfx = new EntitySnowShovelFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("blueslime"))
|
||||
{
|
||||
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, TContent.strangeFood);
|
||||
}
|
||||
else if (par1Str.equals("heart"))
|
||||
{
|
||||
entityfx = new EntityHeartFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("angryVillager"))
|
||||
{
|
||||
entityfx = new EntityHeartFX(mc.theWorld, par2, par4 + 0.5D, par6, par8, par10, par12);
|
||||
((EntityFX) entityfx).setParticleTextureIndex(81);
|
||||
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else if (par1Str.equals("happyVillager"))
|
||||
{
|
||||
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
((EntityFX) entityfx).setParticleTextureIndex(82);
|
||||
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (entityfx != null)
|
||||
{
|
||||
this.mc.effectRenderer.addEffect((EntityFX) entityfx);
|
||||
}
|
||||
|
||||
return (EntityFX) entityfx;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit ()
|
||||
{
|
||||
//MinecraftForgeClient.registerItemRenderer(TContent.armorPattern.itemID, new RenderArmorCast());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,996 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.client.registry.*;
|
||||
import cpw.mods.fml.common.registry.*;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import javax.xml.parsers.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.model.ModelSlime;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.entity.*;
|
||||
import net.minecraft.client.settings.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.RenderBlockFluid;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.w3c.dom.Document;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.SlimeExplosive;
|
||||
import tconstruct.blocks.logic.*;
|
||||
import tconstruct.client.armor.RenderArmorCast;
|
||||
import tconstruct.client.block.*;
|
||||
import tconstruct.client.entity.*;
|
||||
import tconstruct.client.entity.item.ExplosiveRender;
|
||||
import tconstruct.client.entity.projectile.*;
|
||||
import tconstruct.client.gui.*;
|
||||
import tconstruct.client.pages.*;
|
||||
import tconstruct.client.tabs.*;
|
||||
import tconstruct.common.*;
|
||||
import tconstruct.entity.*;
|
||||
import tconstruct.entity.item.*;
|
||||
import tconstruct.entity.item.*;
|
||||
import tconstruct.entity.projectile.*;
|
||||
import tconstruct.inventory.ContainerLandmine;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.client.*;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.util.player.*;
|
||||
|
||||
public class TProxyClient extends TProxyCommon
|
||||
{
|
||||
public static SmallFontRenderer smallFontRenderer;
|
||||
public static Icon metalBall;
|
||||
public static Minecraft mc;
|
||||
public static RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
public static ArmorExtended armorExtended = new ArmorExtended();
|
||||
public static KnapsackInventory knapsack = new KnapsackInventory();
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
if (ID == toolStationID)
|
||||
return new ToolStationGui(player.inventory, (ToolStationLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == partBuilderID)
|
||||
return new PartCrafterGui(player.inventory, (PartBuilderLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == patternChestID)
|
||||
return new PatternChestGui(player.inventory, (PatternChestLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == frypanGuiID)
|
||||
return new FrypanGui(player.inventory, (FrypanLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == smelteryGuiID)
|
||||
{
|
||||
if (PHConstruct.newSmeltery)
|
||||
return new AdaptiveSmelteryGui(player.inventory, (AdaptiveSmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
else
|
||||
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
}
|
||||
if (ID == stencilTableID)
|
||||
return new StencilTableGui(player.inventory, (StencilTableLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
if (ID == toolForgeID)
|
||||
return new ToolForgeGui(player.inventory, (ToolForgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
|
||||
if (ID == landmineID)
|
||||
return new GuiLandmine(new ContainerLandmine(player, (TileEntityLandmine) world.getBlockTileEntity(x, y, z)));
|
||||
if (ID == craftingStationID)
|
||||
return new CraftingStationGui(player.inventory, (CraftingStationLogic) world.getBlockTileEntity(x, y, z), x, y, z);
|
||||
|
||||
if (ID == furnaceID)
|
||||
return new FurnaceGui(player.inventory, (FurnaceLogic) world.getBlockTileEntity(x, y, z));
|
||||
|
||||
if (ID == manualGuiID)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
return new GuiManual(stack, TProxyClient.getManualFromStack(stack));
|
||||
}
|
||||
if (ID == inventoryGui)
|
||||
{
|
||||
GuiInventory inventory = new GuiInventory(player);
|
||||
TabRegistry.addTabsToInventory(inventory);
|
||||
return inventory;
|
||||
}
|
||||
if (ID == armorGuiID)
|
||||
{
|
||||
TProxyClient.armorExtended.init(Minecraft.getMinecraft().thePlayer);
|
||||
return new ArmorExtendedGui(player.inventory, TProxyClient.armorExtended);
|
||||
}
|
||||
if (ID == knapsackGuiID)
|
||||
{
|
||||
TProxyClient.knapsack.init(Minecraft.getMinecraft().thePlayer);
|
||||
return new KnapsackGui(player.inventory, TProxyClient.knapsack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public static void renderInvBlockFace (RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glRotatef(45, 0, 1, 0);
|
||||
GL11.glRotatef(60, 1, 0, 0);
|
||||
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);
|
||||
}
|
||||
|
||||
public static boolean classMatches (Object paramObject, String paramString)
|
||||
{
|
||||
try
|
||||
{
|
||||
return paramObject.getClass().getName().equals(paramString);
|
||||
}
|
||||
catch (Exception localException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerTickHandler ()
|
||||
{
|
||||
TickRegistry.registerTickHandler(new TClientTickHandler(), Side.CLIENT);
|
||||
// TickRegistry.registerTickHandler(new TimeTicker(), Side.CLIENT);
|
||||
// TickRegistry.registerTickHandler(new TCommonTickHandler(),
|
||||
// Side.CLIENT);
|
||||
}
|
||||
|
||||
/* Registers any rendering code. */
|
||||
public void registerRenderer ()
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
MinecraftForge.EVENT_BUS.register(new TClientEvents());
|
||||
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.renderEngine, false);
|
||||
RenderingRegistry.registerBlockHandler(new TableRender());
|
||||
RenderingRegistry.registerBlockHandler(new TableForgeRender());
|
||||
RenderingRegistry.registerBlockHandler(new FrypanRender());
|
||||
RenderingRegistry.registerBlockHandler(new TankRender());
|
||||
RenderingRegistry.registerBlockHandler(new TankAirRender());
|
||||
RenderingRegistry.registerBlockHandler(new SearedRender());
|
||||
RenderingRegistry.registerBlockHandler(new OreberryRender());
|
||||
RenderingRegistry.registerBlockHandler(new BarricadeRender());
|
||||
RenderingRegistry.registerBlockHandler(new DryingRackRender());
|
||||
RenderingRegistry.registerBlockHandler(new PaneRender());
|
||||
RenderingRegistry.registerBlockHandler(new PaneConnectedRender());
|
||||
RenderingRegistry.registerBlockHandler(new RenderLandmine());
|
||||
RenderingRegistry.registerBlockHandler(new PunjiRender());
|
||||
RenderingRegistry.registerBlockHandler(new RenderBlockFluid());
|
||||
RenderingRegistry.registerBlockHandler(new BlockRenderCastingChannel());
|
||||
RenderingRegistry.registerBlockHandler(new SlimeChannelRender());
|
||||
RenderingRegistry.registerBlockHandler(new SlimePadRender());
|
||||
|
||||
if (!PHConstruct.newSmeltery)
|
||||
RenderingRegistry.registerBlockHandler(new SmelteryRender());
|
||||
|
||||
// Special Renderers
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(CastingTableLogic.class, new CastingTableSpecialRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(CastingBasinLogic.class, new CastingBasinSpecialRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(DryingRackLogic.class, new DryingRackSpecialRender());
|
||||
// ClientRegistry.bindTileEntitySpecialRenderer(GolemCoreLogic.class,
|
||||
// new GolemCoreSpecialRender());
|
||||
|
||||
// Entities
|
||||
RenderingRegistry.registerEntityRenderingHandler(FancyEntityItem.class, new FancyItemRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(BlueSlime.class, new SlimeRender(new ModelSlime(16), new ModelSlime(0), 0.25F));
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(LaunchedPotion.class, new LaunchedItemRender(Item.potion, 16384));
|
||||
RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRenderCustom());
|
||||
RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowRenderCustom());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLandmineFirework.class, new RenderSnowball(Item.firework));
|
||||
RenderingRegistry.registerEntityRenderingHandler(ExplosivePrimed.class, new ExplosiveRender());
|
||||
// RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class,
|
||||
// new PlayerArmorRender()); // <-- Works, woo!
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(TContent.shortbow.itemID, new CustomBowRenderer());
|
||||
VillagerRegistry.instance().registerVillagerSkin(78943, new ResourceLocation("tinker", "textures/mob/villagertools.png"));
|
||||
|
||||
ToolCoreRenderer renderer = new ToolCoreRenderer();
|
||||
MinecraftForgeClient.registerItemRenderer(TContent.arrow.itemID, renderer);
|
||||
MinecraftForgeClient.registerItemRenderer(TContent.dagger.itemID, renderer);
|
||||
|
||||
addRenderMappings();
|
||||
addToolButtons();
|
||||
}
|
||||
|
||||
public static Document diary;
|
||||
public static Document volume1;
|
||||
public static Document volume2;
|
||||
public static Document smelter;
|
||||
|
||||
public void readManuals ()
|
||||
{
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
diary = readManual("/assets/tinker/manuals/diary.xml", dbFactory);
|
||||
volume1 = readManual("/assets/tinker/manuals/firstday.xml", dbFactory);
|
||||
volume2 = readManual("/assets/tinker/manuals/materials.xml", dbFactory);
|
||||
smelter = readManual("/assets/tinker/manuals/smeltery.xml", dbFactory);
|
||||
initManualIcons();
|
||||
initManualRecipes();
|
||||
initManualPages();
|
||||
}
|
||||
|
||||
Document readManual (String location, DocumentBuilderFactory dbFactory)
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream stream = TConstruct.class.getResourceAsStream(location);
|
||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||
Document doc = dBuilder.parse(stream);
|
||||
doc.getDocumentElement().normalize();
|
||||
return doc;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void initManualIcons ()
|
||||
{
|
||||
TConstructClientRegistry.registerManualIcon("smelterybook", new ItemStack(TContent.manualBook, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("smeltery", new ItemStack(TContent.smeltery));
|
||||
TConstructClientRegistry.registerManualIcon("blankcast", new ItemStack(TContent.blankPattern, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("castingtable", new ItemStack(TContent.searedBlock));
|
||||
// TConstructClientRegistry.registerManualIcon("liquidiron", new
|
||||
// ItemStack(TContent.liquidMetalStill));
|
||||
TConstructClientRegistry.registerManualIcon("lavatank", new ItemStack(TContent.lavaTank));
|
||||
TConstructClientRegistry.registerManualIcon("searedbrick", new ItemStack(TContent.smeltery, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("drain", new ItemStack(TContent.smeltery, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("faucet", new ItemStack(TContent.searedBlock, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("bronzeingot", new ItemStack(TContent.materials, 1, 13));
|
||||
TConstructClientRegistry.registerManualIcon("alubrassingot", new ItemStack(TContent.materials, 1, 14));
|
||||
TConstructClientRegistry.registerManualIcon("manyullyningot", new ItemStack(TContent.materials, 1, 5));
|
||||
TConstructClientRegistry.registerManualIcon("alumiteingot", new ItemStack(TContent.materials, 1, 15));
|
||||
TConstructClientRegistry.registerManualIcon("blankpattern", new ItemStack(TContent.blankPattern, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("toolstation", new ItemStack(TContent.toolStationWood, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("partcrafter", new ItemStack(TContent.toolStationWood, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("patternchest", new ItemStack(TContent.toolStationWood, 1, 5));
|
||||
TConstructClientRegistry.registerManualIcon("stenciltable", new ItemStack(TContent.toolStationWood, 1, 10));
|
||||
TConstructClientRegistry.registerManualIcon("torch", new ItemStack(Block.torchWood));
|
||||
TConstructClientRegistry.registerManualIcon("sapling", new ItemStack(Block.sapling));
|
||||
TConstructClientRegistry.registerManualIcon("workbench", new ItemStack(Block.workbench));
|
||||
TConstructClientRegistry.registerManualIcon("coal", new ItemStack(Item.coal));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("obsidianingot", new ItemStack(TContent.materials, 1, 18));
|
||||
TConstructClientRegistry.registerManualIcon("lavacrystal", new ItemStack(TContent.materials, 1, 7));
|
||||
|
||||
// Tool Materials
|
||||
TConstructClientRegistry.registerManualIcon("woodplanks", new ItemStack(Block.planks));
|
||||
TConstructClientRegistry.registerManualIcon("stoneblock", new ItemStack(Block.stone));
|
||||
TConstructClientRegistry.registerManualIcon("ironingot", new ItemStack(Item.ingotIron));
|
||||
TConstructClientRegistry.registerManualIcon("flint", new ItemStack(Item.flint));
|
||||
TConstructClientRegistry.registerManualIcon("cactus", new ItemStack(Block.cactus));
|
||||
TConstructClientRegistry.registerManualIcon("bone", new ItemStack(Item.bone));
|
||||
TConstructClientRegistry.registerManualIcon("obsidian", new ItemStack(Block.obsidian));
|
||||
TConstructClientRegistry.registerManualIcon("netherrack", new ItemStack(Block.netherrack));
|
||||
TConstructClientRegistry.registerManualIcon("blueslimecrystal", new ItemStack(TContent.materials, 1, 17));
|
||||
TConstructClientRegistry.registerManualIcon("slimecrystal", new ItemStack(TContent.materials, 1, 1));
|
||||
TConstructClientRegistry.registerManualIcon("paperstack", new ItemStack(TContent.materials, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("cobaltingot", new ItemStack(TContent.materials, 1, 3));
|
||||
TConstructClientRegistry.registerManualIcon("arditeingot", new ItemStack(TContent.materials, 1, 4));
|
||||
TConstructClientRegistry.registerManualIcon("copperingot", new ItemStack(TContent.materials, 1, 9));
|
||||
TConstructClientRegistry.registerManualIcon("steelingot", new ItemStack(TContent.materials, 1, 16));
|
||||
<<<<<<< HEAD:src/tconstruct/client/TProxyClient.java
|
||||
TConstructClientRegistry.registerManualIcon("pigironingot", new ItemStack(TContent.materials, 1, 34));
|
||||
=======
|
||||
TConstructClientRegistry.registerManualIcon("pigironingot", new ItemStack(TContent.materials, 1, 34));
|
||||
|
||||
>>>>>>> origin/gradle:src/main/java/tconstruct/client/TProxyClient.java
|
||||
|
||||
// Tool parts
|
||||
TConstructClientRegistry.registerManualIcon("pickhead", new ItemStack(TContent.pickaxeHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("shovelhead", new ItemStack(TContent.shovelHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("axehead", new ItemStack(TContent.hatchetHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("swordblade", new ItemStack(TContent.swordBlade, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("pan", new ItemStack(TContent.frypanHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("board", new ItemStack(TContent.signHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("knifeblade", new ItemStack(TContent.knifeBlade, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("chiselhead", new ItemStack(TContent.chiselHead, 1, 2));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("hammerhead", new ItemStack(TContent.hammerHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("excavatorhead", new ItemStack(TContent.excavatorHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("scythehead", new ItemStack(TContent.scytheBlade, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("broadaxehead", new ItemStack(TContent.broadAxeHead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("largeswordblade", new ItemStack(TContent.largeSwordBlade, 1, 2));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("toolrod", new ItemStack(Item.stick));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("binding", new ItemStack(TContent.binding, 1, 4));
|
||||
TConstructClientRegistry.registerManualIcon("wideguard", new ItemStack(TContent.wideGuard, 1, 4));
|
||||
TConstructClientRegistry.registerManualIcon("handguard", new ItemStack(TContent.handGuard, 1, 4));
|
||||
TConstructClientRegistry.registerManualIcon("crossbar", new ItemStack(TContent.crossbar, 1, 4));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("toughrod", new ItemStack(TContent.toughRod, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("toughbinding", new ItemStack(TContent.toughBinding, 1, 17));
|
||||
TConstructClientRegistry.registerManualIcon("largeplate", new ItemStack(TContent.largePlate, 1, 17));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("bowstring", new ItemStack(TContent.bowstring, 1, 0));
|
||||
TConstructClientRegistry.registerManualIcon("arrowhead", new ItemStack(TContent.arrowhead, 1, 2));
|
||||
TConstructClientRegistry.registerManualIcon("fletching", new ItemStack(TContent.fletching, 1, 0));
|
||||
<<<<<<< HEAD:src/tconstruct/client/TProxyClient.java
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> origin/gradle:src/main/java/tconstruct/client/TProxyClient.java
|
||||
TConstructClientRegistry.registerManualIcon("bloodbucket", new ItemStack(TContent.buckets, 1, 16));
|
||||
TConstructClientRegistry.registerManualIcon("emeraldbucket", new ItemStack(TContent.buckets, 1, 15));
|
||||
TConstructClientRegistry.registerManualIcon("gluebucket", new ItemStack(TContent.buckets, 1, 25));
|
||||
TConstructClientRegistry.registerManualIcon("slimebucket", new ItemStack(TContent.buckets, 1, 24));
|
||||
TConstructClientRegistry.registerManualIcon("enderbucket", new ItemStack(TContent.buckets, 1, 23));
|
||||
|
||||
// ToolIcons
|
||||
TConstructClientRegistry.registerManualIcon("pickicon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.pickaxeHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.binding, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("shovelicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.shovelHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("axeicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.hatchetHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("mattockicon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.hatchetHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.shovelHead, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("swordicon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.swordBlade, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.wideGuard, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("longswordicon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.swordBlade, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.handGuard, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("rapiericon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.swordBlade, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.crossbar, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("daggerIcon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.knifeBlade, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.crossbar, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("frypanicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.frypanHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("battlesignicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.signHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("chiselicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.chiselHead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), null, ""));
|
||||
TConstructClientRegistry.registerManualIcon("shortbowIcon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.toolRod, 1, 10), new ItemStack(TContent.bowstring, 1, 0), new ItemStack(TContent.toolRod, 1, 12), ""));
|
||||
TConstructClientRegistry.registerManualIcon("arrowIcon",
|
||||
ToolBuilder.instance.buildTool(new ItemStack(TContent.arrowhead, 1, 10), new ItemStack(TContent.toolRod, 1, 11), new ItemStack(TContent.fletching, 1, 0), ""));
|
||||
|
||||
TConstructClientRegistry.registerManualIcon("hammericon", ToolBuilder.instance.buildTool(new ItemStack(TContent.hammerHead, 1, 10), new ItemStack(TContent.toughRod, 1, 11), new ItemStack(
|
||||
TContent.largePlate, 1, 12), new ItemStack(TContent.largePlate, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("lumbericon", ToolBuilder.instance.buildTool(new ItemStack(TContent.broadAxeHead, 1, 10), new ItemStack(TContent.toughRod, 1, 11), new ItemStack(
|
||||
TContent.largePlate, 1, 12), new ItemStack(TContent.toughBinding, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("excavatoricon", ToolBuilder.instance.buildTool(new ItemStack(TContent.excavatorHead, 1, 10), new ItemStack(TContent.toughRod, 1, 11),
|
||||
new ItemStack(TContent.largePlate, 1, 12), new ItemStack(TContent.toughBinding, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("scytheicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.scytheBlade, 1, 10), new ItemStack(TContent.toughRod, 1, 11), new ItemStack(
|
||||
TContent.toughBinding, 1, 12), new ItemStack(TContent.toughRod, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("cleavericon", ToolBuilder.instance.buildTool(new ItemStack(TContent.largeSwordBlade, 1, 10), new ItemStack(TContent.toughRod, 1, 11),
|
||||
new ItemStack(TContent.largePlate, 1, 12), new ItemStack(TContent.toughRod, 8), ""));
|
||||
TConstructClientRegistry.registerManualIcon("battleaxeicon", ToolBuilder.instance.buildTool(new ItemStack(TContent.broadAxeHead, 1, 10), new ItemStack(TContent.toughRod, 1, 11),
|
||||
new ItemStack(TContent.broadAxeHead, 1, 12), new ItemStack(TContent.toughBinding, 8), ""));
|
||||
}
|
||||
|
||||
public void initManualRecipes ()
|
||||
{
|
||||
ItemStack pattern = new ItemStack(TContent.blankPattern, 1, 0);
|
||||
|
||||
ItemStack stick = new ItemStack(Item.stick, 1, 0);
|
||||
ItemStack plank = new ItemStack(Block.planks, 1, 0);
|
||||
<<<<<<< HEAD:src/tconstruct/client/TProxyClient.java
|
||||
ItemStack plankSlab = new ItemStack(Block.woodSingleSlab, 1, 0);
|
||||
=======
|
||||
ItemStack plankSlab = new ItemStack(Block.woodSingleSlab, 1, 0);
|
||||
>>>>>>> origin/gradle:src/main/java/tconstruct/client/TProxyClient.java
|
||||
ItemStack workbench = new ItemStack(Block.workbench, 1, 0);
|
||||
ItemStack chest = new ItemStack(Block.chest, 1, 0);
|
||||
ItemStack log = new ItemStack(Block.wood, 1, 0);
|
||||
ItemStack mossycobble = new ItemStack(Block.cobblestoneMossy);
|
||||
ItemStack netherrack = new ItemStack(Block.netherrack);
|
||||
|
||||
ItemStack dirt = new ItemStack(Block.dirt, 1, 0);
|
||||
ItemStack sand = new ItemStack(Block.sand, 1, 0);
|
||||
ItemStack gravel = new ItemStack(Block.gravel, 1, 0);
|
||||
ItemStack clay = new ItemStack(Item.clay, 1, 0);
|
||||
ItemStack glass = new ItemStack(Block.glass, 1, 0);
|
||||
ItemStack ironblock = new ItemStack(Block.blockIron, 1, 0);
|
||||
|
||||
ItemStack grout = new ItemStack(TContent.craftedSoil, 2, 1);
|
||||
ItemStack searedbrick = new ItemStack(TContent.materials, 1, 2);
|
||||
ItemStack searedbrickBlock = new ItemStack(TContent.smeltery, 1, 2);
|
||||
|
||||
ItemStack coal = new ItemStack(Item.coal);
|
||||
ItemStack paper = new ItemStack(Item.paper);
|
||||
ItemStack slimeball = new ItemStack(Item.slimeBall);
|
||||
ItemStack slimyMud = new ItemStack(TContent.craftedSoil);
|
||||
ItemStack blazerod = new ItemStack(Item.blazeRod);
|
||||
ItemStack firecharge = new ItemStack(Item.fireballCharge);
|
||||
ItemStack string = new ItemStack(Item.silk);
|
||||
|
||||
ItemStack silkyCloth = new ItemStack(TContent.materials, 1, 25);
|
||||
|
||||
ItemStack graveyardsoil = new ItemStack(TContent.craftedSoil, 1, 3);
|
||||
ItemStack consecratedsoil = new ItemStack(TContent.craftedSoil, 1, 4);
|
||||
|
||||
// TConstruct recipes
|
||||
<<<<<<< HEAD:src/tconstruct/client/TProxyClient.java
|
||||
TConstructClientRegistry.registerManualLargeRecipe("alternatebook", new ItemStack(Item.book), paper, paper, paper, string, pattern, pattern, null, null, null);
|
||||
=======
|
||||
TConstructClientRegistry.registerManualLargeRecipe("alternatebook", new ItemStack(Item.book), paper, paper, paper, string, pattern, pattern, null, null, null);
|
||||
>>>>>>> origin/gradle:src/main/java/tconstruct/client/TProxyClient.java
|
||||
TConstructClientRegistry.registerManualSmallRecipe("patternbook1", new ItemStack(TContent.manualBook, 1, 0), new ItemStack(Item.paper), pattern, null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("patternbook2", new ItemStack(TContent.manualBook, 1, 1), new ItemStack(TContent.manualBook, 1, 0), null, null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("patternbook3", new ItemStack(TContent.manualBook, 1, 2), new ItemStack(TContent.manualBook, 1, 1), null, null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("blankpattern", pattern, plank, stick, stick, plank);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("toolstation", new ItemStack(TContent.toolStationWood, 1, 0), null, pattern, null, workbench);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("partcrafter", new ItemStack(TContent.toolStationWood, 1, 1), null, pattern, null, log);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("patternchest", new ItemStack(TContent.toolStationWood, 1, 5), null, pattern, null, chest);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("stenciltable", new ItemStack(TContent.toolStationWood, 1, 10), null, pattern, null, plank);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("slimechannel", new ItemStack(TContent.slimeChannel, 1, 0), new ItemStack(TContent.slimeGel, 1, 0), new ItemStack(Item.redstone), null, null);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("bouncepad", new ItemStack(TContent.slimePad, 1, 0), new ItemStack(TContent.slimeChannel), new ItemStack(Item.slimeBall), null, null);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("toolforge", new ItemStack(TContent.toolForge, 1, 0), searedbrickBlock, searedbrickBlock, searedbrickBlock, ironblock, new ItemStack(
|
||||
TContent.toolStationWood, 1, 0), ironblock, ironblock, null, ironblock);
|
||||
|
||||
TConstructClientRegistry.registerManualLargeRecipe("slimymud", slimyMud, null, slimeball, slimeball, null, slimeball, slimeball, null, dirt, sand);
|
||||
TConstructClientRegistry.registerManualFurnaceRecipe("slimecrystal", new ItemStack(TContent.materials, 1, 1), slimyMud);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("paperstack", new ItemStack(TContent.materials, 1, 0), paper, paper, paper, paper);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("mossball", new ItemStack(TContent.materials, 1, 6), mossycobble, mossycobble, mossycobble, mossycobble, mossycobble, mossycobble,
|
||||
mossycobble, mossycobble, mossycobble);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("lavacrystal", new ItemStack(TContent.materials, 1, 7), blazerod, firecharge, blazerod, firecharge, new ItemStack(Item.bucketLava),
|
||||
firecharge, blazerod, firecharge, blazerod);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("silkycloth", silkyCloth, string, string, string, string, new ItemStack(TContent.materials, 1, 24), string, string, string, string);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("silkyjewel", new ItemStack(TContent.materials, 1, 26), null, silkyCloth, null, silkyCloth, new ItemStack(Item.emerald), silkyCloth, null,
|
||||
silkyCloth, null);
|
||||
|
||||
TConstructClientRegistry.registerManualSmallRecipe("graveyardsoil", graveyardsoil, new ItemStack(Block.dirt), new ItemStack(Item.rottenFlesh), new ItemStack(Item.dyePowder, 1, 15), null);
|
||||
TConstructClientRegistry.registerManualFurnaceRecipe("consecratedsoil", consecratedsoil, graveyardsoil);
|
||||
|
||||
TConstructClientRegistry.registerManualSmallRecipe("grout", grout, sand, gravel, null, clay);
|
||||
TConstructClientRegistry.registerManualFurnaceRecipe("searedbrick", searedbrick, grout);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("searedbricks", new ItemStack(TContent.smeltery, 1, 2), searedbrick, searedbrick, searedbrick, searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterycontroller", new ItemStack(TContent.smeltery, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, null, searedbrick,
|
||||
searedbrick, searedbrick, searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("dryingrack", new ItemStack(TContent.dryingRack, 1, 0), null, null, null, plankSlab, plankSlab, plankSlab, null, null,
|
||||
null);
|
||||
<<<<<<< HEAD:src/tconstruct/client/TProxyClient.java
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterydrain", new ItemStack(TContent.smeltery, 1, 1), searedbrick, null, searedbrick, searedbrick, null, searedbrick, searedbrick, null,
|
||||
=======
|
||||
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterydrain", new ItemStack(TContent.smeltery, 1, 1), searedbrick, null, searedbrick, searedbrick, null, searedbrick, searedbrick, null,
|
||||
>>>>>>> origin/gradle:src/main/java/tconstruct/client/TProxyClient.java
|
||||
searedbrick);
|
||||
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterytank1", new ItemStack(TContent.lavaTank, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, glass, searedbrick,
|
||||
searedbrick, searedbrick, searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterytank2", new ItemStack(TContent.lavaTank, 1, 1), searedbrick, glass, searedbrick, glass, glass, glass, searedbrick, glass,
|
||||
searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterytank3", new ItemStack(TContent.lavaTank, 1, 2), searedbrick, glass, searedbrick, searedbrick, glass, searedbrick, searedbrick,
|
||||
glass, searedbrick);
|
||||
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterytable", new ItemStack(TContent.searedBlock, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, null, searedbrick,
|
||||
searedbrick, null, searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelteryfaucet", new ItemStack(TContent.searedBlock, 1, 1), searedbrick, null, searedbrick, null, searedbrick, null, null, null, null);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("castingchannel", new ItemStack(TContent.castingChannel), null, null, null, searedbrick, null, searedbrick, searedbrick, searedbrick,
|
||||
searedbrick);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("smelterybasin", new ItemStack(TContent.searedBlock, 1, 2), searedbrick, null, searedbrick, searedbrick, null, searedbrick, searedbrick,
|
||||
searedbrick, searedbrick);
|
||||
|
||||
//Traps
|
||||
ItemStack reed = new ItemStack(Item.reed);
|
||||
TConstructClientRegistry.registerManualLargeRecipe("punji", new ItemStack(TContent.punji), reed, null, reed, null, reed, null, reed, null, reed);
|
||||
TConstructClientRegistry.registerManualSmallRecipe("barricade", new ItemStack(TContent.barricadeOak), null, log, null, log);
|
||||
|
||||
//Machines
|
||||
ItemStack alubrassIngot = new ItemStack(TContent.materials, 1, 14);
|
||||
ItemStack bronzeIngot = new ItemStack(TContent.materials, 1, 13);
|
||||
ItemStack blankCast = new ItemStack(TContent.blankPattern, 1, 1);
|
||||
ItemStack redstone = new ItemStack(Item.redstone);
|
||||
|
||||
// Modifier recipes
|
||||
ItemStack ironpick = ToolBuilder.instance.buildTool(new ItemStack(TContent.pickaxeHead, 1, 6), new ItemStack(TContent.toolRod, 1, 2), new ItemStack(TContent.binding, 1, 6), "");
|
||||
TConstructClientRegistry.registerManualIcon("ironpick", ironpick);
|
||||
ItemStack ironlongsword = ToolBuilder.instance.buildTool(new ItemStack(TContent.swordBlade, 1, 6), new ItemStack(TContent.toolRod, 1, 2), new ItemStack(TContent.handGuard, 1, 10), "");
|
||||
TConstructClientRegistry.registerManualIcon("ironlongsword", ironlongsword);
|
||||
|
||||
TConstructClientRegistry.registerManualModifier("diamondmod", ironpick.copy(), new ItemStack(Item.diamond));
|
||||
TConstructClientRegistry.registerManualModifier("emeraldmod", ironpick.copy(), new ItemStack(Item.emerald));
|
||||
TConstructClientRegistry.registerManualModifier("redstonemod", ironpick.copy(), new ItemStack(Item.redstone), new ItemStack(Block.blockRedstone));
|
||||
TConstructClientRegistry.registerManualModifier("lavacrystalmod", ironpick.copy(), new ItemStack(TContent.materials, 1, 7));
|
||||
TConstructClientRegistry.registerManualModifier("lapismod", ironpick.copy(), new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Block.blockLapis));
|
||||
TConstructClientRegistry.registerManualModifier("mossmod", ironpick.copy(), new ItemStack(TContent.materials, 1, 6));
|
||||
TConstructClientRegistry.registerManualModifier("quartzmod", ironlongsword.copy(), new ItemStack(Item.netherQuartz), new ItemStack(Block.blockNetherQuartz));
|
||||
TConstructClientRegistry.registerManualModifier("blazemod", ironlongsword.copy(), new ItemStack(Item.blazePowder));
|
||||
TConstructClientRegistry.registerManualModifier("necroticmod", ironlongsword.copy(), new ItemStack(TContent.materials, 1, 8));
|
||||
TConstructClientRegistry.registerManualModifier("silkymod", ironpick.copy(), new ItemStack(TContent.materials, 1, 26));
|
||||
TConstructClientRegistry.registerManualModifier("reinforcedmod", ironpick.copy(), new ItemStack(TContent.largePlate, 1, 6));
|
||||
|
||||
TConstructClientRegistry.registerManualModifier("pistonmod", ironlongsword.copy(), new ItemStack(Block.pistonBase));
|
||||
TConstructClientRegistry.registerManualModifier("beheadingmod", ironlongsword.copy(), new ItemStack(Item.enderPearl), new ItemStack(Block.obsidian));
|
||||
TConstructClientRegistry.registerManualModifier("spidermod", ironlongsword.copy(), new ItemStack(Item.fermentedSpiderEye));
|
||||
TConstructClientRegistry.registerManualModifier("smitemod", ironlongsword.copy(), new ItemStack(TContent.craftedSoil, 1, 4));
|
||||
|
||||
<<<<<<< HEAD:src/tconstruct/client/TProxyClient.java
|
||||
TConstructClientRegistry.registerManualModifier("electricmod", ironpick.copy(), new ItemStack(Block.dirt), new ItemStack(Block.dirt));
|
||||
=======
|
||||
>>>>>>> origin/gradle:src/main/java/tconstruct/client/TProxyClient.java
|
||||
TConstructClientRegistry.registerManualModifier("fluxmod", ironpick.copy(), new ItemStack(Block.dirt));
|
||||
TConstructClientRegistry.registerManualModifier("fluxmod2", ironpick.copy(), new ItemStack(Block.dirt));
|
||||
|
||||
TConstructClientRegistry.registerManualModifier("tier1free", ironpick.copy(), new ItemStack(Item.diamond), new ItemStack(Block.blockGold));
|
||||
TConstructClientRegistry.registerManualModifier("tier2free", ironpick.copy(), new ItemStack(Item.netherStar));
|
||||
|
||||
TConstructClientRegistry.registerManualSmeltery("brownstone", new ItemStack(TContent.speedBlock), new ItemStack(TContent.moltenTin, 1), new ItemStack(Block.gravel));
|
||||
TConstructClientRegistry.registerManualSmeltery("clearglass", new ItemStack(TContent.clearGlass), new ItemStack(TContent.moltenGlass, 1), null);
|
||||
TConstructClientRegistry.registerManualSmeltery("searedstone", new ItemStack(TContent.smeltery, 1, 4), new ItemStack(TContent.moltenStone, 1), null);
|
||||
TConstructClientRegistry.registerManualSmeltery("endstone", new ItemStack(Block.whiteStone), new ItemStack(TContent.moltenEnder, 1), new ItemStack(Block.obsidian));
|
||||
TConstructClientRegistry.registerManualSmeltery("glueball", new ItemStack(TContent.materials, 1, 36), new ItemStack(TContent.glueFluidBlock, 1), null);
|
||||
|
||||
}
|
||||
|
||||
public static Map<String, Class<? extends BookPage>> pageClasses = new HashMap<String, Class<? extends BookPage>>();
|
||||
|
||||
public static void registerManualPage (String type, Class<? extends BookPage> clazz)
|
||||
{
|
||||
pageClasses.put(type, clazz);
|
||||
}
|
||||
|
||||
public static Class<? extends BookPage> getPageClass (String type)
|
||||
{
|
||||
return pageClasses.get(type);
|
||||
}
|
||||
|
||||
void initManualPages ()
|
||||
{
|
||||
TProxyClient.registerManualPage("crafting", CraftingPage.class);
|
||||
TProxyClient.registerManualPage("picture", PicturePage.class);
|
||||
TProxyClient.registerManualPage("text", TextPage.class);
|
||||
TProxyClient.registerManualPage("intro", TextPage.class);
|
||||
TProxyClient.registerManualPage("sectionpage", SectionPage.class);
|
||||
TProxyClient.registerManualPage("intro", TitlePage.class);
|
||||
TProxyClient.registerManualPage("contents", ContentsTablePage.class);
|
||||
TProxyClient.registerManualPage("furnace", FurnacePage.class);
|
||||
TProxyClient.registerManualPage("sidebar", SidebarPage.class);
|
||||
TProxyClient.registerManualPage("materialstats", MaterialPage.class);
|
||||
TProxyClient.registerManualPage("toolpage", ToolPage.class);
|
||||
TProxyClient.registerManualPage("modifier", ModifierPage.class);
|
||||
TProxyClient.registerManualPage("blockcast", BlockCastPage.class);
|
||||
|
||||
TProxyClient.registerManualPage("blank", BlankPage.class);
|
||||
}
|
||||
|
||||
public static Document getManualFromStack (ItemStack stack)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
return volume1;
|
||||
case 1:
|
||||
return volume2;
|
||||
case 2:
|
||||
return smelter;
|
||||
case 3:
|
||||
return diary;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static int[][] itemIcons = { new int[] { 0, 3, 0 }, // Repair
|
||||
new int[] { 1, 4, 0 }, // Pickaxe
|
||||
new int[] { 2, 5, 0 }, // Shovel
|
||||
new int[] { 2, 6, 0 }, // Axe
|
||||
// new int[] {2, 9, 0}, //Lumber Axe
|
||||
// new int[] {1, 7, 0}, //Ice Axe
|
||||
new int[] { 3, 8, 0 }, // Mattock
|
||||
new int[] { 1, 0, 1 }, // Broadsword
|
||||
new int[] { 1, 1, 1 }, // Longsword
|
||||
new int[] { 1, 2, 1 }, // Rapier
|
||||
new int[] { 1, 5, 1 }, // Dagger
|
||||
new int[] { 2, 3, 1 }, // Frying pan
|
||||
new int[] { 2, 4, 1 }, // Battlesign
|
||||
new int[] { 2, 6, 1 } // Chisel
|
||||
};
|
||||
|
||||
static int[][] iconCoords = { new int[] { 0, 1, 2, 13 }, new int[] { 13, 13, 13, 13 }, // Repair
|
||||
new int[] { 0, 0, 1, 13 }, new int[] { 2, 3, 3, 13 }, // Pickaxe
|
||||
new int[] { 3, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Shovel
|
||||
new int[] { 2, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Axe
|
||||
// new int[] { 6, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, //Lumber
|
||||
// Axe
|
||||
// new int[] { 0, 0, 5, 13 }, new int[] { 2, 3, 3, 13 }, //Ice Axe
|
||||
new int[] { 2, 0, 3, 13 }, new int[] { 2, 3, 2, 13 }, // Mattock
|
||||
new int[] { 1, 0, 2, 13 }, new int[] { 2, 3, 3, 13 }, // Broadsword
|
||||
new int[] { 1, 0, 3, 13 }, new int[] { 2, 3, 3, 13 }, // Longsword
|
||||
new int[] { 1, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, // Rapier
|
||||
new int[] { 7, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, // Dagger
|
||||
new int[] { 4, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Frying
|
||||
// Pan
|
||||
new int[] { 5, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Battlesign
|
||||
new int[] { 7, 0, 13, 13 }, new int[] { 3, 3, 13, 13 } // Chisel
|
||||
};
|
||||
|
||||
static String[] toolNames = { "Repair and Modification", "Pickaxe", "Shovel", "Hatchet",
|
||||
// "Lumber Axe",
|
||||
// "Ice Axe",
|
||||
"Mattock", "Broadsword", "Longsword", "Rapier", "Dagger", "Frying Pan", "Battlesign", "Chisel" };
|
||||
|
||||
static String[] toolDescriptions = {
|
||||
"The main way to repair or change your tools. Place a tool and a material on the left to get started.",
|
||||
"The Pickaxe is a precise mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle",
|
||||
"The Shovel is a precise digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle",
|
||||
"The Hatchet is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle",
|
||||
// "The Lumber Axe is a broad chopping tool. It harvests wood in a wide range and can fell entire trees.\n\nRequired parts:\n- Broad Axe Head\n- Handle",
|
||||
// "The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle",
|
||||
"The Cutter Mattock is a versatile farming tool. It is effective on wood, dirt, and plants.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle",
|
||||
"The Broadsword is a defensive weapon. Blocking cuts damage in half.\n\nSpecial Ability: Block\nDamage: Moderate\nDurability: High\n\nRequired parts:\n- Sword Blade\n- Wide Guard\n- Handle",
|
||||
"The Longsword is an offensive weapon. It is often used for charging into battle at full speed.\n\nNatural Ability:\n- Charge Boost\nSpecial Ability: Lunge\n\nDamage: Moderate\nDurability: Moderate",
|
||||
"The Rapier is a special weapon that relies on quick strikes to defeat foes.\n\nNatural Abilities:\n- Armor Pierce\n- Quick Strike\n- Charge Boost\nSpecial Ability:\n- Backpedal\n\nDamage: Low\nDurability: Low",
|
||||
"The Dagger is a short blade that can be thrown.\n\nSpecial Ability:\n- Throw Item\n\nDamage: Low\nDurability: Moderate\n\nRequired parts:\n- Knife Blade\n- Crossbar\n- Handle",
|
||||
"The Frying is a heavy weapon that uses sheer weight to stun foes.\n\nSpecial Ability: Block\nNatural Ability: Heavy\nShift+rClick: Place Frying Pan\nDamage: Low\nDurability: High\n\nRequired parts:\n- Pan\n- Handle",
|
||||
// "The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle"
|
||||
"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Sign Board\n- Handle",
|
||||
"The Chisel is a utility tool that carves shapes into blocks.\n\nCrafting Grid:\n- Shape Items\nSpecial Ability: Chisel\nDurability: Average\n\nRequired parts:\n- Chisel Head\n- Handle" };
|
||||
|
||||
void addToolButtons ()
|
||||
{
|
||||
for (int i = 0; i < toolNames.length; i++)
|
||||
{
|
||||
addToolButton(itemIcons[i][0], itemIcons[i][1], itemIcons[i][2], iconCoords[i * 2], iconCoords[i * 2 + 1], toolNames[i], toolDescriptions[i]);
|
||||
}
|
||||
|
||||
addToolButton(3, 9, 1, new int[] { 0, 10, 0, 13 }, new int[] { 3, 3, 3, 13 }, "Shortbow",
|
||||
"The Shortbow is a ranged weapon. It fires arrows quickly and precisely at its foes.\n\nDraw Speed: Quick\n\nRequired parts:\n- Tool Rod\n- Bowstring\n- Tool Rod");
|
||||
addToolButton(7, 10, 1, new int[] { 11, 0, 12, 13 }, new int[] { 3, 3, 3, 13 }, "Arrow",
|
||||
"Arrows are projectiles usually fired from bows.\n\nRequired parts:\n- Arrowhead\n- Tool Rod\n- Fletching");
|
||||
addTierTwoButton(6, 13, 0, new int[] { 11, 8, 9, 9 }, new int[] { 2, 3, 2, 2 }, "Hammer",
|
||||
"The Hammer is a broad mining tool. It harvests blocks in a wide range and is effective against undead.\n\nNatural Abilities:\nArea of Effect\n- (3x3)\n- Smite\n\nDurability: High");
|
||||
addTierTwoButton(5, 11, 0, new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, "Lumber Axe",
|
||||
"The Lumber Axe is a broad chopping tool. It can fell entire trees or gather wood in a wide range.\n\nNatural Abilities:\nArea of Effect\n- Fell Trees\n- (3x3x3)\n\nDurability: Average");
|
||||
addTierTwoButton(5, 12, 0, new int[] { 10, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, "Excavator",
|
||||
"The Excavator is a broad digging tool. It harvests soil and snow in a wide range.\n\nNatural Ability:\n- Area of Effect\n- (3x3)\n\nDurability: Average");
|
||||
addTierTwoButton(4, 10, 0, new int[] { 8, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, "Scythe",
|
||||
"The Scythe is a broad reaping tool. It is effective on plants and attacks enemies in a wide range.\n\nNatural Ability:\nArea of Effect\n- (3x3x3)\n\nDurability: Average\nDamage: Low, AoE");
|
||||
addTierTwoButton(5, 7, 1, new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, "Cleaver",
|
||||
"The Cleaver is a heavy defensive weapon. It has powerful strikes, but is difficult to wield.\n\nSpecial Ability: Block\nNatural Ability:\n- Beheading\n\nDamage: High\nDurability: Average");
|
||||
addTierTwoButton(5, 8, 1, new int[] { 6, 8, 6, 9 }, new int[] { 2, 3, 2, 3 }, "Battleaxe",
|
||||
"The Battleaxe is a heavy offensive weapon. It is capable of bringing down small trees and can send foes flying.\n\nSpecial Ability: Block\nNatural Abilities:"
|
||||
+ "\n- Knockback\n- Area of Effect\n- (1x9)\n\nDamage: Average\nDurability: Average");
|
||||
}
|
||||
|
||||
void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body)
|
||||
{
|
||||
TConstructClientRegistry.addToolButton(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, "tinker", "textures/gui/icons.png"));
|
||||
}
|
||||
|
||||
void addTierTwoButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body)
|
||||
{
|
||||
TConstructClientRegistry.addTierTwoButton(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, "tinker", "textures/gui/icons.png"));
|
||||
}
|
||||
|
||||
void addRenderMappings ()
|
||||
{
|
||||
String[] partTypes = { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn", "copper", "bronze", "alumite", "steel",
|
||||
"blueslime", "pigiron" };
|
||||
String[] effectTypes = { "diamond", "emerald", "redstone", "piston", "moss", "ice", "lava", "blaze", "necrotic", "flux", "lapis", "quartz", "silk", "beheading", "smite", "spider",
|
||||
"reinforced", "flux" };
|
||||
int[] universalEffects = { 0, 1, 4, 9, 16 };
|
||||
int[] weaponEffects = { 3, 5, 7, 13, 14, 15 };
|
||||
int[] harvestEffects = { 2 };
|
||||
int[] nonUtility = { 6, 8, 10, 11, 12 };
|
||||
|
||||
for (int partIter = 0; partIter < partTypes.length; partIter++)
|
||||
{
|
||||
TConstructClientRegistry.addMaterialRenderMapping(partIter, "tinker", partTypes[partIter], true);
|
||||
}
|
||||
|
||||
for (ToolCore tool : TConstructRegistry.getToolMapping())
|
||||
{
|
||||
for (int i = 0; i < effectTypes.length; i++)
|
||||
{
|
||||
TConstructClientRegistry.addEffectRenderMapping(tool, i, "tinker", effectTypes[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
String[] bowstringTypes = { "string", "magicfabric", "flamestring" };
|
||||
for (int bowIter = 0; bowIter < bowstringTypes.length; bowIter++)
|
||||
{
|
||||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TContent.shortbow, bowIter, "tinker", bowstringTypes[bowIter], true);
|
||||
}
|
||||
|
||||
String[] fletching = { "feather", "leaf", "slime", "blueslime" };
|
||||
for (int arrowIter = 0; arrowIter < fletching.length; arrowIter++)
|
||||
{
|
||||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TContent.arrow, arrowIter, "tinker", fletching[arrowIter], true);
|
||||
}
|
||||
}
|
||||
|
||||
/* Keybindings */
|
||||
public static TControls controlInstance;
|
||||
|
||||
public void registerKeys ()
|
||||
{
|
||||
controlInstance = new TControls();
|
||||
TickRegistry.registerTickHandler(controlInstance, Side.CLIENT);
|
||||
uploadKeyBindingsToGame(Minecraft.getMinecraft().gameSettings, controlInstance);
|
||||
|
||||
TabRegistry.registerTab(new InventoryTabVanilla());
|
||||
TabRegistry.registerTab(new InventoryTabArmorExtended());
|
||||
TabRegistry.registerTab(new InventoryTabKnapsack());
|
||||
}
|
||||
|
||||
public void uploadKeyBindingsToGame (GameSettings settings, TKeyHandler keyhandler)
|
||||
{
|
||||
ArrayList<KeyBinding> harvestedBindings = Lists.newArrayList();
|
||||
for (KeyBinding kb : keyhandler.keyBindings)
|
||||
{
|
||||
harvestedBindings.add(kb);
|
||||
}
|
||||
|
||||
KeyBinding[] modKeyBindings = harvestedBindings.toArray(new KeyBinding[harvestedBindings.size()]);
|
||||
KeyBinding[] allKeys = new KeyBinding[settings.keyBindings.length + modKeyBindings.length];
|
||||
System.arraycopy(settings.keyBindings, 0, allKeys, 0, settings.keyBindings.length);
|
||||
System.arraycopy(modKeyBindings, 0, allKeys, settings.keyBindings.length, modKeyBindings.length);
|
||||
settings.keyBindings = allKeys;
|
||||
settings.loadOptions();
|
||||
}
|
||||
|
||||
public void spawnParticle (String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ)
|
||||
{
|
||||
this.doSpawnParticle(particle, xPos, yPos, zPos, velX, velY, velZ);
|
||||
}
|
||||
|
||||
public EntityFX doSpawnParticle (String par1Str, double par2, double par4, double par6, double par8, double par10, double par12)
|
||||
{
|
||||
if (this.mc == null)
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
|
||||
if (this.mc.renderViewEntity != null && this.mc.effectRenderer != null)
|
||||
{
|
||||
int i = this.mc.gameSettings.particleSetting;
|
||||
|
||||
if (i == 1 && mc.theWorld.rand.nextInt(3) == 0)
|
||||
{
|
||||
i = 2;
|
||||
}
|
||||
|
||||
double d6 = this.mc.renderViewEntity.posX - par2;
|
||||
double d7 = this.mc.renderViewEntity.posY - par4;
|
||||
double d8 = this.mc.renderViewEntity.posZ - par6;
|
||||
EntityFX entityfx = null;
|
||||
|
||||
if (par1Str.equals("hugeexplosion"))
|
||||
{
|
||||
this.mc.effectRenderer.addEffect(entityfx = new EntityHugeExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12));
|
||||
}
|
||||
else if (par1Str.equals("largeexplode"))
|
||||
{
|
||||
this.mc.effectRenderer.addEffect(entityfx = new EntityLargeExplodeFX(mc.renderEngine, mc.theWorld, par2, par4, par6, par8, par10, par12));
|
||||
}
|
||||
else if (par1Str.equals("fireworksSpark"))
|
||||
{
|
||||
this.mc.effectRenderer.addEffect(entityfx = new EntityFireworkSparkFX(mc.theWorld, par2, par4, par6, par8, par10, par12, this.mc.effectRenderer));
|
||||
}
|
||||
|
||||
if (entityfx != null)
|
||||
{
|
||||
return (EntityFX) entityfx;
|
||||
}
|
||||
else
|
||||
{
|
||||
double d9 = 16.0D;
|
||||
|
||||
if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (i > 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par1Str.equals("bubble"))
|
||||
{
|
||||
entityfx = new EntityBubbleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("suspended"))
|
||||
{
|
||||
entityfx = new EntitySuspendFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("depthsuspend"))
|
||||
{
|
||||
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("townaura"))
|
||||
{
|
||||
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("crit"))
|
||||
{
|
||||
entityfx = new EntityCritFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("smoke"))
|
||||
{
|
||||
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("mobSpell"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
|
||||
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
|
||||
}
|
||||
else if (par1Str.equals("mobSpellAmbient"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
|
||||
((EntityFX) entityfx).setAlphaF(0.15F);
|
||||
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
|
||||
}
|
||||
else if (par1Str.equals("spell"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("instantSpell"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
|
||||
}
|
||||
else if (par1Str.equals("witchMagic"))
|
||||
{
|
||||
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
|
||||
float f = mc.theWorld.rand.nextFloat() * 0.5F + 0.35F;
|
||||
((EntityFX) entityfx).setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
|
||||
}
|
||||
else if (par1Str.equals("note"))
|
||||
{
|
||||
entityfx = new EntityNoteFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("portal"))
|
||||
{
|
||||
entityfx = new EntityPortalFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("enchantmenttable"))
|
||||
{
|
||||
entityfx = new EntityEnchantmentTableParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("explode"))
|
||||
{
|
||||
entityfx = new EntityExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("flame"))
|
||||
{
|
||||
entityfx = new EntityFlameFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("lava"))
|
||||
{
|
||||
entityfx = new EntityLavaFX(mc.theWorld, par2, par4, par6);
|
||||
}
|
||||
else if (par1Str.equals("footstep"))
|
||||
{
|
||||
entityfx = new EntityFootStepFX(mc.renderEngine, mc.theWorld, par2, par4, par6);
|
||||
}
|
||||
else if (par1Str.equals("splash"))
|
||||
{
|
||||
entityfx = new EntitySplashFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("largesmoke"))
|
||||
{
|
||||
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12, 2.5F);
|
||||
}
|
||||
else if (par1Str.equals("cloud"))
|
||||
{
|
||||
entityfx = new EntityCloudFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("reddust"))
|
||||
{
|
||||
entityfx = new EntityReddustFX(mc.theWorld, par2, par4, par6, (float) par8, (float) par10, (float) par12);
|
||||
}
|
||||
else if (par1Str.equals("snowballpoof"))
|
||||
{
|
||||
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, Item.snowball);
|
||||
}
|
||||
else if (par1Str.equals("dripWater"))
|
||||
{
|
||||
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.water);
|
||||
}
|
||||
else if (par1Str.equals("dripLava"))
|
||||
{
|
||||
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.lava);
|
||||
}
|
||||
else if (par1Str.equals("snowshovel"))
|
||||
{
|
||||
entityfx = new EntitySnowShovelFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("blueslime"))
|
||||
{
|
||||
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, TContent.strangeFood);
|
||||
}
|
||||
else if (par1Str.equals("heart"))
|
||||
{
|
||||
entityfx = new EntityHeartFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
}
|
||||
else if (par1Str.equals("angryVillager"))
|
||||
{
|
||||
entityfx = new EntityHeartFX(mc.theWorld, par2, par4 + 0.5D, par6, par8, par10, par12);
|
||||
((EntityFX) entityfx).setParticleTextureIndex(81);
|
||||
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else if (par1Str.equals("happyVillager"))
|
||||
{
|
||||
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
|
||||
((EntityFX) entityfx).setParticleTextureIndex(82);
|
||||
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (entityfx != null)
|
||||
{
|
||||
this.mc.effectRenderer.addEffect((EntityFX) entityfx);
|
||||
}
|
||||
|
||||
return (EntityFX) entityfx;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit ()
|
||||
{
|
||||
//MinecraftForgeClient.registerItemRenderer(TContent.armorPattern.itemID, new RenderArmorCast());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ToolCoreRenderer implements IItemRenderer
|
||||
{
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
TConstruct.logger.warning("[TCon] Unhandled render case!");
|
||||
case FIRST_PERSON_MAP:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return handleRenderType(item, type) & helper.ordinal() < ItemRendererHelper.EQUIPPED_BLOCK.ordinal();
|
||||
}
|
||||
|
||||
private static final int toolIcons = 10;
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
ToolCore tool = (ToolCore) item.getItem();
|
||||
|
||||
boolean isInventory = type == ItemRenderType.INVENTORY;
|
||||
Entity ent = null;
|
||||
if (data.length > 1)
|
||||
ent = (Entity) data[1];
|
||||
|
||||
int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage());
|
||||
|
||||
Icon[] tempParts = new Icon[iconParts];
|
||||
label:
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) ent;
|
||||
ItemStack itemInUse = player.getItemInUse();
|
||||
if (itemInUse != null)
|
||||
{
|
||||
int useCount = player.getItemInUseCount();
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount);
|
||||
break label;
|
||||
}
|
||||
}
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
tempParts[i] = tool.getIcon(item, i);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
Icon[] parts = new Icon[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
Icon part = tempParts[i];
|
||||
if (part == null)// || part == ToolCore.blankSprite | part == ToolCore.emptyIcon)
|
||||
++count;
|
||||
else
|
||||
parts[i - count] = part;
|
||||
}
|
||||
iconParts -= count;
|
||||
|
||||
if (iconParts <= 0)
|
||||
{
|
||||
iconParts = 1;
|
||||
// TODO: assign default sprite
|
||||
// parts = new Icon[]{ defaultSprite };
|
||||
}
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
float[] xMax = new float[iconParts];
|
||||
float[] yMin = new float[iconParts];
|
||||
float[] xMin = new float[iconParts];
|
||||
float[] yMax = new float[iconParts];
|
||||
int[] sheetWidth = new int[iconParts];
|
||||
int[] sheetHeight = new int[iconParts];
|
||||
float depth = 1f / 16f;
|
||||
|
||||
float[] width = new float[iconParts];
|
||||
float[] height = new float[iconParts];
|
||||
float[] xDiff = new float[iconParts];
|
||||
float[] yDiff = new float[iconParts];
|
||||
float[] xSub = new float[iconParts];
|
||||
float[] ySub = new float[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
Icon icon = parts[i];
|
||||
xMin[i] = icon.getMinU();
|
||||
xMax[i] = icon.getMaxU();
|
||||
yMin[i] = icon.getMinV();
|
||||
yMax[i] = icon.getMaxV();
|
||||
sheetWidth[i] = icon.getIconWidth();
|
||||
sheetHeight[i] = icon.getIconHeight();
|
||||
xDiff[i] = xMin[i] - xMax[i];
|
||||
yDiff[i] = yMin[i] - yMax[i];
|
||||
width[i] = sheetWidth[i] * xDiff[i];
|
||||
height[i] = sheetHeight[i] * yDiff[i];
|
||||
xSub[i] = 0.5f * (xMax[i] - xMin[i]) / sheetWidth[i];
|
||||
ySub[i] = 0.5f * (yMax[i] - yMin[i]) / sheetHeight[i];
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (type == ItemRenderType.INVENTORY)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
tess.startDrawingQuads();
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
tess.addVertexWithUV(0, 16, 0, xMin[i], yMax[i]);
|
||||
tess.addVertexWithUV(16, 16, 0, xMax[i], yMax[i]);
|
||||
tess.addVertexWithUV(16, 0, 0, xMax[i], yMin[i]);
|
||||
tess.addVertexWithUV(0, 0, 0, xMin[i], yMin[i]);
|
||||
}
|
||||
tess.draw();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0, -4 / 16f, 0);
|
||||
break;
|
||||
case ENTITY:
|
||||
GL11.glTranslatef(0, 4 / 16f, 0);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, 1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
tess.addVertexWithUV(0, 0, 0, xMax[i], yMax[i]);
|
||||
tess.addVertexWithUV(1, 0, 0, xMin[i], yMax[i]);
|
||||
tess.addVertexWithUV(1, 1, 0, xMin[i], yMin[i]);
|
||||
tess.addVertexWithUV(0, 1, 0, xMax[i], yMin[i]);
|
||||
}
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, -1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
tess.addVertexWithUV(0, 1, -depth, xMax[i], yMin[i]);
|
||||
tess.addVertexWithUV(1, 1, -depth, xMin[i], yMin[i]);
|
||||
tess.addVertexWithUV(1, 0, -depth, xMin[i], yMax[i]);
|
||||
tess.addVertexWithUV(0, 0, -depth, xMax[i], yMax[i]);
|
||||
}
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(-1, 0, 0);
|
||||
int k;
|
||||
float pos;
|
||||
float iconPos;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (k = 0; k < width[i]; ++k)
|
||||
{
|
||||
pos = k / width[i];
|
||||
iconPos = xMax[i] + xDiff[i] * pos - xSub[i];
|
||||
tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]);
|
||||
tess.addVertexWithUV(pos, 0, 0, iconPos, yMax[i]);
|
||||
tess.addVertexWithUV(pos, 1, 0, iconPos, yMin[i]);
|
||||
tess.addVertexWithUV(pos, 1, -depth, iconPos, yMin[i]);
|
||||
}
|
||||
}
|
||||
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(1, 0, 0);
|
||||
float posEnd;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (k = 0; k < width[i]; ++k)
|
||||
{
|
||||
pos = k / width[i];
|
||||
iconPos = xMax[i] + xDiff[i] * pos - xSub[i];
|
||||
posEnd = pos + 1 / width[i];
|
||||
tess.addVertexWithUV(posEnd, 1, -depth, iconPos, yMin[i]);
|
||||
tess.addVertexWithUV(posEnd, 1, 0, iconPos, yMin[i]);
|
||||
tess.addVertexWithUV(posEnd, 0, 0, iconPos, yMax[i]);
|
||||
tess.addVertexWithUV(posEnd, 0, -depth, iconPos, yMax[i]);
|
||||
}
|
||||
}
|
||||
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (k = 0; k < height[i]; ++k)
|
||||
{
|
||||
pos = k / height[i];
|
||||
iconPos = yMax[i] + yDiff[i] * pos - ySub[i];
|
||||
posEnd = pos + 1 / height[i];
|
||||
tess.addVertexWithUV(0, posEnd, 0, xMax[i], iconPos);
|
||||
tess.addVertexWithUV(1, posEnd, 0, xMin[i], iconPos);
|
||||
tess.addVertexWithUV(1, posEnd, -depth, xMin[i], iconPos);
|
||||
tess.addVertexWithUV(0, posEnd, -depth, xMax[i], iconPos);
|
||||
}
|
||||
}
|
||||
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, -1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (k = 0; k < height[i]; ++k)
|
||||
{
|
||||
pos = k / height[i];
|
||||
iconPos = yMax[i] + yDiff[i] * pos - ySub[i];
|
||||
tess.addVertexWithUV(1, pos, 0, xMin[i], iconPos);
|
||||
tess.addVertexWithUV(0, pos, 0, xMax[i], iconPos);
|
||||
tess.addVertexWithUV(0, pos, -depth, xMax[i], iconPos);
|
||||
tess.addVertexWithUV(1, pos, -depth, xMin[i], iconPos);
|
||||
}
|
||||
}
|
||||
|
||||
tess.draw();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package tconstruct.client.armor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import tconstruct.items.ArmorPattern;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class RenderArmorCast implements IItemRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
switch (helper)
|
||||
{
|
||||
case BLOCK_3D:
|
||||
return true;
|
||||
case ENTITY_BOBBING:
|
||||
return true;
|
||||
case ENTITY_ROTATION:
|
||||
return true;
|
||||
case EQUIPPED_BLOCK:
|
||||
return true;
|
||||
case INVENTORY_BLOCK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
RenderBlocks renderer = Minecraft.getMinecraft().renderGlobal.globalRenderBlocks;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Icon baseIcon = item.getItem() instanceof ArmorPattern ? ((ArmorPattern) item.getItem()).getBaseIcon() : item.getIconIndex();
|
||||
GL11.glPushMatrix();
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.8F, 0.33F, 0.8F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
GL11.glTranslatef(0F, -0.1F, 0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F);
|
||||
renderCube(tessellator, renderer, baseIcon);
|
||||
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 1.0F, 0.9F);
|
||||
ArrayList<ForgeDirection> sides = new ArrayList<ForgeDirection>();
|
||||
sides.add(ForgeDirection.NORTH);
|
||||
sides.add(ForgeDirection.SOUTH);
|
||||
sides.add(ForgeDirection.EAST);
|
||||
sides.add(ForgeDirection.WEST);
|
||||
renderSelectedCube(tessellator, renderer, baseIcon, sides);
|
||||
renderCastTop(item, type);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderCube (Tessellator tessellator, RenderBlocks renderer, Icon icon)
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(1F, 0F, 0F);
|
||||
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, -1F, 0F);
|
||||
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, -1F);
|
||||
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, 1F);
|
||||
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderSelectedCube (Tessellator tessellator, RenderBlocks renderer, Icon icon, List<ForgeDirection> sidesToRender)
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.WEST))
|
||||
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(1F, 0F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.EAST))
|
||||
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, -1F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.DOWN))
|
||||
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.UP))
|
||||
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, -1F);
|
||||
if (sidesToRender.contains(ForgeDirection.SOUTH))
|
||||
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, 1F);
|
||||
if (sidesToRender.contains(ForgeDirection.NORTH))
|
||||
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderCastTop (ItemStack par1ItemStack, ItemRenderType type)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
Icon icon = par1ItemStack.getIconIndex();
|
||||
|
||||
if (icon == null)
|
||||
{
|
||||
GL11.glPopMatrix();
|
||||
return;
|
||||
}
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().renderEngine;
|
||||
texturemanager.bindTexture(texturemanager.getResourceLocation(par1ItemStack.getItemSpriteNumber()));
|
||||
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.glTranslatef(-f4, -f5, 0.0F);
|
||||
float f6 = 1.5F;
|
||||
GL11.glRotatef(90F, 90F, 0F, 0F);
|
||||
GL11.glScalef(0.9F, 0.9F, 2F);
|
||||
GL11.glTranslatef(0.05F, 0.05F, -0.6F);
|
||||
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.9F);
|
||||
GL11.glTranslatef(0.125F, 0.125F, 0.05F);
|
||||
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
GL11.glScalef(0.6F, 0.6F, 0.6F);
|
||||
GL11.glTranslatef(0.335F, 0.335F, 0.05F);
|
||||
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderItemIn2D (Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4);
|
||||
par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) par3, (double) par4);
|
||||
par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) par3, (double) par2);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) par1, (double) par2);
|
||||
par0Tessellator.draw();
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double) (0.0F - par7), (double) par1, (double) par2);
|
||||
par0Tessellator.addVertexWithUV(1.0D, 1.0D, (double) (0.0F - par7), (double) par3, (double) par2);
|
||||
par0Tessellator.addVertexWithUV(1.0D, 0.0D, (double) (0.0F - par7), (double) par3, (double) par4);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double) (0.0F - par7), (double) par1, (double) par4);
|
||||
par0Tessellator.draw();
|
||||
float f5 = 0.5F * (par1 - par3) / (float) par5;
|
||||
float f6 = 0.5F * (par4 - par2) / (float) par6;
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
int k;
|
||||
float f7;
|
||||
float f8;
|
||||
|
||||
for (k = 0; k < par5; ++k)
|
||||
{
|
||||
f7 = (float) k / (float) par5;
|
||||
f8 = par1 + (par3 - par1) * f7 - f5;
|
||||
par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
|
||||
par0Tessellator.addVertexWithUV((double) f7, 0.0D, 0.0D, (double) f8, (double) par4);
|
||||
par0Tessellator.addVertexWithUV((double) f7, 1.0D, 0.0D, (double) f8, (double) par2);
|
||||
par0Tessellator.addVertexWithUV((double) f7, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
|
||||
}
|
||||
|
||||
par0Tessellator.draw();
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
float f9;
|
||||
|
||||
for (k = 0; k < par5; ++k)
|
||||
{
|
||||
f7 = (float) k / (float) par5;
|
||||
f8 = par1 + (par3 - par1) * f7 - f5;
|
||||
f9 = f7 + 1.0F / (float) par5;
|
||||
par0Tessellator.addVertexWithUV((double) f9, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
|
||||
par0Tessellator.addVertexWithUV((double) f9, 1.0D, 0.0D, (double) f8, (double) par2);
|
||||
par0Tessellator.addVertexWithUV((double) f9, 0.0D, 0.0D, (double) f8, (double) par4);
|
||||
par0Tessellator.addVertexWithUV((double) f9, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
|
||||
}
|
||||
|
||||
par0Tessellator.draw();
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < par6; ++k)
|
||||
{
|
||||
f7 = (float) k / (float) par6;
|
||||
f8 = par4 + (par2 - par4) * f7 - f6;
|
||||
f9 = f7 + 1.0F / (float) par6;
|
||||
par0Tessellator.addVertexWithUV(0.0D, (double) f9, 0.0D, (double) par1, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f9, 0.0D, (double) par3, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f9, (double) (0.0F - par7), (double) par3, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(0.0D, (double) f9, (double) (0.0F - par7), (double) par1, (double) f8);
|
||||
}
|
||||
|
||||
par0Tessellator.draw();
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < par6; ++k)
|
||||
{
|
||||
f7 = (float) k / (float) par6;
|
||||
f8 = par4 + (par2 - par4) * f7 - f6;
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(0.0D, (double) f7, 0.0D, (double) par1, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(0.0D, (double) f7, (double) (0.0F - par7), (double) par1, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f7, (double) (0.0F - par7), (double) par3, (double) f8);
|
||||
}
|
||||
|
||||
par0Tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,155 @@
|
||||
package tconstruct.client.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BarricadeRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int model;
|
||||
|
||||
public BarricadeRender()
|
||||
{
|
||||
model = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block barricade, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
if (modelId == model)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int type = meta % 4;
|
||||
|
||||
if (meta / 4 == 0)
|
||||
{
|
||||
//if (type >= 0)
|
||||
renderer.setRenderBounds(0.125, 0.0, 0.5, 0.375, 1.0, 0.75);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
|
||||
if (type >= 1)
|
||||
{
|
||||
renderer.setRenderBounds(0.625, 0.0, 0.5, 0.875, 1.0, 0.75);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
|
||||
if (type >= 2)
|
||||
{
|
||||
renderer.setRenderBounds(0.0, 0.125, 0.25, 1.0, 0.375, 0.5);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
|
||||
if (type >= 3)
|
||||
{
|
||||
renderer.setRenderBounds(0.0, 0.625, 0.25, 1.0, 0.875, 0.5);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
if (meta / 4 == 1)
|
||||
{
|
||||
//if (type >= 0)
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.125, 0.5, 1.0, 0.375);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
|
||||
if (type >= 1)
|
||||
{
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.625, 0.5, 1.0, 0.875);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
|
||||
if (type >= 2)
|
||||
{
|
||||
renderer.setRenderBounds(0.5, 0.125, 0.0, 0.75, 0.375, 1.0);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
|
||||
if (type >= 3)
|
||||
{
|
||||
renderer.setRenderBounds(0.5, 0.625, 0.0, 0.75, 0.875, 1.0);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
if (meta / 4 == 2)
|
||||
{
|
||||
//if (type >= 0)
|
||||
renderer.setRenderBounds(0.125, 0.0, 0.25, 0.375, 1.0, 0.5);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
|
||||
if (type >= 1)
|
||||
{
|
||||
renderer.setRenderBounds(0.625, 0.0, 0.25, 0.875, 1.0, 0.5);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
|
||||
if (type >= 2)
|
||||
{
|
||||
renderer.setRenderBounds(0.0, 0.125, 0.5, 1.0, 0.375, 0.75);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
|
||||
if (type >= 3)
|
||||
{
|
||||
renderer.setRenderBounds(0.0, 0.625, 0.5, 1.0, 0.875, 0.75);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
if (meta / 4 == 3)
|
||||
{
|
||||
//if (type >= 0)
|
||||
renderer.setRenderBounds(0.5, 0.0, 0.125, 0.75, 1.0, 0.375);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
|
||||
if (type >= 1)
|
||||
{
|
||||
renderer.setRenderBounds(0.5, 0.0, 0.625, 0.75, 1.0, 0.875);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
|
||||
if (type >= 2)
|
||||
{
|
||||
renderer.setRenderBounds(0.25, 0.125, 0.0, 0.5, 0.375, 1.0);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
|
||||
if (type >= 3)
|
||||
{
|
||||
renderer.setRenderBounds(0.25, 0.625, 0.0, 0.5, 0.875, 1.0);
|
||||
renderer.renderStandardBlock(barricade, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@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, 1.0F, 0.625F);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
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.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.blocks.logic.CastingChannelLogic;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
/**
|
||||
* @author BluSunrize
|
||||
*/
|
||||
|
||||
public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
//Floor
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Channel Z-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Channel Z+
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Wall X-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Wall X+
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == renderID)
|
||||
{
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (!tile.hasTankConnected(ForgeDirection.DOWN))//CentrePiece, floor is removed if tank below is found
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//"Guiding Borders" when tank below is found
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.125D, 0.3125D, 0.625D, 0.5D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.375D, 0.125D, 0.625D, 0.625D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.125D, 0.3125D, 0.375D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.125D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
/*renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.625D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.625D, 0.6875D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);*/
|
||||
if (tile.hasTankConnected(ForgeDirection.NORTH))//Channel to Z-
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to Z-
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.3125D, 0.625D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (tile.hasTankConnected(ForgeDirection.SOUTH))//Channel to Z+
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to Z+
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (tile.hasTankConnected(ForgeDirection.WEST))//Channel to X-
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.375D, 0.3125D, 0.3125D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.625D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to X-
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (tile.hasTankConnected(ForgeDirection.EAST))//Channel to X+
|
||||
{
|
||||
renderer.setRenderBounds(0.6875D, 0.375D, 0.3125D, 1D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 1D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.625D, 1D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to X+
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (tile.liquid != null)
|
||||
{
|
||||
float height = tile.getLiquidAmount() / (tile.getCapacity() * 1.05F);
|
||||
float j = tile.liquid.amount / tile.fillMax;
|
||||
double startY = tile.tankBelow();
|
||||
//if(tile.nearbyChannel(ForgeDirection.DOWN))startY = -0.5D;
|
||||
//else if(tile.hasTankConnected(ForgeDirection.DOWN))startY = 0D;
|
||||
float liquidAmount = tile.liquid.amount / 288f * 0.125f;
|
||||
renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.5 + liquidAmount, 0.625D); //Center
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
//TConstruct.logger.info(tile.recentlyFilledDelay);
|
||||
|
||||
if (tile.hasTankConnected(ForgeDirection.NORTH))
|
||||
{
|
||||
if (tile.lastProvider == ForgeDirection.NORTH)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.5 + liquidAmount, 0.375D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.recentlyFilledDelay == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.5 + liquidAmount, 0.375D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile.hasTankConnected(ForgeDirection.SOUTH))
|
||||
{
|
||||
if (tile.lastProvider == ForgeDirection.SOUTH)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.5 + liquidAmount, 1D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.recentlyFilledDelay == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.5 + liquidAmount, 1D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile.hasTankConnected(ForgeDirection.WEST))
|
||||
{
|
||||
if (tile.lastProvider == ForgeDirection.WEST)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.5 + liquidAmount, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.recentlyFilledDelay == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.5 + liquidAmount, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile.hasTankConnected(ForgeDirection.EAST))
|
||||
{
|
||||
if (tile.lastProvider == ForgeDirection.EAST)
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.5 + liquidAmount, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.recentlyFilledDelay == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.5 + liquidAmount, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*if(tile.lastProvider==ForgeDirection.UP && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}*/
|
||||
|
||||
/*if(tile.hasTankConnected(ForgeDirection.NORTH)&&tile.lastProvider!=ForgeDirection.NORTH)//Channel to Z-
|
||||
{
|
||||
if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.625D, 0.375D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
if(tile.hasTankConnected(ForgeDirection.SOUTH)&&tile.lastProvider!=ForgeDirection.SOUTH)//Channel to Z+
|
||||
{
|
||||
if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 1D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
if(tile.hasTankConnected(ForgeDirection.WEST)&&tile.lastProvider!=ForgeDirection.WEST)//Channel to X-
|
||||
{
|
||||
if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.625D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
if(tile.hasTankConnected(ForgeDirection.EAST)&&tile.lastProvider!=ForgeDirection.EAST)//Channel to X+
|
||||
{
|
||||
if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.625D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
if(tile.lastProvider==ForgeDirection.NORTH && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 1D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.lastProvider==ForgeDirection.SOUTH && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.625D, 0.375D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.lastProvider==ForgeDirection.WEST && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.625D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.lastProvider==ForgeDirection.EAST && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.625D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderLiquidPart (IBlockAccess world, int x, int y, int z, Block block, RenderBlocks renderer, CastingChannelLogic logic)
|
||||
{
|
||||
FluidStack liquid = logic.liquid;
|
||||
int color = block.colorMultiplier(world, x, y, z);
|
||||
float red = (color >> 16 & 0xFF) / 255.0F;
|
||||
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||
float blue = (color & 0xFF) / 255.0F;
|
||||
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);
|
||||
}
|
||||
|
||||
private void renderStandardBlock (Block block, int meta, RenderBlocks renderer)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return renderID;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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.setParticleIcon(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,71 @@
|
||||
package tconstruct.client.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.client.renderer.entity.*;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.blocks.logic.CastingBasinLogic;
|
||||
import tconstruct.entity.FancyEntityItem;
|
||||
import tconstruct.library.ItemBlocklike;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
else if (!(stack.getItem() instanceof ItemBlocklike))
|
||||
{
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glRotatef(90F, 0F, 0F, 1F);
|
||||
GL11.glScalef(0.75F, 0.75F, 0.75F);
|
||||
GL11.glTranslatef(0F, -0.235F, -0.36F);
|
||||
}
|
||||
|
||||
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,70 @@
|
||||
package tconstruct.client.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.client.renderer.entity.*;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.blocks.logic.CastingTableLogic;
|
||||
import tconstruct.entity.FancyEntityItem;
|
||||
import tconstruct.library.ItemBlocklike;
|
||||
|
||||
/* 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)
|
||||
{
|
||||
//TConstruct.logger.info("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 || stack.getItem() instanceof ItemBlocklike)
|
||||
{
|
||||
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,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)
|
||||
{
|
||||
//TConstruct.logger.info("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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
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);
|
||||
renderHandle(world, x, y, z, block, renderer);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void renderHandle (IBlockAccess world, int x, int y, int z, Block block, RenderBlocks renderer)
|
||||
{
|
||||
switch (world.getBlockMetadata(x, y, z))
|
||||
{
|
||||
case 0:
|
||||
renderer.setRenderBounds(1F, 0.0F, 0.4375F, 2F, 0.125F, 0.5625F);
|
||||
break;
|
||||
case 1:
|
||||
renderer.setRenderBounds(-1F, 0.0F, 0.4375F, 0F, 0.125F, 0.5625F);
|
||||
break;
|
||||
case 2:
|
||||
renderer.setRenderBounds(0.4375F, 0.0F, -1F, 0.5625F, 0.125F, 0F);
|
||||
break;
|
||||
case 3:
|
||||
renderer.setRenderBounds(0.4375F, 0.0F, 1F, 0.5625F, 0.125F, 2F);
|
||||
break;
|
||||
}
|
||||
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
@@ -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,100 @@
|
||||
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)
|
||||
{
|
||||
boolean temp = renderer.renderAllFaces;
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
GlassPaneConnected pane = (GlassPaneConnected) block;
|
||||
|
||||
boolean flag = pane.canPaneConnectTo(world, x, y, z, EAST);
|
||||
boolean flag1 = pane.canPaneConnectTo(world, x, y, z, WEST);
|
||||
boolean flag2 = pane.canPaneConnectTo(world, x, y, z, SOUTH);
|
||||
boolean flag3 = pane.canPaneConnectTo(world, x, y, z, NORTH);
|
||||
|
||||
Icon sideTexture = pane.getSideTextureIndex();
|
||||
|
||||
if (!flag && !flag1 && !flag2 && !flag3)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0D, 0.45D, 1D, 1D, 0.55D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
// renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 0.55D);
|
||||
// renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
// renderer.setOverrideBlockTexture(sideTexture);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
renderer.setRenderBounds(0.45D, 0D, 0.45D, 1D, 1D, 0.55D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0D, 0.45D, 0.45D, 1D, 0.55D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (flag2)
|
||||
{
|
||||
renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (flag3)
|
||||
{
|
||||
renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 0.45D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
renderer.clearOverrideBlockTexture();
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.getIconWidth();
|
||||
int k1 = icon.getIconHeight();
|
||||
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.getIconWidth();
|
||||
int i2 = icon1.getIconHeight();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
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 PunjiRender 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.4375, 0.0, 0.4375, 0.5625, 1.0f, 0.5625);
|
||||
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);
|
||||
renderer.setRenderBounds(0.4375, 0.0, 0.4375, 0.5625, 0.375f, 0.5625);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
if (metadata >= 1)
|
||||
{
|
||||
renderer.setRenderBounds(0.125, 0.0, 0.125, 0.25, 0.375f, 0.25);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (metadata >= 2)
|
||||
{
|
||||
renderer.setRenderBounds(0.75, 0.0, 0.75, 0.875, 0.375f, 0.875);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (metadata >= 3)
|
||||
{
|
||||
renderer.setRenderBounds(0.125, 0.0, 0.75, 0.25, 0.375f, 0.875);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (metadata >= 4)
|
||||
{
|
||||
renderer.setRenderBounds(0.75, 0.0, 0.125, 0.875, 0.375f, 0.25);
|
||||
renderer.renderStandardBlock(block, 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 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,98 @@
|
||||
package tconstruct.client.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.util.landmine.Helper;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class RenderLandmine implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
|
||||
renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
|
||||
Helper.renderInventoryCube(block, metadata, modelID, renderer);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
if (modelId == getRenderId())
|
||||
{
|
||||
renderBasedOnSide(world, x, y, z, block, modelId, renderer);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
public void renderBasedOnSide (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
int l = world.getBlockMetadata(x, y, z);
|
||||
int i1 = l & 7;
|
||||
boolean flag = (l & 8) > 0;
|
||||
|
||||
ForgeDirection dir = Helper.convertMetaToForgeOrientation(i1);
|
||||
|
||||
//TConstruct.logger.info(i1 + " for " + dir);
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
|
||||
break;
|
||||
case UP:
|
||||
renderer.setRenderBounds(0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F, 1.0F - 0.0625F);
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setRenderBounds(0.0625F, 0.0625F, 0.0F, 1.0F - 0.0625F, 1.0F - 0.0625F, 0.0625F);
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setRenderBounds(0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F);
|
||||
break;
|
||||
case EAST:
|
||||
renderer.setRenderBounds(1.0F - 0.0625F, 0.0625F, 0.0625F, 1.0F, 1.0F - 0.0625F, 1.0F - 0.0625F);
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setRenderBounds(0.0F, 0.0625F, 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F);
|
||||
break;
|
||||
}
|
||||
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,434 @@
|
||||
package tconstruct.client.block;
|
||||
|
||||
import cpw.mods.fml.client.registry.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.logic.*;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.crafting.CastingRecipe;
|
||||
|
||||
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);
|
||||
|
||||
if (world.getBlockTileEntity(x, y, z) instanceof CastingTableLogic)
|
||||
{
|
||||
CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z);
|
||||
if (logic.liquid != null)
|
||||
{
|
||||
float minHeight = 0.9375F;
|
||||
float maxHeight = 1F;
|
||||
|
||||
float minX = 0.0625F;
|
||||
float maxX = 0.9375F;
|
||||
float minZ = 0.0625F;
|
||||
float maxZ = 0.9375F;
|
||||
|
||||
ItemStack it = logic.getStackInSlot(0);
|
||||
if (it != null)
|
||||
{
|
||||
CastingRecipe rec = TConstruct.tableCasting.getCastingRecipe(logic.liquid, it);
|
||||
if (rec != null && rec.fluidRenderProperties != null)
|
||||
{
|
||||
minHeight = rec.fluidRenderProperties.minHeight;
|
||||
maxHeight = rec.fluidRenderProperties.maxHeight;
|
||||
|
||||
minX = rec.fluidRenderProperties.minX;
|
||||
maxX = rec.fluidRenderProperties.maxX;
|
||||
minZ = rec.fluidRenderProperties.minZ;
|
||||
maxZ = rec.fluidRenderProperties.maxZ;
|
||||
}
|
||||
}
|
||||
|
||||
float percent = (float) logic.getLiquidAmount() / (float) logic.getCapacity();
|
||||
float height = percent * (maxHeight - minHeight);
|
||||
//float height = logic.getLiquidAmount() / (logic.getCapacity() * 1.03F) / 16F;
|
||||
renderer.setRenderBounds(minX, minHeight, minZ, maxX, minHeight + height, maxZ);
|
||||
|
||||
Fluid fluid = logic.liquid.getFluid();
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (metadata == 1)
|
||||
{
|
||||
if (world.getBlockTileEntity(x, y, z) instanceof FaucetLogic)
|
||||
{
|
||||
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;
|
||||
}
|
||||
else if (uID == TContent.castingChannel.blockID)
|
||||
{
|
||||
yMin = -0.5F;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
//float xMin = 0.375F, zMin = 0.375F, xMax = 0.625F, zMax = 0.625F;
|
||||
switch (logic.getRenderDirection())
|
||||
{
|
||||
case 3:
|
||||
zMin = 0.0F;
|
||||
zMax = 0.375F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.625F;
|
||||
zMax = 1.0F;
|
||||
break;
|
||||
case 5:
|
||||
xMin = 0.0F;
|
||||
xMax = 0.375F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.625F;
|
||||
xMax = 1.0F;
|
||||
break;
|
||||
}
|
||||
renderer.setRenderBounds(xMin, 0.5F, zMin, xMax, 0.625F, zMax);
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
if (world.getBlockTileEntity(x, y, z) instanceof CastingBasinLogic)
|
||||
{
|
||||
CastingBasinLogic logic = (CastingBasinLogic) world.getBlockTileEntity(x, y, z);
|
||||
if (logic.liquid != null)
|
||||
{
|
||||
float minHeight = 0.25F;
|
||||
float maxHeight = 0.95F;
|
||||
|
||||
float minX = 0.0625F;
|
||||
float maxX = 0.9375F;
|
||||
float minZ = 0.0625F;
|
||||
float maxZ = 0.9375F;
|
||||
|
||||
ItemStack it = logic.getStackInSlot(0);
|
||||
if (it != null)
|
||||
{
|
||||
CastingRecipe rec = TConstruct.basinCasting.getCastingRecipe(logic.liquid, it);
|
||||
if (rec != null && rec.fluidRenderProperties != null)
|
||||
{
|
||||
minHeight = rec.fluidRenderProperties.minHeight;
|
||||
maxHeight = rec.fluidRenderProperties.maxHeight;
|
||||
|
||||
minX = rec.fluidRenderProperties.minX;
|
||||
maxX = rec.fluidRenderProperties.maxX;
|
||||
minZ = rec.fluidRenderProperties.minZ;
|
||||
maxZ = rec.fluidRenderProperties.maxZ;
|
||||
}
|
||||
}
|
||||
float percent = (float) logic.getLiquidAmount() / (float) logic.getCapacity();
|
||||
float height = percent * (maxHeight - minHeight);
|
||||
|
||||
//float height = (logic.getLiquidAmount() / (logic.getCapacity() * 1.05F) * 0.6875F) / maxHeight;
|
||||
renderer.setRenderBounds(minX, minHeight, minZ, maxX, minHeight + height, maxZ);
|
||||
|
||||
Fluid fluid = logic.liquid.getFluid();
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
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.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class SlimeChannelRender 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)
|
||||
{
|
||||
|
||||
renderRotatedBlock(block, x, y, z, world, renderer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static final float LIGHT_Y_NEG = 0.5F;
|
||||
static final float LIGHT_Y_POS = 1.0F;
|
||||
static final float LIGHT_XZ_NEG = 0.8F;
|
||||
static final float LIGHT_XZ_POS = 0.6F;
|
||||
|
||||
public boolean renderRotatedBlock (Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer)
|
||||
{
|
||||
if (true)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int bMeta = world.getBlockMetadata(x, y, z);
|
||||
Icon iconStill = block.getIcon(1, bMeta);
|
||||
float flowDir = (float) (bMeta / 8f * 2 * Math.PI); //Tau, radians
|
||||
|
||||
double u1, u2, u3, u4, v1, v2, v3, v4;
|
||||
|
||||
if (flowDir < -999.0F)
|
||||
{
|
||||
u2 = iconStill.getInterpolatedU(0.0D);
|
||||
v2 = iconStill.getInterpolatedV(0.0D);
|
||||
u1 = u2;
|
||||
v1 = iconStill.getInterpolatedV(16.0D);
|
||||
u4 = iconStill.getInterpolatedU(16.0D);
|
||||
v4 = v1;
|
||||
u3 = u4;
|
||||
v3 = v2;
|
||||
}
|
||||
else
|
||||
{
|
||||
float xFlow = MathHelper.sin(flowDir) * 0.25F;
|
||||
float zFlow = MathHelper.cos(flowDir) * 0.25F;
|
||||
u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
|
||||
v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F);
|
||||
u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F);
|
||||
v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F);
|
||||
u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F);
|
||||
v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F);
|
||||
u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F);
|
||||
v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F);
|
||||
}
|
||||
int color = block.colorMultiplier(world, x, y, z);
|
||||
float red = (color >> 16 & 255) / 255.0F;
|
||||
float green = (color >> 8 & 255) / 255.0F;
|
||||
float blue = (color & 255) / 255.0F;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);
|
||||
|
||||
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 0, u2, v2);
|
||||
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 1, u1, v1);
|
||||
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 1, u4, v4);
|
||||
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 0, u3, v3);
|
||||
}
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
/*int direction = world.getBlockMetadata(x, y, z) % 4;
|
||||
if (direction == 0)
|
||||
renderer.uvRotateTop = 2;
|
||||
if (direction == 1)
|
||||
renderer.uvRotateTop = 1;
|
||||
if (direction == 2)
|
||||
renderer.uvRotateTop = 0;
|
||||
if (direction == 3)
|
||||
renderer.uvRotateTop = 3;
|
||||
|
||||
boolean flag = renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.uvRotateTop = 0;
|
||||
return flag;*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package tconstruct.client.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import tconstruct.blocks.SlimePad;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.common.TContent;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class SlimePadRender 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, TContent.slimeGel, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
BlockSkinRenderHelper.renderLiquidBlock(((SlimePad) block).getFluidIcon(metadata), ((SlimePad) block).getFluidIcon(metadata), x, y, z, renderer, world);
|
||||
|
||||
float[] size = size(metadata % 8);
|
||||
renderer.setRenderBounds(size[0], 0.5f, size[1], size[2], 0.6875f, size[3]);
|
||||
BlockSkinRenderHelper.renderLiquidBlock(((SlimePad) block).getNubIcon(metadata), ((SlimePad) block).getNubIcon(metadata), x, y, z, renderer, world);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
float[] size (int meta)
|
||||
{
|
||||
//xMin, zMin, xMax, zMax
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return new float[] { 0.375f, 0.6875f, 0.625f, 0.9375f };
|
||||
case 1:
|
||||
return new float[] { 0.0625f, 0.6875f, 0.3125f, 0.9375f };
|
||||
case 2:
|
||||
return new float[] { 0.0625f, 0.375f, 0.3125f, 0.625f };
|
||||
case 3:
|
||||
return new float[] { 0.0625f, 0.0625f, 0.3125f, 0.3125f };
|
||||
case 4:
|
||||
return new float[] { 0.375f, 0.0625f, 0.625f, 0.3125f };
|
||||
case 5:
|
||||
return new float[] { 0.6875f, 0.0625f, 0.9375f, 0.3125f };
|
||||
case 6:
|
||||
return new float[] { 0.6875f, 0.375f, 0.9375f, 0.625f };
|
||||
case 7:
|
||||
return new float[] { 0.6875f, 0.6875f, 0.9375f, 0.9375f };
|
||||
}
|
||||
return new float[] { 0.375f, 0.375f, 0.625f, 0.625f };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package tconstruct.client.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.logic.TankAirLogic;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class TankAirRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
private static final double capacity = TConstruct.ingotLiquidValue * 18;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
//No inventory block
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
TankAirLogic logic = (TankAirLogic) world.getBlockTileEntity(x, y, z);
|
||||
if (logic.hasItem())
|
||||
{
|
||||
ItemStack item = logic.getStackInSlot(0);
|
||||
if (item.getItem() instanceof ItemBlock)
|
||||
{
|
||||
Block inv = Block.blocksList[item.itemID];
|
||||
renderer.setOverrideBlockTexture(inv.getIcon(1, item.getItemDamage()));
|
||||
renderer.renderBlockByRenderType(inv, x, y, z);
|
||||
renderer.clearOverrideBlockTexture();
|
||||
}
|
||||
}
|
||||
else if (logic.hasFluids())
|
||||
{
|
||||
int base = 0;
|
||||
for (FluidStack fluidstack : logic.getFluids())
|
||||
{
|
||||
Fluid fluid = fluidstack.getFluid();
|
||||
//System.out.println("Base: "+getBaseAmount(base)+", Height: "+getHeightAmount(base, fluidstack.amount)+", fluid amount: "+fluidstack.amount);
|
||||
renderer.setRenderBounds(0.0, getBaseAmount(base), 0.0, 1.0, getHeightAmount(base, fluidstack.amount), 1.0);
|
||||
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);
|
||||
base += fluidstack.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private double getBaseAmount (int base)
|
||||
{
|
||||
return base / capacity;
|
||||
}
|
||||
|
||||
private double getHeightAmount (int base, int amount)
|
||||
{
|
||||
return (base + amount) / capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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 getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/pullcart.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 getEntityTexture (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.bindEntityTexture(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.getResourceLocation(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().getTextureManager();
|
||||
ResourceLocation resourcelocation = texturemanager.getResourceLocation(par1EntityItem.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("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.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getIconWidth(), ((Icon) par2Icon).getIconHeight(), f12);
|
||||
|
||||
if (itemstack.hasEffect(pass))
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.bindTexture(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.bindTexture(TextureMap.locationBlocksTexture);
|
||||
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.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
|
||||
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.getResourceLocation(par3ItemStack.getItemSpriteNumber());
|
||||
par2TextureManager.bindTexture(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("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.bindTexture(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.bindTexture(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 getEntityTexture (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,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,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,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
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.EntityLivingBase;
|
||||
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
|
||||
{
|
||||
static final ResourceLocation texture = new ResourceLocation("tinker", "textures/mob/slimeedible.png");
|
||||
private ModelBase scaleAmount;
|
||||
|
||||
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
|
||||
{
|
||||
super(par1ModelBase, par3);
|
||||
this.scaleAmount = par2ModelBase;
|
||||
}
|
||||
|
||||
@Override
|
||||
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.setBossStatus(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
|
||||
*/
|
||||
@Override
|
||||
protected void preRenderCallback (EntityLivingBase par1EntityLiving, float par2)
|
||||
{
|
||||
this.scaleSlime((BlueSlime) par1EntityLiving, par2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries whether should render the specified pass or not.
|
||||
*/
|
||||
@Override
|
||||
protected int shouldRenderPass (EntityLivingBase par1EntityLiving, int par2, float par3)
|
||||
{
|
||||
return this.shouldSlimeRenderPass((BlueSlime) par1EntityLiving, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package tconstruct.client.entity.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.entity.item.ExplosivePrimed;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ExplosiveRender extends Render
|
||||
{
|
||||
private RenderBlocks blockRenderer = new RenderBlocks();
|
||||
|
||||
public ExplosiveRender()
|
||||
{
|
||||
this.shadowSize = 0.5F;
|
||||
}
|
||||
|
||||
public void renderPrimedTNT (ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
float f2;
|
||||
|
||||
if ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F)
|
||||
{
|
||||
f2 = 1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F;
|
||||
|
||||
if (f2 < 0.0F)
|
||||
{
|
||||
f2 = 0.0F;
|
||||
}
|
||||
|
||||
if (f2 > 1.0F)
|
||||
{
|
||||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
f2 *= f2;
|
||||
f2 *= f2;
|
||||
float f3 = 1.0F + f2 * 0.3F;
|
||||
GL11.glScalef(f3, f3, f3);
|
||||
}
|
||||
|
||||
f2 = (1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F;
|
||||
this.bindEntityTexture(par1EntityTNTPrimed);
|
||||
this.blockRenderer.renderBlockAsItem(TContent.slimeExplosive, 0, par1EntityTNTPrimed.getBrightness(par9));
|
||||
|
||||
if (par1EntityTNTPrimed.fuse / 5 % 2 == 0)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);
|
||||
this.blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110808_a (ExplosivePrimed par1EntityTNTPrimed)
|
||||
{
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
||||
*/
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
return this.func_110808_a((ExplosivePrimed) 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.renderPrimedTNT((ExplosivePrimed) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
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.bindEntityTexture(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 = 1;
|
||||
|
||||
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);
|
||||
|
||||
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())
|
||||
{
|
||||
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
|
||||
{
|
||||
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.getResourceLocation(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().getTextureManager();
|
||||
ResourceLocation resourcelocation = texturemanager.getResourceLocation(arrow.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("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();
|
||||
|
||||
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 = 1;
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
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);
|
||||
// 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.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getIconWidth(), ((Icon) par2Icon).getIconHeight(), f12);
|
||||
|
||||
if (itemstack.hasEffect(pass))
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.bindTexture(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();
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture (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 false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package tconstruct.client.entity.projectile;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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 ArrowRenderCustom extends Render
|
||||
{
|
||||
private static RenderItem renderer = new RenderItem();
|
||||
private Random random = new Random();
|
||||
|
||||
public ArrowRenderCustom()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (ArrowEntity arrow, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
random.setSeed(187L);
|
||||
ItemStack item = arrow.getEntityItem();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par9 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
float shake = arrow.arrowShake - par9;
|
||||
if (shake > 0.0F)
|
||||
GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f);
|
||||
float scale = 1.35f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
ForgeHooksClient.renderEntityItem(null, item, 0, 0, random, renderManager.renderEngine, renderBlocks);
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
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)
|
||||
{
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
renderer.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
return this.func_110796_a((ArrowEntity) par1Entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (ArrowEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,628 @@
|
||||
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 = true;
|
||||
|
||||
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.bindEntityTexture(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.getResourceLocation(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().getTextureManager();
|
||||
ResourceLocation resourcelocation = texturemanager.getResourceLocation(dagger.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("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 * -20;
|
||||
|
||||
//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 = 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...
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
this.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(rotation, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getIconWidth(), ((Icon) par2Icon).getIconHeight(), f12);
|
||||
|
||||
/*if (itemstack.hasEffect(pass))
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.bindTexture(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.bindTexture(TextureMap.locationBlocksTexture);
|
||||
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.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
|
||||
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.getResourceLocation(par3ItemStack.getItemSpriteNumber());
|
||||
par2TextureManager.bindTexture(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("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.bindTexture(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.bindTexture(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 getEntityTexture (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,110 @@
|
||||
package tconstruct.client.entity.projectile;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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 DaggerRenderCustom extends Render
|
||||
{
|
||||
private static RenderItem renderer = new RenderItem();
|
||||
private Random random = new Random();
|
||||
|
||||
public DaggerRenderCustom()
|
||||
{
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (DaggerEntity dagger, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
random.setSeed(187L);
|
||||
ItemStack item = dagger.getEntityItem();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glRotatef(dagger.prevRotationYaw + (dagger.rotationYaw - dagger.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par9 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par9;
|
||||
GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(rotation * 15, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
float shake = dagger.arrowShake - par9;
|
||||
if (shake > 0.0F)
|
||||
GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f);
|
||||
float scale = 1.35f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
ForgeHooksClient.renderEntityItem(null, item, 0, 0, random, renderManager.renderEngine, renderBlocks);
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
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)
|
||||
{
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
renderer.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.doRenderItem((DaggerEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
return this.func_110796_a((DaggerEntity) par1Entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (DaggerEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
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.bindEntityTexture(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 getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
return TextureMap.locationItemsTexture;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package tconstruct.client.event;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import javax.swing.ImageIcon;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
|
||||
public class EventCloakRender
|
||||
{
|
||||
|
||||
private final String serverLocation = "https://raw.github.com/SlimeKnights/TinkersConstruct/master/capes.txt";
|
||||
private final int timeout = 1000;
|
||||
|
||||
private static final Graphics TEST_GRAPHICS = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB).getGraphics();
|
||||
private HashMap<String, String> cloaks = new HashMap<String, String>();
|
||||
private ArrayList<AbstractClientPlayer> capePlayers = new ArrayList<AbstractClientPlayer>();
|
||||
|
||||
public static EventCloakRender instance;
|
||||
|
||||
public EventCloakRender()
|
||||
{
|
||||
buildCloakURLDatabase();
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onPreRenderSpecials (RenderPlayerEvent.Specials.Pre event)
|
||||
{
|
||||
if (Loader.isModLoaded("shadersmod"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer instanceof AbstractClientPlayer)
|
||||
{
|
||||
AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer;
|
||||
|
||||
if (!capePlayers.contains(abstractClientPlayer))
|
||||
{
|
||||
String cloakURL = cloaks.get(event.entityPlayer.username);
|
||||
|
||||
if (cloakURL == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
capePlayers.add(abstractClientPlayer);
|
||||
|
||||
abstractClientPlayer.getTextureCape().textureUploaded = false;
|
||||
new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start();
|
||||
event.renderCape = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void buildCloakURLDatabase ()
|
||||
{
|
||||
URL url;
|
||||
try
|
||||
{
|
||||
url = new URL(serverLocation);
|
||||
URLConnection con = url.openConnection();
|
||||
con.setConnectTimeout(timeout);
|
||||
con.setReadTimeout(timeout);
|
||||
InputStream io = con.getInputStream();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(io));
|
||||
|
||||
String str;
|
||||
int linetracker = 1;
|
||||
while ((str = br.readLine()) != null)
|
||||
{
|
||||
if (!str.startsWith("--"))
|
||||
{
|
||||
if (str.contains(":"))
|
||||
{
|
||||
String nick = str.substring(0, str.indexOf(":"));
|
||||
String link = str.substring(str.indexOf(":") + 1);
|
||||
new Thread(new CloakPreload(link)).start();
|
||||
cloaks.put(nick, link);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("[TinkersConstruct] [skins.txt] Syntax error on line " + linetracker + ": " + str);
|
||||
}
|
||||
}
|
||||
linetracker++;
|
||||
}
|
||||
|
||||
br.close();
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private class CloakThread implements Runnable
|
||||
{
|
||||
|
||||
AbstractClientPlayer abstractClientPlayer;
|
||||
String cloakURL;
|
||||
|
||||
public CloakThread(AbstractClientPlayer player, String cloak)
|
||||
{
|
||||
abstractClientPlayer = player;
|
||||
cloakURL = cloak;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run ()
|
||||
{
|
||||
try
|
||||
{
|
||||
Image cape = new ImageIcon(new URL(cloakURL)).getImage();
|
||||
BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB);
|
||||
bo.getGraphics().drawImage(cape, 0, 0, null);
|
||||
abstractClientPlayer.getTextureCape().bufferedImage = bo;
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CloakPreload implements Runnable
|
||||
{
|
||||
String cloakURL;
|
||||
|
||||
public CloakPreload(String link)
|
||||
{
|
||||
cloakURL = link;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run ()
|
||||
{
|
||||
try
|
||||
{
|
||||
TEST_GRAPHICS.drawImage(new ImageIcon(new URL(cloakURL)).getImage(), 0, 0, null);
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshCapes ()
|
||||
{
|
||||
cloaks.clear();
|
||||
capePlayers.clear();
|
||||
buildCloakURLDatabase();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,505 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.component.SmelteryComponent;
|
||||
import tconstruct.blocks.logic.AdaptiveSmelteryLogic;
|
||||
import tconstruct.inventory.*;
|
||||
import tconstruct.library.component.MultiFluidTank;
|
||||
|
||||
public class AdaptiveSmelteryGui extends NewContainerGui
|
||||
{
|
||||
public AdaptiveSmelteryLogic logic;
|
||||
String username;
|
||||
boolean isScrolling = false;
|
||||
boolean wasClicking;
|
||||
float currentScroll = 0.0F;
|
||||
int slotPos = 0;
|
||||
int prevSlotPos = 0;
|
||||
private final SmelteryComponent scomp;
|
||||
private final MultiFluidTank multitank;
|
||||
|
||||
public AdaptiveSmelteryGui(InventoryPlayer inventoryplayer, AdaptiveSmelteryLogic 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;
|
||||
scomp = logic.getSmeltery();
|
||||
multitank = logic.getMultiTank();
|
||||
scomp.update();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
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.getSizeInventory() > 24)
|
||||
{
|
||||
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 = (mouseY - yScroll - 7.5F) / (scrollHeight - yScroll - 15.0F);
|
||||
|
||||
if (this.currentScroll < 0.0F)
|
||||
{
|
||||
this.currentScroll = 0.0F;
|
||||
}
|
||||
|
||||
if (this.currentScroll > 1.0F)
|
||||
{
|
||||
this.currentScroll = 1.0F;
|
||||
}
|
||||
|
||||
int s = ((AdaptiveSmelteryContainer) this.container).scrollTo(this.currentScroll);
|
||||
if (s != -1)
|
||||
slotPos = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
FluidTankInfo[] info = logic.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
|
||||
int capacity = 0;
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
if (liquid != null)
|
||||
capacity += info[i].capacity;
|
||||
}
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
int basePos = 54;
|
||||
int initialLiquidSize = 0;
|
||||
int liquidSize = 0;
|
||||
if (capacity > 0)
|
||||
{
|
||||
liquidSize = liquid.amount * 52 / capacity;
|
||||
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 (scomp.fuelGague > 0)
|
||||
{
|
||||
int leftX = cornerX + 117;
|
||||
int topY = (cornerY + 68) - scomp.getScaledFuelGague(52);
|
||||
int sizeX = 12;
|
||||
int sizeY = scomp.getScaledFuelGague(52);
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
drawFluidStackTooltip(new FluidStack(-37, scomp.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");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize);
|
||||
|
||||
//Fuel - Lava
|
||||
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
if (scomp.fuelGague > 0)
|
||||
{
|
||||
Icon lavaIcon = Block.lavaStill.getIcon(0, 0);
|
||||
int fuel = scomp.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++;
|
||||
}
|
||||
}
|
||||
|
||||
FluidTankInfo[] info = logic.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
int capacity = 0;
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
if (liquid != null)
|
||||
capacity += info[i].capacity;
|
||||
}
|
||||
|
||||
//Liquids - molten metal
|
||||
int base = 0;
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
Icon renderIndex = liquid.getFluid().getStillIcon();
|
||||
int basePos = 54;
|
||||
if (capacity > 0)
|
||||
{
|
||||
int liquidSize = liquid.amount * 52 / capacity;
|
||||
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.getTextureManager().bindTexture(background);
|
||||
drawTexturedModalRect(cornerX + 54, cornerY + 16, 176, 76, 52, 52);
|
||||
|
||||
//Side inventory
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(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.getSizeInventory();
|
||||
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.fluidID == -37)
|
||||
{
|
||||
list.add("\u00A7fFuel");
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
String name = StatCollector.translateToLocal(FluidRegistry.getFluidName(liquid));
|
||||
list.add("\u00A7f" + name);
|
||||
if (name.equals("liquified emerald"))
|
||||
{
|
||||
list.add("Emeralds: " + liquid.amount / 320f);
|
||||
}
|
||||
else if (name.contains("Molten"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add("Ingots: " + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
{
|
||||
int nuggets = mB / TConstruct.nuggetLiquidValue;
|
||||
int junk = (mB % TConstruct.nuggetLiquidValue);
|
||||
if (nuggets > 0)
|
||||
list.add("Nuggets: " + nuggets);
|
||||
if (junk > 0)
|
||||
list.add("mB: " + junk);
|
||||
}
|
||||
}
|
||||
else if (name.equals("Seared Stone"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add("Blocks: " + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else if (name.equals("Molten Glass"))
|
||||
{
|
||||
int blocks = liquid.amount / 1000;
|
||||
if (blocks > 0)
|
||||
list.add("Blocks: " + blocks);
|
||||
int panels = (liquid.amount % 1000) / 250;
|
||||
if (panels > 0)
|
||||
list.add("Panels: " + panels);
|
||||
int mB = (liquid.amount % 1000) % 250;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
}
|
||||
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(startU + 0, startV + endV, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV());//Bottom left
|
||||
tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV());//Bottom right
|
||||
tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV());//Top right
|
||||
tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV()); //Top left
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
int base = 0;
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
int fluidToBeBroughtUp = -1;
|
||||
|
||||
for (FluidStack liquid : multitank.getAllFluids())
|
||||
{
|
||||
int basePos = 54;
|
||||
int initialLiquidSize = 0;
|
||||
int liquidSize = 0;//liquid.amount * 52 / liquidLayers;
|
||||
if (multitank.getCapacity() > 0)
|
||||
{
|
||||
int total = multitank.getFluidAmount();
|
||||
int liquidLayers = (total / 20000 + 1) * 20000;
|
||||
if (liquidLayers > 0)
|
||||
{
|
||||
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)
|
||||
{
|
||||
fluidToBeBroughtUp = liquid.fluidID;
|
||||
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
DataOutputStream dos = new DataOutputStream(bos);
|
||||
|
||||
try
|
||||
{
|
||||
dos.write(11);
|
||||
|
||||
dos.writeInt(logic.worldObj.provider.dimensionId);
|
||||
dos.writeInt(logic.xCoord);
|
||||
dos.writeInt(logic.yCoord);
|
||||
dos.writeInt(logic.zCoord);
|
||||
|
||||
dos.writeBoolean(this.isShiftKeyDown());
|
||||
|
||||
dos.writeInt(fluidToBeBroughtUp);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
packet.channel = "TConstruct";
|
||||
packet.data = bos.toByteArray();
|
||||
packet.length = bos.size();
|
||||
|
||||
PacketDispatcher.sendPacketToServer(packet);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onGuiClosed ()
|
||||
{
|
||||
super.onGuiClosed();
|
||||
logic.worldObj.markBlockForUpdate(logic.xCoord, logic.yCoord, logic.zCoord);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
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.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import tconstruct.client.tabs.InventoryTabArmorExtended;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
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);
|
||||
|
||||
TabRegistry.updateTabValues(cornerX, cornerY, InventoryTabArmorExtended.class);
|
||||
TabRegistry.addTabsToList(this.buttonList);
|
||||
}
|
||||
|
||||
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.getTextureManager().bindTexture(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);
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.blocks.logic.CraftingStationLogic;
|
||||
import tconstruct.inventory.CraftingStationContainer;
|
||||
|
||||
public class CraftingStationGui extends GuiContainer
|
||||
{
|
||||
public CraftingStationGui(InventoryPlayer inventoryplayer, CraftingStationLogic logic, int x, int y, int z)
|
||||
{
|
||||
super(new CraftingStationContainer(inventoryplayer, logic, x, y, z));
|
||||
}
|
||||
|
||||
/*public void onGuiClosed ()
|
||||
{
|
||||
TConstruct.logger.info("Gui Closed");
|
||||
super.onGuiClosed();
|
||||
}*/
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
fontRenderer.drawString("Crafting", 28, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/crafting.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int l = (width - xSize) / 2;
|
||||
int i1 = (height - ySize) / 2;
|
||||
drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@@ -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.getTextureManager().bindTexture(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,58 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.blocks.logic.FurnaceLogic;
|
||||
import tconstruct.inventory.FurnaceContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FurnaceGui extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png");
|
||||
private FurnaceLogic logic;
|
||||
|
||||
public FurnaceGui(InventoryPlayer inventory, FurnaceLogic furnace)
|
||||
{
|
||||
super(new FurnaceContainer(inventory, furnace));
|
||||
this.logic = furnace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
String s = this.logic.isInvNameLocalized() ? this.logic.getInvName() : I18n.getString(this.logic.getInvName());
|
||||
this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
|
||||
this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the items)
|
||||
*/
|
||||
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
int i1;
|
||||
|
||||
if (this.logic.isBurning())
|
||||
{
|
||||
i1 = this.logic.gaugeFuelScaled(12);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
|
||||
}
|
||||
|
||||
i1 = this.logic.gaugeProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
@@ -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 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.getTextureManager().bindTexture(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.inventory.ContainerLandmine;
|
||||
import tconstruct.util.landmine.behavior.Behavior;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class GuiLandmine extends GuiContainer
|
||||
{
|
||||
|
||||
ContainerLandmine container;
|
||||
|
||||
ResourceLocation background = new ResourceLocation("tinker:textures/gui/landmine.png");
|
||||
|
||||
public GuiLandmine(ContainerLandmine par1Container)
|
||||
{
|
||||
super(par1Container);
|
||||
container = par1Container;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawItemStackTooltip (ItemStack par1ItemStack, int par2, int par3)
|
||||
{
|
||||
List list = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
Behavior b = Behavior.getBehaviorFromStack(par1ItemStack);
|
||||
if (b != null)
|
||||
{
|
||||
b.getInformation(par1ItemStack, list);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
FontRenderer font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
|
||||
drawHoveringText(list, par2, par3, (font == null ? fontRenderer : font));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int i, int j)
|
||||
{
|
||||
if (container.te != null)
|
||||
{
|
||||
fontRenderer.drawString(container.te.getInvName(), 8, 5, 4210752);
|
||||
}
|
||||
else
|
||||
{
|
||||
fontRenderer.drawString("Landmine", 8, 5, 4210752);
|
||||
}
|
||||
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 3, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(background);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.getTextureManager().bindTexture(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.getTextureManager().bindTexture(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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
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.client.tabs.InventoryTabKnapsack;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
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();
|
||||
|
||||
TabRegistry.updateTabValues(cornerX, cornerY, InventoryTabKnapsack.class);
|
||||
TabRegistry.addTabsToList(this.buttonList);
|
||||
|
||||
// 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.getTextureManager().bindTexture(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);
|
||||
}*/
|
||||
}
|
||||
@@ -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.getTextureManager().bindTexture(TextureMap.locationItemsTexture);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
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.PartBuilderLogic;
|
||||
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
|
||||
{
|
||||
PartBuilderLogic logic;
|
||||
String title, otherTitle = "";
|
||||
boolean drawChestPart;
|
||||
boolean hasTop, hasBottom;
|
||||
ItemStack topMaterial, bottomMaterial;
|
||||
ToolMaterial topEnum, bottomEnum;
|
||||
|
||||
public PartCrafterGui(InventoryPlayer inventoryplayer, PartBuilderLogic 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 topResult = logic.getStackInSlot(4);
|
||||
ItemStack bottom = logic.getStackInSlot(3);
|
||||
//ItemStack bottomResult = logic.getStackInSlot(6);
|
||||
if (topMaterial != top)
|
||||
{
|
||||
topMaterial = top;
|
||||
int topID = PatternBuilder.instance.getPartID(top);
|
||||
|
||||
if (topID != Short.MAX_VALUE)// && topResult != null)
|
||||
{
|
||||
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)// && bottomResult != null)
|
||||
{
|
||||
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.getTextureManager().bindTexture(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.getTextureManager().bindTexture(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.getTextureManager().bindTexture(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.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,483 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.logic.SmelteryLogic;
|
||||
import tconstruct.inventory.*;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
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 = (mouseY - yScroll - 7.5F) / (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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
if (liquidLayers > 0)
|
||||
{
|
||||
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(-37, 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");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize);
|
||||
|
||||
//Fuel - Lava
|
||||
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
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;
|
||||
if (liquidLayers > 0)
|
||||
{
|
||||
int liquidSize = liquid.amount * 52 / liquidLayers;
|
||||
if (liquidSize == 0)
|
||||
liquidSize = 1;
|
||||
while (liquidSize > 0)
|
||||
{
|
||||
int size = liquidSize >= 16 ? 16 : liquidSize;
|
||||
if (renderIndex != null)
|
||||
{
|
||||
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.getTextureManager().bindTexture(background);
|
||||
drawTexturedModalRect(cornerX + 54, cornerY + 16, 176, 76, 52, 52);
|
||||
|
||||
//Side inventory
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(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.fluidID == -37)
|
||||
{
|
||||
list.add("\u00A7fFuel");
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
String name = StatCollector.translateToLocal("fluid." + FluidRegistry.getFluidName(liquid));
|
||||
list.add("\u00A7f" + name);
|
||||
if (name.equals("Liquified Emerald"))
|
||||
{
|
||||
list.add("Emeralds: " + liquid.amount / 640f);
|
||||
}
|
||||
else if (name.equals("Molten Glass"))
|
||||
{
|
||||
int blocks = liquid.amount / 1000;
|
||||
if (blocks > 0)
|
||||
list.add("Blocks: " + blocks);
|
||||
int panels = (liquid.amount % 1000) / 250;
|
||||
if (panels > 0)
|
||||
list.add("Panels: " + panels);
|
||||
int mB = (liquid.amount % 1000) % 250;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else if (name.contains("Molten"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add("Ingots: " + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
{
|
||||
int nuggets = mB / TConstruct.nuggetLiquidValue;
|
||||
int junk = (mB % TConstruct.nuggetLiquidValue);
|
||||
if (nuggets > 0)
|
||||
list.add("Nuggets: " + nuggets);
|
||||
if (junk > 0)
|
||||
list.add("mB: " + junk);
|
||||
}
|
||||
}
|
||||
else if (name.equals("Seared Stone"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add("Blocks: " + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
}
|
||||
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(startU + 0, startV + endV, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV());//Bottom left
|
||||
tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV());//Bottom right
|
||||
tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV());//Top right
|
||||
tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV()); //Top left
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked (int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
int base = 0;
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
int fluidToBeBroughtUp = -1;
|
||||
|
||||
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;
|
||||
if (liquidLayers > 0)
|
||||
{
|
||||
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)
|
||||
{
|
||||
fluidToBeBroughtUp = liquid.fluidID;
|
||||
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
DataOutputStream dos = new DataOutputStream(bos);
|
||||
|
||||
try
|
||||
{
|
||||
dos.write(11);
|
||||
|
||||
dos.writeInt(logic.worldObj.provider.dimensionId);
|
||||
dos.writeInt(logic.xCoord);
|
||||
dos.writeInt(logic.yCoord);
|
||||
dos.writeInt(logic.zCoord);
|
||||
|
||||
dos.writeBoolean(this.isShiftKeyDown());
|
||||
|
||||
dos.writeInt(fluidToBeBroughtUp);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
packet.channel = "TConstruct";
|
||||
packet.data = bos.toByteArray();
|
||||
packet.length = bos.size();
|
||||
|
||||
PacketDispatcher.sendPacketToServer(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.getTextureManager().bindTexture(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 - 1)
|
||||
patternIndex = 0;
|
||||
}
|
||||
else if (button.id == 1)
|
||||
{
|
||||
patternIndex--;
|
||||
if (patternIndex < 0)
|
||||
patternIndex = TContent.patternOutputs.length - 2;
|
||||
if (patternIndex == 21)
|
||||
patternIndex--;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,516 @@
|
||||
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(logic.getInvName()), 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;
|
||||
attack *= tool.getDamageModifier();
|
||||
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);
|
||||
}
|
||||
|
||||
protected 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.getTextureManager().bindTexture(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.getTextureManager().bindTexture(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.getTextureManager().bindTexture(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);
|
||||
}*/
|
||||
}
|
||||
@@ -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.getTextureManager().bindTexture(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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().getTextureManager().bindTexture(background);
|
||||
manual.drawTexturedModalRect(localWidth, localHeight + 32, 0, 0, 174, 115);
|
||||
manual.drawTexturedModalRect(localWidth + 62, localHeight + 105, 2, 118, 45, 45);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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,57 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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().getTextureManager().bindTexture(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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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().getTextureManager().bindTexture(background);
|
||||
manual.drawTexturedModalRect(localWidth + 32, localHeight + 32, 0, 0, 111, 114);
|
||||
}
|
||||
}
|
||||
@@ -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 Trait: " + 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 Trait: 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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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().getTextureManager().bindTexture(background);
|
||||
manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
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();
|
||||
|
||||
background = new ResourceLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight)
|
||||
{
|
||||
manual.fonts.drawSplitString(text, localWidth + 8, localHeight, 178, 0);
|
||||
}
|
||||
|
||||
ResourceLocation background;
|
||||
|
||||
public void renderBackgroundLayer (int localWidth, int localHeight)
|
||||
{
|
||||
manual.getMC().getTextureManager().bindTexture(background);
|
||||
//manual.getMC().renderEngine.bindTexture(location);
|
||||
manual.drawTexturedModalRect(localWidth, localHeight + 12, 0, 0, 170, 144);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package tconstruct.client.tabs;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public abstract class AbstractTab extends GuiButton
|
||||
{
|
||||
ResourceLocation texture = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
|
||||
ItemStack renderStack;
|
||||
RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
public AbstractTab(int id, int posX, int posY, ItemStack renderStack)
|
||||
{
|
||||
super(id, posX, posY, 28, 32, "");
|
||||
this.renderStack = renderStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton (Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.drawButton)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int yTexPos = this.enabled ? 0 : 32;
|
||||
int ySize = this.enabled ? 28 : 32;
|
||||
int xOffset = this.id == 2 ? 0 : 1;
|
||||
|
||||
mc.renderEngine.bindTexture(this.texture);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, xOffset * 28, yTexPos, 28, ySize);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
this.zLevel = 100.0F;
|
||||
this.itemRenderer.zLevel = 100.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.itemRenderer.zLevel = 0.0F;
|
||||
this.zLevel = 0.0F;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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)
|
||||
{
|
||||
this.onTabClicked();
|
||||
}
|
||||
|
||||
return inWindow;
|
||||
}
|
||||
|
||||
public abstract void onTabClicked ();
|
||||
|
||||
public abstract boolean shouldAddToList ();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package tconstruct.client.tabs;
|
||||
|
||||
import tconstruct.client.TControls;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class InventoryTabArmorExtended extends AbstractTab
|
||||
{
|
||||
public InventoryTabArmorExtended()
|
||||
{
|
||||
super(0, 0, 0, new ItemStack(Item.plateDiamond));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
TControls.openArmorGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package tconstruct.client.tabs;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.client.TControls;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.common.TContent;
|
||||
|
||||
public class InventoryTabKnapsack extends AbstractTab
|
||||
{
|
||||
public InventoryTabKnapsack()
|
||||
{
|
||||
super(0, 0, 0, new ItemStack(TContent.knapsack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
TControls.openKnapsackGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
return TProxyClient.armorExtended.inventory[2] != null && TProxyClient.armorExtended.inventory[2].getItem() == TContent.knapsack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package tconstruct.client.tabs;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class InventoryTabVanilla extends AbstractTab
|
||||
{
|
||||
public InventoryTabVanilla()
|
||||
{
|
||||
super(0, 0, 0, new ItemStack(Block.workbench));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
TabRegistry.openInventoryGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package tconstruct.client.tabs;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class TabRegistry
|
||||
{
|
||||
private static ArrayList<AbstractTab> tabList = new ArrayList<AbstractTab>();
|
||||
|
||||
public static void registerTab (AbstractTab tab)
|
||||
{
|
||||
tabList.add(tab);
|
||||
}
|
||||
|
||||
public static ArrayList<AbstractTab> getTabList ()
|
||||
{
|
||||
return tabList;
|
||||
}
|
||||
|
||||
public static void addTabsToInventory (GuiContainer gui)
|
||||
{
|
||||
if (gui.getClass() == GuiInventory.class)
|
||||
{
|
||||
//Values are public at runtime.
|
||||
int cornerX = gui.guiLeft;
|
||||
int cornerY = gui.guiTop;
|
||||
gui.buttonList.clear();
|
||||
|
||||
updateTabValues(cornerX, cornerY, InventoryTabVanilla.class);
|
||||
addTabsToList(gui.buttonList);
|
||||
}
|
||||
}
|
||||
|
||||
private static Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
public static void openInventoryGui ()
|
||||
{
|
||||
GuiInventory inventory = new GuiInventory(mc.thePlayer);
|
||||
mc.displayGuiScreen(inventory);
|
||||
TabRegistry.addTabsToInventory(inventory);
|
||||
}
|
||||
|
||||
public static void updateTabValues (int cornerX, int cornerY, Class<?> selectedButton)
|
||||
{
|
||||
int count = 2;
|
||||
for (int i = 0; i < tabList.size(); i++)
|
||||
{
|
||||
AbstractTab t = tabList.get(i);
|
||||
|
||||
if (t.shouldAddToList())
|
||||
{
|
||||
t.id = count;
|
||||
t.xPosition = cornerX + (count - 2) * 28;
|
||||
t.yPosition = cornerY - 28;
|
||||
t.enabled = !t.getClass().equals(selectedButton);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addTabsToList (List buttonList)
|
||||
{
|
||||
for (AbstractTab tab : tabList)
|
||||
{
|
||||
if (tab.shouldAddToList())
|
||||
{
|
||||
buttonList.add(tab);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user