Relocate Source to proper directory.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package appeng.client.render.items;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
|
||||
public class ItemEncodedPatternRenderer implements IItemRenderer
|
||||
{
|
||||
|
||||
RenderItem ri = new RenderItem();
|
||||
boolean recursive;
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
boolean isShiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT );
|
||||
|
||||
if ( recursive == false && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
|
||||
{
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
|
||||
if ( iep.getOutput( item ) != null )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
recursive = true;
|
||||
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
|
||||
|
||||
ItemStack is = iep.getOutput( item );
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
ri.renderItemAndEffectIntoGUI( mc.fontRenderer, mc.getTextureManager(), is, 0, 0 );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glPopAttrib();
|
||||
|
||||
recursive = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package appeng.client.render.items;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
|
||||
public class PaintBallRender implements IItemRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
if ( item.getItemDamage() >= 20 )
|
||||
par2Icon = ExtraItemTextures.ItemPaintBallShimmer.getIcon();
|
||||
|
||||
float f4 = ((IIcon) par2Icon).getMinU();
|
||||
float f5 = ((IIcon) par2Icon).getMaxU();
|
||||
float f6 = ((IIcon) par2Icon).getMinV();
|
||||
float f7 = ((IIcon) par2Icon).getMaxV();
|
||||
float f12 = 0.0625F;
|
||||
|
||||
ItemPaintBall ipb = (ItemPaintBall) item.getItem();
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
AEColor col = ipb.getColor( item );
|
||||
|
||||
int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
int r = (colorValue >> 16) & 0xff;
|
||||
int g = (colorValue >> 8) & 0xff;
|
||||
int b = (colorValue >> 0) & 0xff;
|
||||
|
||||
int full = (int) (255 * 0.3);
|
||||
float fail = 0.7f;
|
||||
|
||||
if ( item.getItemDamage() >= 20 )
|
||||
GL11.glColor4ub( (byte) (full + r * fail), (byte) (full + g * fail), (byte) (full + b * fail), (byte) 255 );
|
||||
else
|
||||
GL11.glColor4ub( (byte) r, (byte) g, (byte) b, (byte) 255 );
|
||||
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
GL11.glScalef( 16F, 16F, 10F );
|
||||
GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
tessellator.addVertexWithUV( 0, 0, 0, (double) f4, (double) f7 );
|
||||
tessellator.addVertexWithUV( 1, 0, 0, (double) f5, (double) f7 );
|
||||
tessellator.addVertexWithUV( 1, 1, 0, (double) f5, (double) f6 );
|
||||
tessellator.addVertexWithUV( 0, 1, 0, (double) f4, (double) f6 );
|
||||
tessellator.draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
else
|
||||
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||
ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12 );
|
||||
|
||||
GL11.glDisable( GL11.GL_CULL_FACE );
|
||||
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
GL11.glScalef( 1F, 1.1F, 1F );
|
||||
GL11.glTranslatef( 0.0F, 1.07F, f12 / -2.0f );
|
||||
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package appeng.client.render.items;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.implementations.items.IBiometricCard;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public class ToolBiometricCardRender implements IItemRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
|
||||
float f4 = ((IIcon) par2Icon).getMinU();
|
||||
float f5 = ((IIcon) par2Icon).getMaxU();
|
||||
float f6 = ((IIcon) par2Icon).getMinV();
|
||||
float f7 = ((IIcon) par2Icon).getMaxV();
|
||||
float f12 = 0.0625F;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
GL11.glScalef( 16F, 16F, 10F );
|
||||
GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
tessellator.addVertexWithUV( 0, 0, 0, (double) f4, (double) f7 );
|
||||
tessellator.addVertexWithUV( 1, 0, 0, (double) f5, (double) f7 );
|
||||
tessellator.addVertexWithUV( 1, 1, 0, (double) f5, (double) f6 );
|
||||
tessellator.addVertexWithUV( 0, 1, 0, (double) f4, (double) f6 );
|
||||
tessellator.draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||
ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12 );
|
||||
|
||||
GL11.glDisable( GL11.GL_CULL_FACE );
|
||||
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
GL11.glScalef( 1F, 1.1F, 1F );
|
||||
GL11.glTranslatef( 0.0F, 1.07F, f12 / -2.0f );
|
||||
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
float u = ExtraItemTextures.White.getIcon().getInterpolatedU( 8.1 );
|
||||
float v = ExtraItemTextures.White.getIcon().getInterpolatedV( 8.1 );
|
||||
|
||||
String username = "";
|
||||
if ( item.getItem() instanceof IBiometricCard )
|
||||
{
|
||||
GameProfile gp = (( IBiometricCard) item.getItem() ).getProfile(item);
|
||||
if ( gp != null )
|
||||
username = gp.getName();
|
||||
}
|
||||
int hash = username.length() > 0 ? username.hashCode() : 0;
|
||||
|
||||
GL11.glScalef( 1F / 16F, 1F / 16F, 1F );
|
||||
GL11.glTranslatef( 4, 6, 0 );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
float z = 0;
|
||||
|
||||
AEColor col = AEColor.values()[Math.abs( 3 + hash ) % AEColor.values().length];
|
||||
if ( hash == 0 )
|
||||
col = AEColor.Black;
|
||||
|
||||
for (int x = 0; x < 8; x++)// 8
|
||||
{
|
||||
for (int y = 0; y < 6; y++)// 6
|
||||
{
|
||||
boolean isLit = false;
|
||||
float scale = 0.3f / 255.0f;
|
||||
|
||||
if ( x == 0 || y == 0 || x == 7 || y == 5 )
|
||||
isLit = false;
|
||||
else
|
||||
isLit = (hash & (1 << x)) != 0 || (hash & (1 << y)) != 0;
|
||||
|
||||
if ( isLit )
|
||||
tessellator.setColorOpaque_I( col.mediumVariant );
|
||||
else
|
||||
tessellator.setColorOpaque_F( ((col.blackVariant >> 16) & 0xff) * scale, ((col.blackVariant >> 8) & 0xff) * scale,
|
||||
(col.blackVariant & 0xff) * scale );
|
||||
|
||||
tessellator.addVertexWithUV( x, y, z, (double) u, (double) v );
|
||||
tessellator.addVertexWithUV( x + 1, y, z, (double) u, (double) v );
|
||||
tessellator.addVertexWithUV( x + 1, y + 1, z, (double) u, (double) v );
|
||||
tessellator.addVertexWithUV( x, y + 1, z, (double) u, (double) v );
|
||||
}
|
||||
}
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package appeng.client.render.items;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
import appeng.items.tools.powered.ToolColorApplicator;
|
||||
|
||||
public class ToolColorApplicatorRender implements IItemRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
|
||||
float f4 = ((IIcon) par2Icon).getMinU();
|
||||
float f5 = ((IIcon) par2Icon).getMaxU();
|
||||
float f6 = ((IIcon) par2Icon).getMinV();
|
||||
float f7 = ((IIcon) par2Icon).getMaxV();
|
||||
float f12 = 0.0625F;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
GL11.glScalef( 16F, 16F, 10F );
|
||||
GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
tessellator.addVertexWithUV( 0, 0, 0, (double) f4, (double) f7 );
|
||||
tessellator.addVertexWithUV( 1, 0, 0, (double) f5, (double) f7 );
|
||||
tessellator.addVertexWithUV( 1, 1, 0, (double) f5, (double) f6 );
|
||||
tessellator.addVertexWithUV( 0, 1, 0, (double) f4, (double) f6 );
|
||||
tessellator.draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
else if ( type == ItemRenderType.EQUIPPED )
|
||||
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
else
|
||||
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||
ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12 );
|
||||
|
||||
GL11.glDisable( GL11.GL_CULL_FACE );
|
||||
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
GL11.glScalef( -1F, -1F, 1F );
|
||||
GL11.glTranslatef( -1.125F, 0.0f, f12 / -2.0f );
|
||||
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
IIcon dark = ExtraItemTextures.ToolColorApplicatorTip_Dark.getIcon();
|
||||
IIcon med = ExtraItemTextures.ToolColorApplicatorTip_Medium.getIcon();
|
||||
IIcon light = ExtraItemTextures.ToolColorApplicatorTip_Light.getIcon();
|
||||
|
||||
GL11.glScalef( 1F / 16F, 1F / 16F, 1F );
|
||||
if ( type != ItemRenderType.INVENTORY )
|
||||
GL11.glTranslatef( 2, 0, 0 );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
|
||||
AEColor col = null;
|
||||
|
||||
col = ((ToolColorApplicator) item.getItem()).getActiveColor( item );
|
||||
|
||||
if ( col != null )
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
f4 = ((IIcon) dark).getMinU();
|
||||
f5 = ((IIcon) dark).getMaxU();
|
||||
f6 = ((IIcon) dark).getMinV();
|
||||
f7 = ((IIcon) dark).getMaxV();
|
||||
|
||||
tessellator.setColorOpaque_I( col.blackVariant );
|
||||
tessellator.addVertexWithUV( 0, 0, 0, (double) f4, (double) f7 );
|
||||
tessellator.addVertexWithUV( 16, 0, 0, (double) f5, (double) f7 );
|
||||
tessellator.addVertexWithUV( 16, 16, 0, (double) f5, (double) f6 );
|
||||
tessellator.addVertexWithUV( 0, 16, 0, (double) f4, (double) f6 );
|
||||
|
||||
f4 = ((IIcon) light).getMinU();
|
||||
f5 = ((IIcon) light).getMaxU();
|
||||
f6 = ((IIcon) light).getMinV();
|
||||
f7 = ((IIcon) light).getMaxV();
|
||||
|
||||
tessellator.setColorOpaque_I( col.whiteVariant );
|
||||
tessellator.addVertexWithUV( 0, 0, 0, (double) f4, (double) f7 );
|
||||
tessellator.addVertexWithUV( 16, 0, 0, (double) f5, (double) f7 );
|
||||
tessellator.addVertexWithUV( 16, 16, 0, (double) f5, (double) f6 );
|
||||
tessellator.addVertexWithUV( 0, 16, 0, (double) f4, (double) f6 );
|
||||
|
||||
f4 = ((IIcon) med).getMinU();
|
||||
f5 = ((IIcon) med).getMaxU();
|
||||
f6 = ((IIcon) med).getMinV();
|
||||
f7 = ((IIcon) med).getMaxV();
|
||||
|
||||
tessellator.setColorOpaque_I( col.mediumVariant );
|
||||
tessellator.addVertexWithUV( 0, 0, 0, (double) f4, (double) f7 );
|
||||
tessellator.addVertexWithUV( 16, 0, 0, (double) f5, (double) f7 );
|
||||
tessellator.addVertexWithUV( 16, 16, 0, (double) f5, (double) f6 );
|
||||
tessellator.addVertexWithUV( 0, 16, 0, (double) f4, (double) f6 );
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user