2013-08-27 00:57:08 +02:00
|
|
|
package mekanism.client.render;
|
2013-04-21 06:34:54 +02:00
|
|
|
|
2013-06-26 23:49:47 +02:00
|
|
|
import java.util.Arrays;
|
2013-07-20 18:10:14 +02:00
|
|
|
import java.util.List;
|
2013-06-26 23:49:47 +02:00
|
|
|
|
2013-10-26 19:25:51 +02:00
|
|
|
import mekanism.api.EnumColor;
|
2013-11-24 19:12:42 +01:00
|
|
|
import mekanism.api.gas.EnumGas;
|
2013-05-28 06:29:29 +02:00
|
|
|
import mekanism.common.ISpecialBounds;
|
2013-10-14 20:59:48 +02:00
|
|
|
import mekanism.common.ObfuscatedNames;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.common.util.MekanismUtils;
|
2013-04-21 06:34:54 +02:00
|
|
|
import net.minecraft.block.Block;
|
2013-07-20 18:10:14 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2013-08-02 00:03:43 +02:00
|
|
|
import net.minecraft.client.renderer.GLAllocation;
|
2013-05-20 00:43:01 +02:00
|
|
|
import net.minecraft.client.renderer.OpenGlHelper;
|
2013-04-21 06:34:54 +02:00
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
2013-05-20 00:43:01 +02:00
|
|
|
import net.minecraft.client.renderer.RenderHelper;
|
2013-04-21 06:34:54 +02:00
|
|
|
import net.minecraft.client.renderer.Tessellator;
|
2013-10-14 04:50:21 +02:00
|
|
|
import net.minecraft.client.renderer.entity.RenderManager;
|
2013-07-20 18:10:14 +02:00
|
|
|
import net.minecraft.client.renderer.texture.TextureManager;
|
|
|
|
import net.minecraft.client.renderer.texture.TextureMap;
|
2013-10-14 04:50:21 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2013-04-21 06:34:54 +02:00
|
|
|
import net.minecraft.util.Icon;
|
2013-07-20 18:10:14 +02:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
import net.minecraft.util.Timer;
|
2013-11-24 19:12:42 +01:00
|
|
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
2013-06-02 23:44:59 +02:00
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
2013-11-24 19:12:42 +01:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
|
|
import net.minecraftforge.event.ForgeSubscribe;
|
2013-07-20 18:10:14 +02:00
|
|
|
import net.minecraftforge.fluids.Fluid;
|
2013-04-21 06:34:54 +02:00
|
|
|
|
2013-05-20 00:43:01 +02:00
|
|
|
import org.lwjgl.opengl.GL11;
|
2013-10-14 04:50:21 +02:00
|
|
|
import org.lwjgl.opengl.GL12;
|
2013-05-20 00:43:01 +02:00
|
|
|
|
2013-11-24 19:12:42 +01:00
|
|
|
import cpw.mods.fml.common.Mod.EventHandler;
|
2013-05-29 17:35:30 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2013-05-20 00:43:01 +02:00
|
|
|
public class MekanismRenderer
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
|
|
|
private static RenderBlocks renderBlocks = new RenderBlocks();
|
|
|
|
|
2013-10-26 19:25:51 +02:00
|
|
|
public static Icon[] colors = new Icon[256];
|
|
|
|
|
2013-11-24 19:12:42 +01:00
|
|
|
public static Icon energyIcon;
|
|
|
|
|
2013-05-20 00:43:01 +02:00
|
|
|
private static float lightmapLastX;
|
|
|
|
private static float lightmapLastY;
|
2013-07-31 04:28:46 +02:00
|
|
|
private static boolean optifineBreak = false;
|
2013-11-24 19:12:42 +01:00
|
|
|
|
|
|
|
public static void init()
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.register(new MekanismRenderer());
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
@ForgeSubscribe /* Screwy Forge code */
|
|
|
|
public void onStitch(TextureStitchEvent.Pre event)
|
|
|
|
{
|
|
|
|
if(event.map.textureType == 0)
|
|
|
|
{
|
|
|
|
for(EnumColor color : EnumColor.values())
|
|
|
|
{
|
|
|
|
colors[color.ordinal()] = event.map.registerIcon("mekanism:Overlay" + color.friendlyName.replace(" ", ""));
|
|
|
|
}
|
|
|
|
|
|
|
|
energyIcon = event.map.registerIcon("mekanism:LiquidEnergy");
|
|
|
|
|
|
|
|
EnumGas.HYDROGEN.gasIcon = event.map.registerIcon("mekanism:LiquidHydrogen");
|
|
|
|
EnumGas.OXYGEN.gasIcon = event.map.registerIcon("mekanism:LiquidOxygen");
|
|
|
|
}
|
|
|
|
}
|
2013-07-31 04:28:46 +02:00
|
|
|
|
2013-04-23 21:36:43 +02:00
|
|
|
public static class Model3D
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
|
|
|
public double minX;
|
|
|
|
public double minY;
|
|
|
|
public double minZ;
|
|
|
|
public double maxX;
|
|
|
|
public double maxY;
|
|
|
|
public double maxZ;
|
2013-06-02 23:44:59 +02:00
|
|
|
|
2013-06-26 23:49:47 +02:00
|
|
|
public Icon[] textures = new Icon[6];
|
|
|
|
|
2013-08-02 00:14:26 +02:00
|
|
|
public boolean[] renderSides = new boolean[] {true, true, true, true, true, true, false};
|
2013-04-21 06:34:54 +02:00
|
|
|
|
|
|
|
public Block baseBlock = Block.sand;
|
2013-06-02 23:44:59 +02:00
|
|
|
|
|
|
|
public final void setBlockBounds(float xNeg, float yNeg, float zNeg, float xPos, float yPos, float zPos)
|
|
|
|
{
|
|
|
|
minX = xNeg;
|
|
|
|
minY = yNeg;
|
|
|
|
minZ = zNeg;
|
|
|
|
maxX = xPos;
|
|
|
|
maxY = yPos;
|
|
|
|
maxZ = zPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSideRender(ForgeDirection side, boolean value)
|
|
|
|
{
|
|
|
|
renderSides[side.ordinal()] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean shouldSideRender(ForgeDirection side)
|
|
|
|
{
|
|
|
|
return renderSides[side.ordinal()];
|
|
|
|
}
|
2013-04-21 06:34:54 +02:00
|
|
|
|
|
|
|
public Icon getBlockTextureFromSide(int i)
|
|
|
|
{
|
2013-06-26 23:49:47 +02:00
|
|
|
return textures[i];
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
2013-06-26 23:49:47 +02:00
|
|
|
|
|
|
|
public void setTexture(Icon tex)
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
2013-06-26 23:49:47 +02:00
|
|
|
Arrays.fill(textures, tex);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTextures(Icon down, Icon up, Icon north, Icon south, Icon west, Icon east)
|
|
|
|
{
|
|
|
|
textures[0] = down;
|
|
|
|
textures[1] = up;
|
|
|
|
textures[2] = north;
|
|
|
|
textures[3] = south;
|
|
|
|
textures[4] = west;
|
|
|
|
textures[5] = east;
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-02 23:44:59 +02:00
|
|
|
public static void renderObject(Model3D object)
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
2013-06-29 23:24:54 +02:00
|
|
|
if(object == null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-04-21 06:34:54 +02:00
|
|
|
renderBlocks.renderMaxX = object.maxX;
|
|
|
|
renderBlocks.renderMinX = object.minX;
|
|
|
|
renderBlocks.renderMaxY = object.maxY;
|
|
|
|
renderBlocks.renderMinY = object.minY;
|
|
|
|
renderBlocks.renderMaxZ = object.maxZ;
|
|
|
|
renderBlocks.renderMinZ = object.minZ;
|
2013-06-26 23:49:47 +02:00
|
|
|
|
2013-04-21 06:34:54 +02:00
|
|
|
renderBlocks.enableAO = false;
|
|
|
|
|
2013-06-26 23:49:47 +02:00
|
|
|
Tessellator.instance.startDrawingQuads();
|
2013-04-21 06:34:54 +02:00
|
|
|
|
2013-06-02 23:44:59 +02:00
|
|
|
if(object.shouldSideRender(ForgeDirection.DOWN))
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
2013-06-02 23:44:59 +02:00
|
|
|
renderBlocks.renderFaceYNeg(null, 0, 0, 0, object.getBlockTextureFromSide(0));
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
|
|
|
|
2013-06-02 23:44:59 +02:00
|
|
|
if(object.shouldSideRender(ForgeDirection.UP))
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
2013-06-02 23:44:59 +02:00
|
|
|
renderBlocks.renderFaceYPos(null, 0, 0, 0, object.getBlockTextureFromSide(1));
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
|
|
|
|
2013-06-02 23:44:59 +02:00
|
|
|
if(object.shouldSideRender(ForgeDirection.NORTH))
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
2013-06-02 23:44:59 +02:00
|
|
|
renderBlocks.renderFaceZNeg(null, 0, 0, 0, object.getBlockTextureFromSide(2));
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
|
|
|
|
2013-06-02 23:44:59 +02:00
|
|
|
if(object.shouldSideRender(ForgeDirection.SOUTH))
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
2013-06-02 23:44:59 +02:00
|
|
|
renderBlocks.renderFaceZPos(null, 0, 0, 0, object.getBlockTextureFromSide(3));
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
|
|
|
|
2013-06-02 23:44:59 +02:00
|
|
|
if(object.shouldSideRender(ForgeDirection.WEST))
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
2013-06-02 23:44:59 +02:00
|
|
|
renderBlocks.renderFaceXNeg(null, 0, 0, 0, object.getBlockTextureFromSide(4));
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
|
|
|
|
2013-06-02 23:44:59 +02:00
|
|
|
if(object.shouldSideRender(ForgeDirection.EAST))
|
2013-04-21 06:34:54 +02:00
|
|
|
{
|
2013-06-02 23:44:59 +02:00
|
|
|
renderBlocks.renderFaceXPos(null, 0, 0, 0, object.getBlockTextureFromSide(5));
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
2013-06-02 23:44:59 +02:00
|
|
|
|
2013-06-26 23:49:47 +02:00
|
|
|
if(Tessellator.instance.isDrawing)
|
|
|
|
{
|
|
|
|
Tessellator.instance.draw();
|
|
|
|
}
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|
2013-05-20 00:43:01 +02:00
|
|
|
|
2013-10-26 19:25:51 +02:00
|
|
|
public static Icon getColorIcon(EnumColor color)
|
|
|
|
{
|
|
|
|
return colors[color.ordinal()];
|
|
|
|
}
|
|
|
|
|
2013-05-20 00:43:01 +02:00
|
|
|
public static void glowOn()
|
2013-11-24 22:44:16 +01:00
|
|
|
{
|
|
|
|
glowOn(15);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void glowOn(int glow)
|
2013-05-20 00:43:01 +02:00
|
|
|
{
|
|
|
|
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
2013-08-25 18:35:12 +02:00
|
|
|
|
2013-11-24 22:44:16 +01:00
|
|
|
try {
|
2013-07-31 04:28:46 +02:00
|
|
|
lightmapLastX = OpenGlHelper.lastBrightnessX;
|
|
|
|
lightmapLastY = OpenGlHelper.lastBrightnessY;
|
2013-11-24 19:12:42 +01:00
|
|
|
} catch(NoSuchFieldError e) {
|
2013-07-31 04:28:46 +02:00
|
|
|
optifineBreak = true;
|
|
|
|
}
|
2013-08-25 18:35:12 +02:00
|
|
|
|
2013-05-20 00:43:01 +02:00
|
|
|
RenderHelper.disableStandardItemLighting();
|
2013-08-25 18:35:12 +02:00
|
|
|
|
2013-11-24 22:44:16 +01:00
|
|
|
float glowRatioX = Math.min(((float)glow/15F)*240F + lightmapLastX, 240);
|
|
|
|
float glowRatioY = Math.min(((float)glow/15F)*240F + lightmapLastY, 240);
|
|
|
|
|
2013-07-31 04:28:46 +02:00
|
|
|
if(!optifineBreak)
|
|
|
|
{
|
2013-11-24 22:44:16 +01:00
|
|
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, glowRatioX, glowRatioY);
|
2013-07-31 04:28:46 +02:00
|
|
|
}
|
2013-05-20 00:43:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void glowOff()
|
|
|
|
{
|
2013-07-31 04:28:46 +02:00
|
|
|
if(!optifineBreak)
|
|
|
|
{
|
|
|
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapLastX, lightmapLastY);
|
|
|
|
}
|
2013-08-25 18:35:12 +02:00
|
|
|
|
2013-05-20 00:43:01 +02:00
|
|
|
GL11.glPopAttrib();
|
|
|
|
}
|
2013-05-23 19:30:12 +02:00
|
|
|
|
2013-11-03 05:14:54 +01:00
|
|
|
public static void blendOn()
|
|
|
|
{
|
|
|
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
|
|
|
GL11.glEnable(GL11.GL_BLEND);
|
|
|
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void blendOff()
|
|
|
|
{
|
|
|
|
GL11.glShadeModel(GL11.GL_FLAT);
|
|
|
|
GL11.glDisable(GL11.GL_LINE_SMOOTH);
|
|
|
|
GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
|
|
|
|
GL11.glDisable(GL11.GL_BLEND);
|
|
|
|
}
|
|
|
|
|
2013-10-14 04:50:21 +02:00
|
|
|
/**
|
|
|
|
* Cleaned-up snip of ItemRenderer.renderItem() -- meant to render 2D items as equipped.
|
|
|
|
* @param item - ItemStack to render
|
|
|
|
*/
|
|
|
|
public static void renderItem(ItemStack item)
|
|
|
|
{
|
|
|
|
Icon icon = item.getItem().getIconIndex(item);
|
|
|
|
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
|
|
|
|
|
|
|
if(icon == null)
|
|
|
|
{
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
|
|
|
|
Tessellator tessellator = Tessellator.instance;
|
2013-10-14 20:08:15 +02:00
|
|
|
|
|
|
|
float minU = icon.getMinU();
|
|
|
|
float maxU = icon.getMaxU();
|
|
|
|
float minV = icon.getMinV();
|
|
|
|
float maxV = icon.getMaxV();
|
|
|
|
|
2013-10-14 04:50:21 +02:00
|
|
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
2013-10-14 20:08:15 +02:00
|
|
|
GL11.glTranslatef(0.0F, -0.3F, 0.0F);
|
|
|
|
|
|
|
|
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
2013-10-14 04:50:21 +02:00
|
|
|
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);
|
2013-10-14 20:08:15 +02:00
|
|
|
|
|
|
|
RenderManager.instance.itemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
2013-10-14 04:50:21 +02:00
|
|
|
|
|
|
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
|
|
|
}
|
|
|
|
|
2013-05-28 06:29:29 +02:00
|
|
|
/**
|
|
|
|
* Cleaned-up snip of RenderBlocks.renderBlockAsItem() -- used for rendering an item as an entity,
|
|
|
|
* in a player's inventory, and in a player's hand.
|
|
|
|
* @param renderer - RenderBlocks renderer to render the item with
|
|
|
|
* @param metadata - block/item metadata
|
|
|
|
* @param block - block to render
|
|
|
|
*/
|
|
|
|
public static void renderItem(RenderBlocks renderer, int metadata, Block block)
|
|
|
|
{
|
|
|
|
if(!(block instanceof ISpecialBounds) || ((ISpecialBounds)block).doDefaultBoundSetting(metadata))
|
|
|
|
{
|
|
|
|
block.setBlockBoundsForItemRender();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(block instanceof ISpecialBounds)
|
|
|
|
{
|
|
|
|
((ISpecialBounds)block).setRenderBounds(block, metadata);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!(block instanceof ISpecialBounds) || ((ISpecialBounds)block).doDefaultBoundSetting(metadata))
|
|
|
|
{
|
|
|
|
renderer.setRenderBoundsFromBlock(block);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(renderer.useInventoryTint)
|
|
|
|
{
|
|
|
|
int renderColor = block.getRenderColor(metadata);
|
|
|
|
float red = (float)(renderColor >> 16 & 255) / 255.0F;
|
|
|
|
float green = (float)(renderColor >> 8 & 255) / 255.0F;
|
|
|
|
float blue = (float)(renderColor & 255) / 255.0F;
|
|
|
|
GL11.glColor4f(red, green, blue, 1.0F);
|
|
|
|
}
|
|
|
|
|
|
|
|
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
2013-08-25 18:35:12 +02:00
|
|
|
|
2013-05-28 06:29:29 +02:00
|
|
|
Tessellator tessellator = Tessellator.instance;
|
|
|
|
tessellator.startDrawingQuads();
|
|
|
|
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
|
|
|
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, metadata));
|
|
|
|
tessellator.draw();
|
|
|
|
tessellator.startDrawingQuads();
|
|
|
|
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
|
|
|
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, metadata));
|
|
|
|
tessellator.draw();
|
|
|
|
tessellator.startDrawingQuads();
|
|
|
|
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
|
|
|
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, metadata));
|
|
|
|
tessellator.draw();
|
|
|
|
tessellator.startDrawingQuads();
|
|
|
|
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
|
|
|
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, metadata));
|
|
|
|
tessellator.draw();
|
|
|
|
tessellator.startDrawingQuads();
|
|
|
|
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
|
|
|
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, metadata));
|
|
|
|
tessellator.draw();
|
|
|
|
tessellator.startDrawingQuads();
|
|
|
|
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
|
|
|
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, metadata));
|
|
|
|
tessellator.draw();
|
2013-08-25 18:35:12 +02:00
|
|
|
|
2013-05-28 06:29:29 +02:00
|
|
|
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
|
|
|
}
|
2013-06-27 17:03:50 +02:00
|
|
|
|
2013-07-20 18:10:14 +02:00
|
|
|
public static void colorFluid(Fluid fluid)
|
2013-06-27 17:03:50 +02:00
|
|
|
{
|
2013-07-20 18:10:14 +02:00
|
|
|
int color = fluid.getColor();
|
2013-06-27 17:03:50 +02:00
|
|
|
|
|
|
|
float cR = (color >> 16 & 0xFF) / 255.0F;
|
|
|
|
float cG = (color >> 8 & 0xFF) / 255.0F;
|
|
|
|
float cB = (color & 0xFF) / 255.0F;
|
|
|
|
|
2013-11-24 22:44:16 +01:00
|
|
|
GL11.glColor3f(cR, cG, cB);
|
2013-06-27 17:03:50 +02:00
|
|
|
}
|
2013-05-28 06:29:29 +02:00
|
|
|
|
2013-05-23 19:30:12 +02:00
|
|
|
public static class DisplayInteger
|
|
|
|
{
|
|
|
|
public int display;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode()
|
|
|
|
{
|
|
|
|
int code = 1;
|
|
|
|
code = 31 * code + display;
|
|
|
|
return code;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object obj)
|
|
|
|
{
|
|
|
|
return obj instanceof DisplayInteger && ((DisplayInteger)obj).display == display;
|
|
|
|
}
|
2013-08-02 00:03:43 +02:00
|
|
|
|
|
|
|
public static DisplayInteger createAndStart()
|
|
|
|
{
|
|
|
|
DisplayInteger newInteger = new DisplayInteger();
|
|
|
|
newInteger.display = GLAllocation.generateDisplayLists(1);
|
|
|
|
GL11.glNewList(newInteger.display, GL11.GL_COMPILE);
|
|
|
|
return newInteger;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void endList()
|
|
|
|
{
|
|
|
|
GL11.glEndList();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void render()
|
|
|
|
{
|
|
|
|
GL11.glCallList(display);
|
|
|
|
}
|
2013-05-23 19:30:12 +02:00
|
|
|
}
|
2013-07-20 18:10:14 +02:00
|
|
|
|
|
|
|
public static TextureMap getTextureMap(int type)
|
|
|
|
{
|
|
|
|
try {
|
2013-10-14 20:59:48 +02:00
|
|
|
List l = (List)MekanismUtils.getPrivateValue(Minecraft.getMinecraft().renderEngine, TextureManager.class, ObfuscatedNames.TextureManager_listTickables);
|
2013-07-20 18:10:14 +02:00
|
|
|
|
|
|
|
for(Object obj : l)
|
|
|
|
{
|
|
|
|
if(obj instanceof TextureMap)
|
|
|
|
{
|
|
|
|
if(((TextureMap)obj).textureType == type)
|
|
|
|
{
|
|
|
|
return (TextureMap)obj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch(Exception e) {}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-08-02 00:14:26 +02:00
|
|
|
public static class BooleanArray
|
|
|
|
{
|
|
|
|
private final boolean[] boolArray;
|
|
|
|
|
|
|
|
public BooleanArray(boolean[] array)
|
|
|
|
{
|
|
|
|
boolArray = array.clone();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object o)
|
|
|
|
{
|
|
|
|
if(o instanceof BooleanArray)
|
|
|
|
{
|
|
|
|
return Arrays.equals(boolArray, ((BooleanArray)o).boolArray);
|
|
|
|
}
|
|
|
|
else if(o instanceof boolean[])
|
|
|
|
{
|
|
|
|
return Arrays.equals(boolArray, (boolean[])o);
|
|
|
|
}
|
2013-10-09 00:06:25 +02:00
|
|
|
else {
|
2013-08-02 00:14:26 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode()
|
|
|
|
{
|
|
|
|
return Arrays.hashCode(boolArray);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-13 04:43:06 +01:00
|
|
|
public static float getPartialTick()
|
2013-07-20 18:10:14 +02:00
|
|
|
{
|
|
|
|
try {
|
2013-10-14 20:59:48 +02:00
|
|
|
Timer t = (Timer)MekanismUtils.getPrivateValue(Minecraft.getMinecraft(), Minecraft.class, ObfuscatedNames.Minecraft_timer);
|
2013-07-20 18:10:14 +02:00
|
|
|
return t.renderPartialTicks;
|
|
|
|
} catch(Exception e) {}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-11-24 19:12:42 +01:00
|
|
|
public static ResourceLocation getBlocksTexture()
|
2013-07-20 18:10:14 +02:00
|
|
|
{
|
2013-09-28 03:59:47 +02:00
|
|
|
return TextureMap.locationBlocksTexture;
|
2013-07-20 18:10:14 +02:00
|
|
|
}
|
2013-11-24 19:12:42 +01:00
|
|
|
|
|
|
|
public static ResourceLocation getItemsTexture()
|
|
|
|
{
|
|
|
|
return TextureMap.locationItemsTexture;
|
|
|
|
}
|
2013-04-21 06:34:54 +02:00
|
|
|
}
|