Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
+220 -219
View File
@@ -18,6 +18,7 @@
package appeng.client;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -86,64 +87,178 @@ import appeng.util.Platform;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.ENTITY;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
public class ClientHelper extends ServerHelper
{
private static final RenderItem ITEM_RENDERER = new RenderItem();
private static final RenderBlocks BLOCK_RENDERER = new RenderBlocks();
@Override
public CableRenderMode getRenderMode()
{
if ( Platform.isServer() )
return super.getRenderMode();
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
return this.renderModeForPlayer( player );
}
@Override
public void triggerUpdates()
{
Minecraft mc = Minecraft.getMinecraft();
if ( mc == null || mc.thePlayer == null || mc.theWorld == null )
return;
EntityPlayer player = mc.thePlayer;
if ( player == null )
return;
int x = (int) player.posX;
int y = (int) player.posY;
int z = (int) player.posZ;
int range = 16 * 16;
mc.theWorld.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
}
@SubscribeEvent
public void postPlayerRender(RenderLivingEvent.Pre p)
public void postPlayerRender( RenderLivingEvent.Pre p )
{
PlayerColor player = TickHandler.INSTANCE.getPlayerColors().get( p.entity.getEntityId() );
if ( player != null )
if( player != null )
{
AEColor col = player.myColor;
float r = 0xff & (col.mediumVariant >> 16);
float g = 0xff & (col.mediumVariant >> 8);
float b = 0xff & (col.mediumVariant);
float r = 0xff & ( col.mediumVariant >> 16 );
float g = 0xff & ( col.mediumVariant >> 8 );
float b = 0xff & ( col.mediumVariant );
GL11.glColor3f( r / 255.0f, g / 255.0f, b / 255.0f );
}
}
@Override
public void doRenderItem(ItemStack itemstack, World w)
public void init()
{
if ( itemstack != null )
MinecraftForge.EVENT_BUS.register( this );
}
@Override
public World getWorld()
{
if( Platform.isClient() )
return Minecraft.getMinecraft().theWorld;
else
return super.getWorld();
}
@Override
public void bindTileEntitySpecialRenderer( Class tile, AEBaseBlock blk )
{
BaseBlockRender bbr = blk.getRendererInstance().rendererInstance;
if( bbr.hasTESR() && tile != null )
ClientRegistry.bindTileEntitySpecialRenderer( tile, new TESRWrapper( bbr ) );
}
@Override
public List<EntityPlayer> getPlayers()
{
if( Platform.isClient() )
{
List<EntityPlayer> o = new ArrayList<EntityPlayer>();
o.add( Minecraft.getMinecraft().thePlayer );
return o;
}
else
return super.getPlayers();
}
@Override
public void spawnEffect( EffectType effect, World worldObj, double posX, double posY, double posZ, Object o )
{
if( AEConfig.instance.enableEffects )
{
switch( effect )
{
case Assembler:
this.spawnAssembler( worldObj, posX, posY, posZ, o );
return;
case Vibrant:
this.spawnVibrant( worldObj, posX, posY, posZ );
return;
case Crafting:
this.spawnCrafting( worldObj, posX, posY, posZ );
return;
case Energy:
this.spawnEnergy( worldObj, posX, posY, posZ );
return;
case Lightning:
this.spawnLightning( worldObj, posX, posY, posZ );
return;
case LightningArc:
this.spawnLightningArc( worldObj, posX, posY, posZ, (Vec3) o );
return;
default:
}
}
}
private void spawnAssembler( World worldObj, double posX, double posY, double posZ, Object o )
{
PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o;
AssemblerFX fx = new AssemblerFX( Minecraft.getMinecraft().theWorld, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnVibrant( World w, double x, double y, double z )
{
if( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) )
{
double d0 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
double d1 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
double d2 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
VibrantFX fx = new VibrantFX( w, x + d0, y + d1, z + d2, 0.0D, 0.0D, 0.0D );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
private void spawnCrafting( World w, double posX, double posY, double posZ )
{
float x = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
float y = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
float z = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
CraftingFx fx = new CraftingFx( w, posX + x, posY + y, posZ + z, Items.diamond );
fx.motionX = -x * 0.2;
fx.motionY = -y * 0.2;
fx.motionZ = -z * 0.2;
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnEnergy( World w, double posX, double posY, double posZ )
{
float x = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
float y = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
float z = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
EnergyFx fx = new EnergyFx( w, posX + x, posY + y, posZ + z, Items.diamond );
fx.motionX = -x * 0.1;
fx.motionY = -y * 0.1;
fx.motionZ = -z * 0.1;
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnLightning( World worldObj, double posX, double posY, double posZ )
{
LightningFX fx = new LightningFX( worldObj, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnLightningArc( World worldObj, double posX, double posY, double posZ, Vec3 second )
{
LightningFX fx = new LightningArcFX( worldObj, posX, posY, posZ, second.xCoord, second.yCoord, second.zCoord, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
@Override
public boolean shouldAddParticles( Random r )
{
int setting = Minecraft.getMinecraft().gameSettings.particleSetting;
if( setting == 2 )
return false;
if( setting == 0 )
return true;
return r.nextInt( 2 * ( setting + 1 ) ) == 0;
}
@Override
public MovingObjectPosition getMOP()
{
return Minecraft.getMinecraft().objectMouseOver;
}
@Override
public void doRenderItem( ItemStack itemstack, World w )
{
if( itemstack != null )
{
EntityItem entityitem = new EntityItem( w, 0.0D, 0.0D, 0.0D, itemstack );
entityitem.getEntityItem().stackSize = 1;
@@ -158,7 +273,7 @@ public class ClientHelper extends ServerHelper
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
// GL11.glDisable( GL11.GL_CULL_FACE );
if ( itemstack.isItemEnchanted() || itemstack.getItem().requiresMultipleRenderPasses() )
if( itemstack.isItemEnchanted() || itemstack.getItem().requiresMultipleRenderPasses() )
{
GL11.glTranslatef( 0.0f, -0.05f, -0.25f );
GL11.glScalef( 1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f );
@@ -167,7 +282,7 @@ public class ClientHelper extends ServerHelper
// GL11.glScalef( 1.0f , -1.0f, 1.0f );
Block block = Block.getBlockFromItem( itemstack.getItem() );
if ( (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( block.getRenderType() )) )
if( ( itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( block.getRenderType() ) ) )
{
GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
@@ -175,9 +290,9 @@ public class ClientHelper extends ServerHelper
}
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer( itemstack, ENTITY );
if ( customRenderer != null && !(itemstack.getItem() instanceof ItemBlock) )
if( customRenderer != null && !( itemstack.getItem() instanceof ItemBlock ) )
{
if ( customRenderer.shouldUseRenderHelper( ENTITY, itemstack, BLOCK_3D ) )
if( customRenderer.shouldUseRenderHelper( ENTITY, itemstack, BLOCK_3D ) )
{
GL11.glTranslatef( 0, -0.04F, 0 );
GL11.glScalef( 0.7f, 0.7f, 0.7f );
@@ -186,7 +301,7 @@ public class ClientHelper extends ServerHelper
GL11.glRotatef( -90, 0, 1, 0 );
}
}
else if ( itemstack.getItem() instanceof ItemBlock )
else if( itemstack.getItem() instanceof ItemBlock )
{
GL11.glTranslatef( 0, -0.04F, 0 );
GL11.glScalef( 1.1f, 1.1f, 1.1f );
@@ -210,7 +325,7 @@ public class ClientHelper extends ServerHelper
RenderItem.renderInFrame = false;
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
if ( !ForgeHooksClient.renderInventoryItem( BLOCK_RENDERER, Minecraft.getMinecraft().renderEngine, itemstack, true, 0, 0, 0 ) )
if( !ForgeHooksClient.renderInventoryItem( BLOCK_RENDERER, Minecraft.getMinecraft().renderEngine, itemstack, true, 0, 0, 0 ) )
{
ITEM_RENDERER.renderItemIntoGUI( fr, Minecraft.getMinecraft().renderEngine, itemstack, 0, 0, false );
}
@@ -220,12 +335,6 @@ public class ClientHelper extends ServerHelper
}
}
@Override
public void init()
{
MinecraftForge.EVENT_BUS.register( this );
}
@Override
public void postInit()
{
@@ -234,187 +343,37 @@ public class ClientHelper extends ServerHelper
RenderManager.instance.entityRenderMap.put( EntityFloatingItem.class, new RenderFloatingItem() );
}
@SubscribeEvent
public void wheelEvent(MouseEvent me)
@Override
public CableRenderMode getRenderMode()
{
if ( me.isCanceled() || me.dwheel == 0 )
return;
if( Platform.isServer() )
return super.getRenderMode();
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
ItemStack is = player.getHeldItem();
if ( is != null && is.getItem() instanceof IMouseWheelItem && player.isSneaking() )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Item", me.dwheel > 0 ? "WheelUp" : "WheelDown" ) );
me.setCanceled( true );
}
catch (IOException e)
{
AELog.error( e );
}
}
}
@SubscribeEvent
public void updateTextureSheet(TextureStitchEvent.Pre ev)
{
if ( ev.map.getTextureType() == 1 )
{
for (ExtraItemTextures et : ExtraItemTextures.values())
et.registerIcon( ev.map );
}
if ( ev.map.getTextureType() == 0 )
{
for (ExtraBlockTextures et : ExtraBlockTextures.values())
et.registerIcon( ev.map );
for (CableBusTextures cb : CableBusTextures.values())
cb.registerIcon( ev.map );
}
return this.renderModeForPlayer( player );
}
@Override
public World getWorld()
public void triggerUpdates()
{
if ( Platform.isClient() )
return Minecraft.getMinecraft().theWorld;
else
return super.getWorld();
}
Minecraft mc = Minecraft.getMinecraft();
if( mc == null || mc.thePlayer == null || mc.theWorld == null )
return;
@Override
public void bindTileEntitySpecialRenderer(Class tile, AEBaseBlock blk)
{
BaseBlockRender bbr = blk.getRendererInstance().rendererInstance;
if ( bbr.hasTESR() && tile != null )
ClientRegistry.bindTileEntitySpecialRenderer( tile, new TESRWrapper( bbr ) );
}
EntityPlayer player = mc.thePlayer;
@Override
public List<EntityPlayer> getPlayers()
{
if ( Platform.isClient() )
{
List<EntityPlayer> o = new ArrayList<EntityPlayer>();
o.add( Minecraft.getMinecraft().thePlayer );
return o;
}
else
return super.getPlayers();
}
if( player == null )
return;
@Override
public void spawnEffect(EffectType effect, World worldObj, double posX, double posY, double posZ, Object o)
{
if ( AEConfig.instance.enableEffects )
{
switch (effect)
{
case Assembler:
this.spawnAssembler( worldObj, posX, posY, posZ, o );
return;
case Vibrant:
this.spawnVibrant( worldObj, posX, posY, posZ );
return;
case Crafting:
this.spawnCrafting( worldObj, posX, posY, posZ );
return;
case Energy:
this.spawnEnergy( worldObj, posX, posY, posZ );
return;
case Lightning:
this.spawnLightning( worldObj, posX, posY, posZ );
return;
case LightningArc:
this.spawnLightningArc( worldObj, posX, posY, posZ, (Vec3) o );
return;
default:
}
}
}
int x = (int) player.posX;
int y = (int) player.posY;
int z = (int) player.posZ;
private void spawnAssembler(World worldObj, double posX, double posY, double posZ, Object o)
{
PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o;
int range = 16 * 16;
AssemblerFX fx = new AssemblerFX( Minecraft.getMinecraft().theWorld, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnVibrant(World w, double x, double y, double z)
{
if ( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) )
{
double d0 = (Platform.getRandomFloat() - 0.5F) * 0.26D;
double d1 = (Platform.getRandomFloat() - 0.5F) * 0.26D;
double d2 = (Platform.getRandomFloat() - 0.5F) * 0.26D;
VibrantFX fx = new VibrantFX( w, x + d0, y + d1, z + d2, 0.0D, 0.0D, 0.0D );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
private void spawnLightningArc(World worldObj, double posX, double posY, double posZ, Vec3 second)
{
LightningFX fx = new LightningArcFX( worldObj, posX, posY, posZ, second.xCoord, second.yCoord, second.zCoord, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnLightning(World worldObj, double posX, double posY, double posZ)
{
LightningFX fx = new LightningFX( worldObj, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnEnergy(World w, double posX, double posY, double posZ)
{
float x = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
float y = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
float z = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
EnergyFx fx = new EnergyFx( w, posX + x, posY + y, posZ + z, Items.diamond );
fx.motionX = -x * 0.1;
fx.motionY = -y * 0.1;
fx.motionZ = -z * 0.1;
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnCrafting(World w, double posX, double posY, double posZ)
{
float x = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
float y = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
float z = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
CraftingFx fx = new CraftingFx( w, posX + x, posY + y, posZ + z, Items.diamond );
fx.motionX = -x * 0.2;
fx.motionY = -y * 0.2;
fx.motionZ = -z * 0.2;
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
@Override
public boolean shouldAddParticles(Random r)
{
int setting = Minecraft.getMinecraft().gameSettings.particleSetting;
if ( setting == 2 )
return false;
if ( setting == 0 )
return true;
return r.nextInt( 2 * (setting + 1) ) == 0;
}
@Override
public MovingObjectPosition getMOP()
{
return Minecraft.getMinecraft().objectMouseOver;
mc.theWorld.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
}
@Override
@@ -423,4 +382,46 @@ public class ClientHelper extends ServerHelper
throw new MissingCoreMod();
}
@SubscribeEvent
public void wheelEvent( MouseEvent me )
{
if( me.isCanceled() || me.dwheel == 0 )
return;
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
ItemStack is = player.getHeldItem();
if( is != null && is.getItem() instanceof IMouseWheelItem && player.isSneaking() )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Item", me.dwheel > 0 ? "WheelUp" : "WheelDown" ) );
me.setCanceled( true );
}
catch( IOException e )
{
AELog.error( e );
}
}
}
@SubscribeEvent
public void updateTextureSheet( TextureStitchEvent.Pre ev )
{
if( ev.map.getTextureType() == 1 )
{
for( ExtraItemTextures et : ExtraItemTextures.values() )
et.registerIcon( ev.map );
}
if( ev.map.getTextureType() == 0 )
{
for( ExtraBlockTextures et : ExtraBlockTextures.values() )
et.registerIcon( ev.map );
for( CableBusTextures cb : CableBusTextures.values() )
cb.registerIcon( ev.map );
}
}
}
@@ -18,6 +18,7 @@
package appeng.client;
public enum EffectType
{
Energy, Lightning, Vibrant, Crafting, Assembler, LightningArc
+15 -15
View File
@@ -613,6 +613,21 @@ public abstract class AEBaseGui extends GuiContainer
this.subGui = true; // in case the gui is reopened later ( i'm looking at you NEI )
}
protected Slot getSlot( int mouseX, int mouseY )
{
final List<Slot> slots = this.getInventorySlots();
for( Slot slot : slots )
{
// isPointInRegion
if( this.func_146978_c( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY ) )
{
return slot;
}
}
return null;
}
public abstract void drawBG( int offsetX, int offsetY, int mouseX, int mouseY );
@Override
@@ -652,21 +667,6 @@ public abstract class AEBaseGui extends GuiContainer
}
}
protected Slot getSlot( int mouseX, int mouseY )
{
final List<Slot> slots = this.getInventorySlots();
for( Slot slot : slots )
{
// isPointInRegion
if( this.func_146978_c( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY ) )
{
return slot;
}
}
return null;
}
protected boolean enableSpaceClicking()
{
return true;
@@ -18,6 +18,7 @@
package appeng.client.gui;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
@@ -30,19 +31,21 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.core.AEConfig;
public abstract class AEBaseMEGui extends AEBaseGui
{
public AEBaseMEGui(Container container) {
public AEBaseMEGui( Container container )
{
super( container );
}
public List<String> handleItemTooltip(ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip)
public List<String> handleItemTooltip( ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip )
{
if ( stack != null )
if( stack != null )
{
Slot s = this.getSlot( mouseX, mouseY );
if ( s instanceof SlotME )
if( s instanceof SlotME )
{
int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
@@ -53,19 +56,19 @@ public abstract class AEBaseMEGui extends AEBaseGui
SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
}
catch (Throwable ignore)
catch( Throwable ignore )
{
}
if ( myStack != null )
if( myStack != null )
{
if ( myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged()) )
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
currentToolTip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
if ( myStack.getCountRequestable() > 0 )
if( myStack.getCountRequestable() > 0 )
currentToolTip.add( "\u00a77Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
}
else if ( stack.stackSize > BigNumber || (stack.stackSize > 1 && stack.isItemDamaged()) )
else if( stack.stackSize > BigNumber || ( stack.stackSize > 1 && stack.isItemDamaged() ) )
{
currentToolTip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
}
@@ -77,10 +80,10 @@ public abstract class AEBaseMEGui extends AEBaseGui
// Vanilla version...
// protected void drawItemStackTooltip(ItemStack stack, int x, int y)
@Override
protected void renderToolTip(ItemStack stack, int x, int y)
protected void renderToolTip( ItemStack stack, int x, int y )
{
Slot s = this.getSlot( x, y );
if ( s instanceof SlotME && stack != null )
if( s instanceof SlotME && stack != null )
{
int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
@@ -91,24 +94,24 @@ public abstract class AEBaseMEGui extends AEBaseGui
SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
}
catch (Throwable ignore)
catch( Throwable ignore )
{
}
if ( myStack != null )
if( myStack != null )
{
@SuppressWarnings( "unchecked" )
List<String> currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
if ( myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged()) )
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
currentToolTip.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
if ( myStack.getCountRequestable() > 0 )
if( myStack.getCountRequestable() > 0 )
currentToolTip.add( "Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
this.drawTooltip( x, y, 0, join( currentToolTip, "\n" ) );
}
else if ( stack.stackSize > BigNumber )
else if( stack.stackSize > BigNumber )
{
List var4 = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
@@ -119,5 +122,4 @@ public abstract class AEBaseMEGui extends AEBaseGui
super.renderToolTip( stack, x, y );
// super.drawItemStackTooltip( stack, x, y );
}
}
+7 -5
View File
@@ -18,24 +18,26 @@
package appeng.client.gui;
import net.minecraft.inventory.Container;
public class GuiNull extends AEBaseGui
{
public GuiNull(Container container) {
public GuiNull( Container container )
{
super( container );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
}
}
}
@@ -32,24 +32,30 @@ import cpw.mods.fml.client.config.IConfigElement;
import appeng.core.AEConfig;
import appeng.core.AppEng;
public class AEConfigGui extends GuiConfig
{
public AEConfigGui( GuiScreen parent )
{
super( parent, getConfigElements(), AppEng.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) );
}
private static List<IConfigElement> getConfigElements()
{
List<IConfigElement> list = new ArrayList<IConfigElement>();
for (String cat : AEConfig.instance.getCategoryNames())
for( String cat : AEConfig.instance.getCategoryNames() )
{
if ( cat.equals( "versionchecker" ) )
if( cat.equals( "versionchecker" ) )
continue;
if ( cat.equals( "settings" ) )
if( cat.equals( "settings" ) )
continue;
ConfigCategory cc = AEConfig.instance.getCategory( cat );
if ( cc.isChild() )
if( cc.isChild() )
continue;
ConfigElement ce = new ConfigElement( cc );
@@ -58,9 +64,4 @@ public class AEConfigGui extends GuiConfig
return list;
}
public AEConfigGui(GuiScreen parent) {
super( parent, getConfigElements(), AppEng.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.config;
import java.util.Set;
import net.minecraft.client.Minecraft;
@@ -25,11 +26,12 @@ import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.client.IModGuiFactory;
public class AEConfigGuiFactory implements IModGuiFactory
{
@Override
public void initialize(Minecraft minecraftInstance)
public void initialize( Minecraft minecraftInstance )
{
}
@@ -47,9 +49,8 @@ public class AEConfigGuiFactory implements IModGuiFactory
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
public RuntimeOptionGuiHandler getHandlerFor( RuntimeOptionCategoryElement element )
{
return null;
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import org.lwjgl.input.Mouse;
@@ -42,6 +43,7 @@ import appeng.core.sync.packets.PacketValueConfig;
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
public class GuiCellWorkbench extends GuiUpgradeable
{
@@ -52,100 +54,14 @@ public class GuiCellWorkbench extends GuiUpgradeable
GuiImgButton partition;
GuiToggleButton copyMode;
public GuiCellWorkbench(InventoryPlayer inventoryPlayer, TileCellWorkbench te) {
public GuiCellWorkbench( InventoryPlayer inventoryPlayer, TileCellWorkbench te )
{
super( new ContainerCellWorkbench( inventoryPlayer, te ) );
this.workbench = (ContainerCellWorkbench) this.inventorySlots;
this.ySize = 251;
this.tcw = te;
}
@Override
protected boolean drawUpgrades()
{
return this.workbench.availableUpgrades() > 0;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.handleButtonVisibility();
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if ( this.drawUpgrades() )
{
if ( this.workbench.availableUpgrades() <= 8 )
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + this.workbench.availableUpgrades() * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (this.workbench.availableUpgrades()) * 18), 177, 151, 35, 7 );
}
else if ( this.workbench.availableUpgrades() <= 16 )
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7 );
int dx = this.workbench.availableUpgrades() - 8;
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
if ( dx == 8 )
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7 );
else
this.drawTexturedModalRect( offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7 );
}
else
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7 );
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + (7 + (8) * 18), 186, 151, 35 - 8, 7 );
int dx = this.workbench.availableUpgrades() - 16;
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
if ( dx == 8 )
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7 );
else
this.drawTexturedModalRect( offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7 );
}
}
if ( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, 161, 68, 68 );
}
@Override
protected void actionPerformed(GuiButton btn)
{
try
{
if ( btn == this.copyMode )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "CopyMode" ) );
}
else if ( btn == this.partition )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Partition" ) );
}
else if ( btn == this.clear )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Clear" ) );
}
else if ( btn == this.fuzzyMode )
{
boolean backwards = Mouse.isButtonDown( 1 );
FuzzyMode fz = (FuzzyMode) this.fuzzyMode.getCurrentValue();
fz = Platform.rotateEnum( fz, backwards, Settings.FUZZY_MODE.getPossibleValues() );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() ) );
}
else
super.actionPerformed( btn );
}
catch (IOException ignored)
{
}
}
@Override
protected void addButtons()
{
@@ -160,6 +76,52 @@ public class GuiCellWorkbench extends GuiUpgradeable
this.buttonList.add( this.copyMode );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.handleButtonVisibility();
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if( this.drawUpgrades() )
{
if( this.workbench.availableUpgrades() <= 8 )
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + this.workbench.availableUpgrades() * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( this.workbench.availableUpgrades() ) * 18 ), 177, 151, 35, 7 );
}
else if( this.workbench.availableUpgrades() <= 16 )
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( 8 ) * 18 ), 177, 151, 35, 7 );
int dx = this.workbench.availableUpgrades() - 8;
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
if( dx == 8 )
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + ( 7 + ( dx ) * 18 ), 186, 151, 35 - 8, 7 );
else
this.drawTexturedModalRect( offsetX + 177 + 27 + 4, offsetY + ( 7 + ( dx ) * 18 ), 186 + 4, 151, 35 - 8, 7 );
}
else
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( 8 ) * 18 ), 177, 151, 35, 7 );
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + ( 7 + ( 8 ) * 18 ), 186, 151, 35 - 8, 7 );
int dx = this.workbench.availableUpgrades() - 16;
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
if( dx == 8 )
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY + ( 7 + ( dx ) * 18 ), 186, 151, 35 - 8, 7 );
else
this.drawTexturedModalRect( offsetX + 177 + 27 + 18 + 4, offsetY + ( 7 + ( dx ) * 18 ), 186 + 4, 151, 35 - 8, 7 );
}
}
if( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, 161, 68, 68 );
}
@Override
protected void handleButtonVisibility()
{
@@ -167,12 +129,12 @@ public class GuiCellWorkbench extends GuiUpgradeable
boolean hasFuzzy = false;
IInventory inv = this.workbench.getCellUpgradeInventory();
for (int x = 0; x < inv.getSizeInventory(); x++)
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
ItemStack is = inv.getStackInSlot( x );
if ( is != null && is.getItem() instanceof IUpgradeModule )
if( is != null && is.getItem() instanceof IUpgradeModule )
{
if ( ((IUpgradeModule) is.getItem()).getType( is ) == Upgrades.FUZZY )
if( ( (IUpgradeModule) is.getItem() ).getType( is ) == Upgrades.FUZZY )
hasFuzzy = true;
}
}
@@ -185,9 +147,49 @@ public class GuiCellWorkbench extends GuiUpgradeable
return "guis/cellworkbench.png";
}
@Override
protected boolean drawUpgrades()
{
return this.workbench.availableUpgrades() > 0;
}
@Override
protected GuiText getName()
{
return GuiText.CellWorkbench;
}
@Override
protected void actionPerformed( GuiButton btn )
{
try
{
if( btn == this.copyMode )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "CopyMode" ) );
}
else if( btn == this.partition )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Partition" ) );
}
else if( btn == this.clear )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Clear" ) );
}
else if( btn == this.fuzzyMode )
{
boolean backwards = Mouse.isButtonDown( 1 );
FuzzyMode fz = (FuzzyMode) this.fuzzyMode.getCurrentValue();
fz = Platform.rotateEnum( fz, backwards, Settings.FUZZY_MODE.getPossibleValues() );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() ) );
}
else
super.actionPerformed( btn );
}
catch( IOException ignored )
{
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
@@ -30,17 +31,24 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.tile.storage.TileChest;
public class GuiChest extends AEBaseGui
{
GuiTabButton priority;
public GuiChest( InventoryPlayer inventoryPlayer, TileChest te )
{
super( new ContainerChest( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
protected void actionPerformed(GuiButton par1GuiButton)
protected void actionPerformed( GuiButton par1GuiButton )
{
super.actionPerformed( par1GuiButton );
if ( par1GuiButton == this.priority )
if( par1GuiButton == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
@@ -54,23 +62,17 @@ public class GuiChest extends AEBaseGui
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
}
public GuiChest(InventoryPlayer inventoryPlayer, TileChest te) {
super( new ContainerChest( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Chest.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -35,6 +35,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.tile.misc.TileCondenser;
public class GuiCondenser extends AEBaseGui
{
@@ -42,7 +43,7 @@ public class GuiCondenser extends AEBaseGui
GuiProgressBar pb;
GuiImgButton mode;
public GuiCondenser(InventoryPlayer inventoryPlayer, TileCondenser te)
public GuiCondenser( InventoryPlayer inventoryPlayer, TileCondenser te )
{
super( new ContainerCondenser( inventoryPlayer, te ) );
this.cvc = (ContainerCondenser) this.inventorySlots;
@@ -50,13 +51,13 @@ public class GuiCondenser extends AEBaseGui
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( this.mode == btn )
if( this.mode == btn )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.CONDENSER_OUTPUT, backwards ) );
}
@@ -76,22 +77,20 @@ public class GuiCondenser extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/condenser.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.mode.set( this.cvc.output );
this.mode.fillVar = String.valueOf( this.cvc.output.requiredPower );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/condenser.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -43,6 +44,7 @@ import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
public class GuiCraftAmount extends AEBaseGui
{
private GuiNumberBox amountToCraft;
@@ -62,7 +64,8 @@ public class GuiCraftAmount extends AEBaseGui
private GuiBridge originalGui;
@Reflected
public GuiCraftAmount(InventoryPlayer inventoryPlayer, ITerminalHost te) {
public GuiCraftAmount( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super( new ContainerCraftAmount( inventoryPlayer, te ) );
}
@@ -89,13 +92,13 @@ public class GuiCraftAmount extends AEBaseGui
this.buttonList.add( this.next = new GuiButton( 0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal() ) );
ItemStack myIcon = null;
Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
if ( target instanceof WirelessTerminalGuiObject )
if( target instanceof WirelessTerminalGuiObject )
{
for ( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
for( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
{
myIcon = wirelessTerminalStack;
}
@@ -103,34 +106,34 @@ public class GuiCraftAmount extends AEBaseGui
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if ( target instanceof PartTerminal )
if( target instanceof PartTerminal )
{
for ( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_ME;
}
if ( target instanceof PartCraftingTerminal )
if( target instanceof PartCraftingTerminal )
{
for ( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if ( target instanceof PartPatternTerminal )
if( target instanceof PartPatternTerminal )
{
for ( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
if ( this.originalGui != null && myIcon != null )
if( this.originalGui != null && myIcon != null )
{
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
}
@@ -145,111 +148,67 @@ public class GuiCraftAmount extends AEBaseGui
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
try
{
if ( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
if ( btn == this.next )
{
NetworkHandler.instance.sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), isShiftKeyDown() ) );
}
}
catch (NumberFormatException e)
{
// nope..
this.amountToCraft.setText( "1" );
}
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if ( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty(int i)
{
try
{
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
{
out = out.substring( 1 );
fixed = true;
}
if ( fixed )
this.amountToCraft.setText( out );
if ( out.length() == 0 )
out = "0";
long result = Integer.parseInt( out );
if ( result == 1 && i > 1 )
result = 0;
result += i;
if ( result < 1 )
result = 1;
out = Long.toString( result );
Integer.parseInt( out );
this.amountToCraft.setText( out );
}
catch (NumberFormatException e)
{
// :P
}
this.fontRendererObj.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 );
}
@Override
protected void keyTyped(char character, int key)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
if ( !this.checkHotbarKeys( key ) )
this.next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
this.bindTexture( "guis/craftAmt.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
try
{
if ( key == 28 )
Long.parseLong( this.amountToCraft.getText() );
this.next.enabled = this.amountToCraft.getText().length() > 0;
}
catch( NumberFormatException e )
{
this.next.enabled = false;
}
this.amountToCraft.drawTextBox();
}
@Override
protected void keyTyped( char character, int key )
{
if( !this.checkHotbarKeys( key ) )
{
if( key == 28 )
{
this.actionPerformed( this.next );
}
if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ))
&& this.amountToCraft.textboxKeyTyped( character, key ) )
if( ( key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ) ) && this.amountToCraft.textboxKeyTyped( character, key ) )
{
try
{
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
while( out.startsWith( "0" ) && out.length() > 1 )
{
out = out.substring( 1 );
fixed = true;
}
if ( fixed )
if( fixed )
this.amountToCraft.setText( out );
if ( out.length() == 0 )
if( out.length() == 0 )
out = "0";
long result = Long.parseLong( out );
if ( result < 0 )
if( result < 0 )
{
this.amountToCraft.setText( "1" );
}
}
catch (NumberFormatException e)
catch( NumberFormatException e )
{
// :P
}
@@ -262,34 +221,76 @@ public class GuiCraftAmount extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
protected void actionPerformed( GuiButton btn )
{
this.next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
this.bindTexture( "guis/craftAmt.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
super.actionPerformed( btn );
try
{
Long.parseLong( this.amountToCraft.getText() );
this.next.enabled = this.amountToCraft.getText().length() > 0;
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
if( btn == this.next )
{
NetworkHandler.instance.sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), isShiftKeyDown() ) );
}
}
catch (NumberFormatException e)
catch( NumberFormatException e )
{
this.next.enabled = false;
// nope..
this.amountToCraft.setText( "1" );
}
this.amountToCraft.drawTextBox();
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty( int i )
{
try
{
String out = this.amountToCraft.getText();
boolean fixed = false;
while( out.startsWith( "0" ) && out.length() > 1 )
{
out = out.substring( 1 );
fixed = true;
}
if( fixed )
this.amountToCraft.setText( out );
if( out.length() == 0 )
out = "0";
long result = Integer.parseInt( out );
if( result == 1 && i > 1 )
result = 0;
result += i;
if( result < 1 )
result = 1;
out = Long.toString( result );
Integer.parseInt( out );
this.amountToCraft.setText( out );
}
catch( NumberFormatException e )
{
// :P
}
}
protected String getBackground()
{
return "guis/craftAmt.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 );
}
}
@@ -26,8 +26,6 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import com.google.common.base.Joiner;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -35,6 +33,8 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import com.google.common.base.Joiner;
import appeng.api.AEApi;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
@@ -54,6 +54,7 @@ import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import appeng.util.Platform;
public class GuiCraftConfirm extends AEBaseGui
{
@@ -68,18 +69,13 @@ public class GuiCraftConfirm extends AEBaseGui
final List<IAEItemStack> visual = new ArrayList<IAEItemStack>();
GuiBridge OriginalGui;
GuiButton cancel;
GuiButton start;
GuiButton selectCPU;
int tooltip = -1;
boolean isAutoStart()
public GuiCraftConfirm( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
return ((ContainerCraftConfirm) this.inventorySlots).autoStart;
}
boolean isSimulation()
{
return ((ContainerCraftConfirm) this.inventorySlots).simulation;
}
public GuiCraftConfirm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super( new ContainerCraftConfirm( inventoryPlayer, te ) );
this.xSize = 238;
this.ySize = 206;
@@ -87,23 +83,23 @@ public class GuiCraftConfirm extends AEBaseGui
this.ccc = (ContainerCraftConfirm) this.inventorySlots;
if ( te instanceof WirelessTerminalGuiObject )
if( te instanceof WirelessTerminalGuiObject )
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
if ( te instanceof PartTerminal )
if( te instanceof PartTerminal )
this.OriginalGui = GuiBridge.GUI_ME;
if ( te instanceof PartCraftingTerminal )
if( te instanceof PartCraftingTerminal )
this.OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
if ( te instanceof PartPatternTerminal )
if( te instanceof PartPatternTerminal )
this.OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
GuiButton cancel;
GuiButton start;
GuiButton selectCPU;
boolean isAutoStart()
{
return ( (ContainerCraftConfirm) this.inventorySlots ).autoStart;
}
@Override
public void initGui()
@@ -114,248 +110,50 @@ public class GuiCraftConfirm extends AEBaseGui
this.start.enabled = false;
this.buttonList.add( this.start );
this.selectCPU = new GuiButton( 0, this.guiLeft + (219 - 180) / 2, this.guiTop + this.ySize - 68, 180, 20, GuiText.CraftingCPU.getLocal() + ": "
+ GuiText.Automatic );
this.selectCPU = new GuiButton( 0, this.guiLeft + ( 219 - 180 ) / 2, this.guiTop + this.ySize - 68, 180, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic );
this.selectCPU.enabled = false;
this.buttonList.add( this.selectCPU );
if ( this.OriginalGui != null )
if( this.OriginalGui != null )
this.cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
this.buttonList.add( this.cancel );
}
private void updateCPUButtonText()
{
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
if ( this.ccc.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if ( this.ccc.myName.length() > 0 )
{
String name = this.ccc.myName.substring( 0, Math.min( 20, this.ccc.myName.length() ) );
btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name;
}
else
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.selectedCpu;
}
if ( this.ccc.noCPU )
btnTextText = GuiText.NoCraftingCPUs.getLocal();
this.selectCPU.displayString = btnTextText;
}
@Override
protected void actionPerformed(GuiButton btn)
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.selectCPU )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch (IOException e)
{
AELog.error( e );
}
}
if ( btn == this.cancel )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
}
if ( btn == this.start )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Start", "Start" ) );
}
catch (Throwable e)
{
AELog.error( e );
}
}
}
private long getTotal(IAEItemStack is)
{
IAEItemStack a = this.storage.findPrecise( is );
IAEItemStack c = this.pending.findPrecise( is );
IAEItemStack m = this.missing.findPrecise( is );
long total = 0;
if ( a != null )
total += a.getStackSize();
if ( c != null )
total += c.getStackSize();
if ( m != null )
total += m.getStackSize();
return total;
}
public void postUpdate(List<IAEItemStack> list, byte ref)
{
switch (ref)
{
case 0:
for (IAEItemStack l : list)
this.handleInput( this.storage, l );
break;
case 1:
for (IAEItemStack l : list)
this.handleInput( this.pending, l );
break;
case 2:
for (IAEItemStack l : list)
this.handleInput( this.missing, l );
break;
}
for (IAEItemStack l : list)
{
long amt = this.getTotal( l );
if ( amt <= 0 )
this.deleteVisualStack( l );
else
{
IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.setScrollBar();
}
private void handleInput(IItemList<IAEItemStack> s, IAEItemStack l)
{
IAEItemStack a = s.findPrecise( l );
if ( l.getStackSize() <= 0 )
{
if ( a != null )
a.reset();
}
else
{
if ( a == null )
{
s.add( l.copy() );
a = s.findPrecise( l );
}
if ( a != null )
a.setStackSize( l.getStackSize() );
}
}
private IAEItemStack findVisualStack(IAEItemStack l)
{
for (IAEItemStack o : this.visual)
{
if ( o.equals( l ) )
{
return o;
}
}
IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
private void deleteVisualStack(IAEItemStack l)
{
Iterator<IAEItemStack> i = this.visual.iterator();
while (i.hasNext())
{
IAEItemStack o = i.next();
if ( o.equals( l ) )
{
i.remove();
return;
}
}
}
private void setScrollBar()
{
int size = this.visual.size();
this.myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 114 );
this.myScrollBar.setRange( 0, (size + 2) / 3 - this.rows, 1 );
}
@Override
protected void keyTyped(char character, int key)
{
if ( !this.checkHotbarKeys( key ) )
{
if ( key == 28 )
{
this.actionPerformed( this.start );
}
super.keyTyped( character, key );
}
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.setScrollBar();
this.bindTexture( "guis/craftingreport.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
int tooltip = -1;
@Override
public void drawScreen(int mouse_x, int mouse_y, float btn)
public void drawScreen( int mouse_x, int mouse_y, float btn )
{
this.updateCPUButtonText();
this.start.enabled = !(this.ccc.noCPU || this.isSimulation());
this.start.enabled = !( this.ccc.noCPU || this.isSimulation() );
this.selectCPU.enabled = !this.isSimulation();
int x = 0;
int y = 0;
int gx = (this.width - this.xSize) / 2;
int gy = (this.height - this.ySize) / 2;
int gx = ( this.width - this.xSize ) / 2;
int gy = ( this.height - this.ySize ) / 2;
int offY = 23;
this.tooltip = -1;
for (int z = 0; z <= 4 * 5; z++)
for( int z = 0; z <= 4 * 5; z++ )
{
int minX = gx + 9 + x * 67;
int minY = gy + 22 + y * offY;
if ( minX < mouse_x && minX + 67 > mouse_x )
if( minX < mouse_x && minX + 67 > mouse_x )
{
if ( minY < mouse_y && minY + offY - 2 > mouse_y )
if( minY < mouse_y && minY + offY - 2 > mouse_y )
{
this.tooltip = z;
break;
}
}
x++;
if ( x > 2 )
if( x > 2 )
{
y++;
x = 0;
@@ -365,23 +163,47 @@ public class GuiCraftConfirm extends AEBaseGui
super.drawScreen( mouse_x, mouse_y, btn );
}
private void updateCPUButtonText()
{
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
if( this.ccc.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if( this.ccc.myName.length() > 0 )
{
String name = this.ccc.myName.substring( 0, Math.min( 20, this.ccc.myName.length() ) );
btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name;
}
else
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.selectedCpu;
}
if( this.ccc.noCPU )
btnTextText = GuiText.NoCraftingCPUs.getLocal();
this.selectCPU.displayString = btnTextText;
}
boolean isSimulation()
{
return ( (ContainerCraftConfirm) this.inventorySlots ).simulation;
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
long BytesUsed = this.ccc.bytesUsed;
String byteUsed = NumberFormat.getInstance().format( BytesUsed );
String Add = BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal()) : GuiText.CalculatingWait.getLocal();
String Add = BytesUsed > 0 ? ( byteUsed + ' ' + GuiText.BytesUsed.getLocal() ) : GuiText.CalculatingWait.getLocal();
this.fontRendererObj.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 );
String dsp = null;
if ( this.isSimulation() )
if( this.isSimulation() )
dsp = GuiText.Simulation.getLocal();
else
dsp = this.ccc.cpuBytesAvail > 0 ? (GuiText.Bytes.getLocal() + ": " + this.ccc.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + this.ccc.cpuCoProcessors)
: GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
dsp = this.ccc.cpuBytesAvail > 0 ? ( GuiText.Bytes.getLocal() + ": " + this.ccc.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + this.ccc.cpuCoProcessors ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
int offset = (219 - this.fontRendererObj.getStringWidth( dsp )) / 2;
int offset = ( 219 - this.fontRendererObj.getStringWidth( dsp ) ) / 2;
this.fontRendererObj.drawString( dsp, offset, 165, 4210752 );
int sectionLength = 67;
@@ -400,10 +222,10 @@ public class GuiCraftConfirm extends AEBaseGui
int offY = 23;
for (int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++)
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
{
IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
if ( refStack != null )
if( refStack != null )
{
GL11.glPushMatrix();
GL11.glScaled( 0.5, 0.5, 0.5 );
@@ -414,118 +236,284 @@ public class GuiCraftConfirm extends AEBaseGui
int lines = 0;
if ( stored != null && stored.getStackSize() > 0 )
if( stored != null && stored.getStackSize() > 0 )
lines++;
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
lines++;
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
lines++;
int negY = ((lines - 1) * 5) / 2;
int negY = ( ( lines - 1 ) * 5 ) / 2;
int downY = 0;
boolean red = false;
if ( stored != null && stored.getStackSize() > 0 )
if( stored != null && stored.getStackSize() > 0 )
{
String str = Long.toString( stored.getStackSize() );
if ( stored.getStackSize() >= 10000 )
if( stored.getStackSize() >= 10000 )
str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
if ( stored.getStackSize() >= 10000000 )
if( stored.getStackSize() >= 10000000 )
str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
str = GuiText.FromStorage.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.FromStorage.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
downY += 5;
}
if ( missingStack != null && missingStack.getStackSize() > 0 )
if( missingStack != null && missingStack.getStackSize() > 0 )
{
String str = Long.toString( missingStack.getStackSize() );
if ( missingStack.getStackSize() >= 10000 )
if( missingStack.getStackSize() >= 10000 )
str = Long.toString( missingStack.getStackSize() / 1000 ) + 'k';
if ( missingStack.getStackSize() >= 10000000 )
if( missingStack.getStackSize() >= 10000000 )
str = Long.toString( missingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Missing.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.Missing.getLocal() + ": " + Long.toString( missingStack.getStackSize() ) );
red = true;
downY += 5;
}
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
String str = Long.toString( pendingStack.getStackSize() );
if ( pendingStack.getStackSize() >= 10000 )
if( pendingStack.getStackSize() >= 10000 )
str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
if ( pendingStack.getStackSize() >= 10000000 )
if( pendingStack.getStackSize() >= 10000000 )
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.ToCraft.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.ToCraft.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
}
GL11.glPopMatrix();
int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
int posY = y * offY + yo;
ItemStack is = refStack.copy().getItemStack();
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( is );
if ( lineList.size() > 0 )
if( lineList.size() > 0 )
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
toolPosX = x * ( 1 + sectionLength ) + xo + sectionLength - 8;
toolPosY = y * offY + yo;
}
this.drawItem( posX, posY, is );
if ( red )
if( red )
{
int startX = x * (1 + sectionLength) + xo;
int startX = x * ( 1 + sectionLength ) + xo;
int startY = posY - 4;
drawRect( startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000 );
}
x++;
if ( x > 2 )
if( x > 2 )
{
y++;
x = 0;
}
}
}
if ( this.tooltip >= 0 && dspToolTip.length() > 0 )
if( this.tooltip >= 0 && dspToolTip.length() > 0 )
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
this.drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
GL11.glPopAttrib();
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.setScrollBar();
this.bindTexture( "guis/craftingreport.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
private void setScrollBar()
{
int size = this.visual.size();
this.myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 114 );
this.myScrollBar.setRange( 0, ( size + 2 ) / 3 - this.rows, 1 );
}
public void postUpdate( List<IAEItemStack> list, byte ref )
{
switch( ref )
{
case 0:
for( IAEItemStack l : list )
this.handleInput( this.storage, l );
break;
case 1:
for( IAEItemStack l : list )
this.handleInput( this.pending, l );
break;
case 2:
for( IAEItemStack l : list )
this.handleInput( this.missing, l );
break;
}
for( IAEItemStack l : list )
{
long amt = this.getTotal( l );
if( amt <= 0 )
this.deleteVisualStack( l );
else
{
IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.setScrollBar();
}
private void handleInput( IItemList<IAEItemStack> s, IAEItemStack l )
{
IAEItemStack a = s.findPrecise( l );
if( l.getStackSize() <= 0 )
{
if( a != null )
a.reset();
}
else
{
if( a == null )
{
s.add( l.copy() );
a = s.findPrecise( l );
}
if( a != null )
a.setStackSize( l.getStackSize() );
}
}
private long getTotal( IAEItemStack is )
{
IAEItemStack a = this.storage.findPrecise( is );
IAEItemStack c = this.pending.findPrecise( is );
IAEItemStack m = this.missing.findPrecise( is );
long total = 0;
if( a != null )
total += a.getStackSize();
if( c != null )
total += c.getStackSize();
if( m != null )
total += m.getStackSize();
return total;
}
private void deleteVisualStack( IAEItemStack l )
{
Iterator<IAEItemStack> i = this.visual.iterator();
while( i.hasNext() )
{
IAEItemStack o = i.next();
if( o.equals( l ) )
{
i.remove();
return;
}
}
}
private IAEItemStack findVisualStack( IAEItemStack l )
{
for( IAEItemStack o : this.visual )
{
if( o.equals( l ) )
{
return o;
}
}
IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
@Override
protected void keyTyped( char character, int key )
{
if( !this.checkHotbarKeys( key ) )
{
if( key == 28 )
{
this.actionPerformed( this.start );
}
super.keyTyped( character, key );
}
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.selectCPU )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch( IOException e )
{
AELog.error( e );
}
}
if( btn == this.cancel )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
}
if( btn == this.start )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Start", "Start" ) );
}
catch( Throwable e )
{
AELog.error( e );
}
}
}
}
@@ -51,6 +51,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.util.Platform;
public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{
@@ -61,6 +62,21 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
List<IAEItemStack> visual = new ArrayList<IAEItemStack>();
GuiButton cancel;
int tooltip = -1;
public GuiCraftingCPU( InventoryPlayer inventoryPlayer, Object te )
{
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
}
protected GuiCraftingCPU( ContainerCraftingCPU container )
{
super( container );
this.ySize = 184;
this.xSize = 238;
this.myScrollBar = new GuiScrollbar();
}
public void clearItems()
{
@@ -70,31 +86,18 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
this.visual = new ArrayList<IAEItemStack>();
}
protected GuiCraftingCPU(ContainerCraftingCPU container) {
super( container );
this.ySize = 184;
this.xSize = 238;
this.myScrollBar = new GuiScrollbar();
}
public GuiCraftingCPU(InventoryPlayer inventoryPlayer, Object te) {
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
}
GuiButton cancel;
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
if ( this.cancel == btn )
if( this.cancel == btn )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileCrafting.Cancel", "Cancel" ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
@@ -110,162 +113,45 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
this.buttonList.add( this.cancel );
}
private long getTotal(IAEItemStack is)
{
IAEItemStack a = this.storage.findPrecise( is );
IAEItemStack b = this.active.findPrecise( is );
IAEItemStack c = this.pending.findPrecise( is );
long total = 0;
if ( a != null )
total += a.getStackSize();
if ( b != null )
total += b.getStackSize();
if ( c != null )
total += c.getStackSize();
return total;
}
public void postUpdate(List<IAEItemStack> list, byte ref)
{
switch (ref)
{
case 0:
for (IAEItemStack l : list)
this.handleInput( this.storage, l );
break;
case 1:
for (IAEItemStack l : list)
this.handleInput( this.active, l );
break;
case 2:
for (IAEItemStack l : list)
this.handleInput( this.pending, l );
break;
}
for (IAEItemStack l : list)
{
long amt = this.getTotal( l );
if ( amt <= 0 )
this.deleteVisualStack( l );
else
{
IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.setScrollBar();
}
private void handleInput(IItemList<IAEItemStack> s, IAEItemStack l)
{
IAEItemStack a = s.findPrecise( l );
if ( l.getStackSize() <= 0 )
{
if ( a != null )
a.reset();
}
else
{
if ( a == null )
{
s.add( l.copy() );
a = s.findPrecise( l );
}
if ( a != null )
a.setStackSize( l.getStackSize() );
}
}
private IAEItemStack findVisualStack(IAEItemStack l)
{
for (IAEItemStack o : this.visual)
{
if ( o.equals( l ) )
{
return o;
}
}
IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
private void deleteVisualStack(IAEItemStack l)
{
Iterator<IAEItemStack> i = this.visual.iterator();
while (i.hasNext())
{
IAEItemStack o = i.next();
if ( o.equals( l ) )
{
i.remove();
return;
}
}
}
private void setScrollBar()
{
int size = this.visual.size();
this.myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 137 );
this.myScrollBar.setRange( 0, (size + 2) / 3 - this.rows, 1 );
this.myScrollBar.setRange( 0, ( size + 2 ) / 3 - this.rows, 1 );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/craftingcpu.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
int tooltip = -1;
@Override
public void drawScreen(int mouse_x, int mouse_y, float btn)
public void drawScreen( int mouse_x, int mouse_y, float btn )
{
this.cancel.enabled = !this.visual.isEmpty();
int x = 0;
int y = 0;
int gx = (this.width - this.xSize) / 2;
int gy = (this.height - this.ySize) / 2;
int gx = ( this.width - this.xSize ) / 2;
int gy = ( this.height - this.ySize ) / 2;
int offY = 23;
this.tooltip = -1;
for (int z = 0; z <= 4 * 5; z++)
for( int z = 0; z <= 4 * 5; z++ )
{
int minX = gx + 9 + x * 67;
int minY = gy + 22 + y * offY;
if ( minX < mouse_x && minX + 67 > mouse_x )
if( minX < mouse_x && minX + 67 > mouse_x )
{
if ( minY < mouse_y && minY + offY - 2 > mouse_y )
if( minY < mouse_y && minY + offY - 2 > mouse_y )
{
this.tooltip = z;
break;
}
}
x++;
if ( x > 2 )
if( x > 2 )
{
y++;
x = 0;
@@ -276,7 +162,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() ), 8, 7, 4210752 );
@@ -296,10 +182,10 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
int offY = 23;
for (int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++)
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
{
IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
if ( refStack != null )
if( refStack != null )
{
GL11.glPushMatrix();
GL11.glScaled( 0.5, 0.5, 0.5 );
@@ -312,102 +198,98 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
boolean active = false;
boolean scheduled = false;
if ( stored != null && stored.getStackSize() > 0 )
if( stored != null && stored.getStackSize() > 0 )
{
lines++;
}
if ( activeStack != null && activeStack.getStackSize() > 0 )
if( activeStack != null && activeStack.getStackSize() > 0 )
{
lines++;
active = true;
}
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
lines++;
scheduled = true;
}
if ( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
if( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
{
int bgColor = ( active ? AEColor.Green.blackVariant : AEColor.Yellow.blackVariant ) | 0x5A000000;
int startX = (x * (1 + sectionLength) + xo) * 2;
int startY = ((y * offY + yo) - 3) * 2;
drawRect( startX, startY, startX + (sectionLength * 2), startY + (offY * 2) - 2, bgColor);
int startX = ( x * ( 1 + sectionLength ) + xo ) * 2;
int startY = ( ( y * offY + yo ) - 3 ) * 2;
drawRect( startX, startY, startX + ( sectionLength * 2 ), startY + ( offY * 2 ) - 2, bgColor );
}
int negY = ((lines - 1) * 5) / 2;
int negY = ( ( lines - 1 ) * 5 ) / 2;
int downY = 0;
if ( stored != null && stored.getStackSize() > 0 )
if( stored != null && stored.getStackSize() > 0 )
{
String str = Long.toString( stored.getStackSize() );
if ( stored.getStackSize() >= 10000 )
if( stored.getStackSize() >= 10000 )
str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
if ( stored.getStackSize() >= 10000000 )
if( stored.getStackSize() >= 10000000 )
str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
str = GuiText.Stored.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.Stored.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
downY += 5;
}
if ( activeStack != null && activeStack.getStackSize() > 0 )
if( activeStack != null && activeStack.getStackSize() > 0 )
{
String str = Long.toString( activeStack.getStackSize() );
if ( activeStack.getStackSize() >= 10000 )
if( activeStack.getStackSize() >= 10000 )
str = Long.toString( activeStack.getStackSize() / 1000 ) + 'k';
if ( activeStack.getStackSize() >= 10000000 )
if( activeStack.getStackSize() >= 10000000 )
str = Long.toString( activeStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Crafting.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.Crafting.getLocal() + ": " + Long.toString( activeStack.getStackSize() ) );
downY += 5;
}
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
String str = Long.toString( pendingStack.getStackSize() );
if ( pendingStack.getStackSize() >= 10000 )
if( pendingStack.getStackSize() >= 10000 )
str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
if ( pendingStack.getStackSize() >= 10000000 )
if( pendingStack.getStackSize() >= 10000000 )
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Scheduled.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.Scheduled.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
}
GL11.glPopMatrix();
int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
int posY = y * offY + yo;
ItemStack is = refStack.copy().getItemStack();
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( is );
if ( lineList.size() > 0 )
if( lineList.size() > 0 )
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
toolPosX = x * ( 1 + sectionLength ) + xo + sectionLength - 8;
toolPosY = y * offY + yo;
}
@@ -415,22 +297,134 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
x++;
if ( x > 2 )
if( x > 2 )
{
y++;
x = 0;
}
}
}
if ( this.tooltip >= 0 && dspToolTip.length() > 0 )
if( this.tooltip >= 0 && dspToolTip.length() > 0 )
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
this.drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
GL11.glPopAttrib();
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/craftingcpu.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
public void postUpdate( List<IAEItemStack> list, byte ref )
{
switch( ref )
{
case 0:
for( IAEItemStack l : list )
this.handleInput( this.storage, l );
break;
case 1:
for( IAEItemStack l : list )
this.handleInput( this.active, l );
break;
case 2:
for( IAEItemStack l : list )
this.handleInput( this.pending, l );
break;
}
for( IAEItemStack l : list )
{
long amt = this.getTotal( l );
if( amt <= 0 )
this.deleteVisualStack( l );
else
{
IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.setScrollBar();
}
private void handleInput( IItemList<IAEItemStack> s, IAEItemStack l )
{
IAEItemStack a = s.findPrecise( l );
if( l.getStackSize() <= 0 )
{
if( a != null )
a.reset();
}
else
{
if( a == null )
{
s.add( l.copy() );
a = s.findPrecise( l );
}
if( a != null )
a.setStackSize( l.getStackSize() );
}
}
private long getTotal( IAEItemStack is )
{
IAEItemStack a = this.storage.findPrecise( is );
IAEItemStack b = this.active.findPrecise( is );
IAEItemStack c = this.pending.findPrecise( is );
long total = 0;
if( a != null )
total += a.getStackSize();
if( b != null )
total += b.getStackSize();
if( c != null )
total += c.getStackSize();
return total;
}
private void deleteVisualStack( IAEItemStack l )
{
Iterator<IAEItemStack> i = this.visual.iterator();
while( i.hasNext() )
{
IAEItemStack o = i.next();
if( o.equals( l ) )
{
i.remove();
return;
}
}
}
private IAEItemStack findVisualStack( IAEItemStack l )
{
for( IAEItemStack o : this.visual )
{
if( o.equals( l ) )
{
return o;
}
}
IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
@Override
@@ -450,5 +444,4 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{
return ViewItems.ALL;
}
}
@@ -19,8 +19,10 @@
/**
*
*/
package appeng.client.gui.implementations;
import java.io.IOException;
import org.lwjgl.input.Mouse;
@@ -46,6 +48,7 @@ import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
public class GuiCraftingStatus extends GuiCraftingCPU
{
@@ -56,7 +59,8 @@ public class GuiCraftingStatus extends GuiCraftingCPU
GuiBridge originalGui;
ItemStack myIcon = null;
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
public GuiCraftingStatus( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super( new ContainerCraftingStatus( inventoryPlayer, te ) );
this.status = (ContainerCraftingStatus) this.inventorySlots;
@@ -64,9 +68,9 @@ public class GuiCraftingStatus extends GuiCraftingCPU
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
if ( target instanceof WirelessTerminalGuiObject )
if( target instanceof WirelessTerminalGuiObject )
{
for ( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
for( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = wirelessTerminalStack;
}
@@ -74,27 +78,27 @@ public class GuiCraftingStatus extends GuiCraftingCPU
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if ( target instanceof PartTerminal )
if( target instanceof PartTerminal )
{
for ( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
this.originalGui = GuiBridge.GUI_ME;
}
if ( target instanceof PartCraftingTerminal )
if( target instanceof PartCraftingTerminal )
{
for ( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if ( target instanceof PartPatternTerminal )
if( target instanceof PartPatternTerminal )
{
for ( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
@@ -103,36 +107,30 @@ public class GuiCraftingStatus extends GuiCraftingCPU
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.selectCPU )
if( btn == this.selectCPU )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
}
if ( btn == this.originalGuiBtn )
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
}
@Override
protected String getGuiDisplayName(String in)
{
return in; // the cup name is on the button
}
@Override
public void initGui()
{
@@ -142,20 +140,27 @@ public class GuiCraftingStatus extends GuiCraftingCPU
// selectCPU.enabled = false;
this.buttonList.add( this.selectCPU );
if ( this.myIcon != null )
if( this.myIcon != null )
{
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), itemRender ) );
this.originalGuiBtn.hideEdge = 13;
}
}
@Override
public void drawScreen( int mouseX, int mouseY, float btn )
{
this.updateCPUButtonText();
super.drawScreen( mouseX, mouseY, btn );
}
private void updateCPUButtonText()
{
String btnTextText = GuiText.NoCraftingJobs.getLocal();
if ( this.status.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
if( this.status.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if ( this.status.myName.length() > 0 )
if( this.status.myName.length() > 0 )
{
String name = this.status.myName.substring( 0, Math.min( 20, this.status.myName.length() ) );
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
@@ -164,16 +169,15 @@ public class GuiCraftingStatus extends GuiCraftingCPU
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.status.selectedCpu;
}
if ( this.status.noCPU )
if( this.status.noCPU )
btnTextText = GuiText.NoCraftingJobs.getLocal();
this.selectCPU.displayString = btnTextText;
}
@Override
public void drawScreen(int mouseX, int mouseY, float btn)
protected String getGuiDisplayName( String in )
{
this.updateCPUButtonText();
super.drawScreen( mouseX, mouseY, btn );
return in; // the cup name is on the button
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@@ -34,11 +35,42 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.helpers.InventoryAction;
public class GuiCraftingTerm extends GuiMEMonitorable
{
GuiImgButton clearBtn;
public GuiCraftingTerm( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
this.reservedSpace = 73;
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
if( this.clearBtn == btn )
{
Slot s = null;
Container c = this.inventorySlots;
for( Object j : c.inventorySlots )
{
if( j instanceof SlotCraftingMatrix )
s = (Slot) j;
}
if( s != null )
{
PacketInventoryAction p;
p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 );
NetworkHandler.instance.sendToServer( p );
}
}
}
@Override
public void initGui()
{
@@ -48,32 +80,10 @@ public class GuiCraftingTerm extends GuiMEMonitorable
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
if ( this.clearBtn == btn )
{
Slot s = null;
Container c = this.inventorySlots;
for (Object j : c.inventorySlots)
{
if ( j instanceof SlotCraftingMatrix )
s = (Slot) j;
}
if ( s != null )
{
PacketInventoryAction p;
p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 );
NetworkHandler.instance.sendToServer( p );
}
}
}
public GuiCraftingTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
this.reservedSpace = 73;
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
}
@Override
@@ -81,12 +91,4 @@ public class GuiCraftingTerm extends GuiMEMonitorable
{
return "guis/crafting.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
@@ -30,17 +31,24 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.tile.storage.TileDrive;
public class GuiDrive extends AEBaseGui
{
GuiTabButton priority;
public GuiDrive( InventoryPlayer inventoryPlayer, TileDrive te )
{
super( new ContainerDrive( inventoryPlayer, te ) );
this.ySize = 199;
}
@Override
protected void actionPerformed(GuiButton par1GuiButton)
protected void actionPerformed( GuiButton par1GuiButton )
{
super.actionPerformed( par1GuiButton );
if ( par1GuiButton == this.priority )
if( par1GuiButton == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
@@ -54,23 +62,17 @@ public class GuiDrive extends AEBaseGui
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
}
public GuiDrive(InventoryPlayer inventoryPlayer, TileDrive te) {
super( new ContainerDrive( inventoryPlayer, te ) );
this.ySize = 199;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/drive.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Drive.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/drive.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -50,19 +50,6 @@ public class GuiFormationPlane extends GuiUpgradeable
this.ySize = 251;
}
@Override
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if ( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if ( this.placeMode != null )
this.placeMode.set( ( ( ContainerFormationPlane ) this.cvb ).placeMode );
}
@Override
protected void addButtons()
{
@@ -76,21 +63,16 @@ public class GuiFormationPlane extends GuiUpgradeable
}
@Override
protected void actionPerformed( GuiButton btn )
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
else if ( btn == this.placeMode )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.placeMode.getSetting(), backwards ) );
}
if( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if( this.placeMode != null )
this.placeMode.set( ( (ContainerFormationPlane) this.cvb ).placeMode );
}
@Override
@@ -99,4 +81,20 @@ public class GuiFormationPlane extends GuiUpgradeable
return "guis/storagebus.png";
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
else if( btn == this.placeMode )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.placeMode.getSetting(), backwards ) );
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
@@ -25,26 +26,27 @@ import appeng.container.implementations.ContainerGrinder;
import appeng.core.localization.GuiText;
import appeng.tile.grindstone.TileGrinder;
public class GuiGrinder extends AEBaseGui
{
public GuiGrinder(InventoryPlayer inventoryPlayer, TileGrinder te) {
public GuiGrinder( InventoryPlayer inventoryPlayer, TileGrinder te )
{
super( new ContainerGrinder( inventoryPlayer, te ) );
this.ySize = 176;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/grinder.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.GrindStone.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/grinder.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -37,51 +38,19 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.tile.storage.TileIOPort;
public class GuiIOPort extends GuiUpgradeable
{
GuiImgButton fullMode;
GuiImgButton operationMode;
public GuiIOPort(InventoryPlayer inventoryPlayer, TileIOPort te) {
public GuiIOPort( InventoryPlayer inventoryPlayer, TileIOPort te )
{
super( new ContainerIOPort( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
final IDefinitions definitions = AEApi.instance().definitions();
for ( ItemStack cell1kStack : definitions.items().cell1k().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 66 - 8, offsetY + 17, cell1kStack );
}
for ( ItemStack driveStack : definitions.blocks().drive().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 94 + 8, offsetY + 17, driveStack );
}
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.IOPort.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if ( this.redstoneMode != null )
this.redstoneMode.set( this.cvb.rsMode );
if ( this.operationMode != null )
this.operationMode.set( ((ContainerIOPort) this.cvb).opMode );
if ( this.fullMode != null )
this.fullMode.set( ((ContainerIOPort) this.cvb).fMode );
}
@Override
protected void addButtons()
{
@@ -95,17 +64,37 @@ public class GuiIOPort extends GuiUpgradeable
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.IOPort.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
boolean backwards = Mouse.isButtonDown( 1 );
if( this.redstoneMode != null )
this.redstoneMode.set( this.cvb.rsMode );
if ( btn == this.fullMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.fullMode.getSetting(), backwards ) );
if( this.operationMode != null )
this.operationMode.set( ( (ContainerIOPort) this.cvb ).opMode );
if ( btn == this.operationMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.operationMode.getSetting(), backwards ) );
if( this.fullMode != null )
this.fullMode.set( ( (ContainerIOPort) this.cvb ).fMode );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
final IDefinitions definitions = AEApi.instance().definitions();
for( ItemStack cell1kStack : definitions.items().cell1k().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 66 - 8, offsetY + 17, cell1kStack );
}
for( ItemStack driveStack : definitions.blocks().drive().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 94 + 8, offsetY + 17, driveStack );
}
}
@Override
@@ -114,4 +103,17 @@ public class GuiIOPort extends GuiUpgradeable
return "guis/ioport.png";
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.fullMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.fullMode.getSetting(), backwards ) );
if( btn == this.operationMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.operationMode.getSetting(), backwards ) );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
@@ -28,13 +29,14 @@ import appeng.container.implementations.ContainerUpgradeable;
import appeng.core.localization.GuiText;
import appeng.tile.misc.TileInscriber;
public class GuiInscriber extends AEBaseGui
{
final ContainerInscriber cvc;
GuiProgressBar pb;
public GuiInscriber(InventoryPlayer inventoryPlayer, TileInscriber te)
public GuiInscriber( InventoryPlayer inventoryPlayer, TileInscriber te )
{
super( new ContainerInscriber( inventoryPlayer, te ) );
this.cvc = (ContainerInscriber) this.inventorySlots;
@@ -42,32 +44,22 @@ public class GuiInscriber extends AEBaseGui
this.xSize = this.hasToolbox() ? 246 : 211;
}
protected boolean hasToolbox()
{
return ( (ContainerUpgradeable) this.inventorySlots ).hasToolbox();
}
@Override
public void initGui()
{
super.initGui();
this.pb = new GuiProgressBar( this.cvc, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL );
this.pb = new GuiProgressBar( this.cvc, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL );
this.buttonList.add( this.pb );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/inscriber.png" );
this.pb.xPosition = 135 + this.guiLeft;
this.pb.yPosition = 39 + this.guiTop;
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if ( this.drawUpgrades() )
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvc.availableUpgrades() * 18 );
if ( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68 );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.pb.setFullMsg( this.cvc.getCurrentProgress() * 100 / this.cvc.getMaxProgress() + "%" );
@@ -75,14 +67,23 @@ public class GuiInscriber extends AEBaseGui
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/inscriber.png" );
this.pb.xPosition = 135 + this.guiLeft;
this.pb.yPosition = 39 + this.guiTop;
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if( this.drawUpgrades() )
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvc.availableUpgrades() * 18 );
if( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68 );
}
protected boolean drawUpgrades()
{
return true;
}
protected boolean hasToolbox()
{
return ((ContainerUpgradeable) this.inventorySlots).hasToolbox();
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -36,6 +37,7 @@ import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.helpers.IInterfaceHost;
public class GuiInterface extends GuiUpgradeable
{
@@ -43,30 +45,12 @@ public class GuiInterface extends GuiUpgradeable
GuiImgButton BlockMode;
GuiToggleButton interfaceMode;
public GuiInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
public GuiInterface( InventoryPlayer inventoryPlayer, IInterfaceHost te )
{
super( new ContainerInterface( inventoryPlayer, te ) );
this.ySize = 211;
}
@Override
protected void actionPerformed(GuiButton btn)
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
if ( btn == this.interfaceMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) );
if ( btn == this.BlockMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
}
@Override
protected void addButtons()
{
@@ -76,25 +60,18 @@ public class GuiInterface extends GuiUpgradeable
this.BlockMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO );
this.buttonList.add( this.BlockMode );
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(),
GuiText.InterfaceTerminalHint.getLocal() );
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal() );
this.buttonList.add( this.interfaceMode );
}
@Override
protected String getBackground()
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
return "guis/interface.png";
}
if( this.BlockMode != null )
this.BlockMode.set( ( (ContainerInterface) this.cvb ).bMode );
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
if ( this.BlockMode != null )
this.BlockMode.set( ((ContainerInterface) this.cvb).bMode );
if ( this.interfaceMode != null )
this.interfaceMode.setState( ((ContainerInterface) this.cvb).iTermMode == YesNo.YES );
if( this.interfaceMode != null )
this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).iTermMode == YesNo.YES );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 );
@@ -104,4 +81,29 @@ public class GuiInterface extends GuiUpgradeable
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
protected String getBackground()
{
return "guis/interface.png";
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
if( btn == this.interfaceMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) );
if( btn == this.BlockMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
}
}
@@ -28,8 +28,6 @@ import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import com.google.common.collect.HashMultimap;
import org.lwjgl.opengl.GL11;
import net.minecraft.entity.player.InventoryPlayer;
@@ -37,6 +35,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import com.google.common.collect.HashMultimap;
import appeng.api.AEApi;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -48,6 +48,7 @@ import appeng.core.localization.GuiText;
import appeng.parts.reporting.PartMonitor;
import appeng.util.Platform;
public class GuiInterfaceTerminal extends AEBaseGui
{
@@ -66,7 +67,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
private boolean refreshList = false;
private MEGuiTextField searchField;
public GuiInterfaceTerminal(InventoryPlayer inventoryPlayer, PartMonitor te)
public GuiInterfaceTerminal( InventoryPlayer inventoryPlayer, PartMonitor te )
{
super( new ContainerInterfaceTerminal( inventoryPlayer, te ) );
this.myScrollBar = new GuiScrollbar();
@@ -92,11 +93,54 @@ public class GuiInterfaceTerminal extends AEBaseGui
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
int offset = 17;
int ex = this.myScrollBar.getCurrentScroll();
Iterator<Object> o = this.inventorySlots.inventorySlots.iterator();
while( o.hasNext() )
{
if( o.next() instanceof SlotDisconnected )
o.remove();
}
for( int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++ )
{
Object lineObj = this.lines.get( ex + x );
if( lineObj instanceof ClientDCInternalInv )
{
ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for( int z = 0; z < inv.inv.getSizeInventory(); z++ )
{
this.inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) );
}
}
else if( lineObj instanceof String )
{
String name = (String) lineObj;
int rows = this.byName.get( name ).size();
if( rows > 1 )
name = name + " (" + rows + ')';
while( name.length() > 2 && this.fontRendererObj.getStringWidth( name ) > 155 )
name = name.substring( 0, name.length() - 1 );
this.fontRendererObj.drawString( name, 10, 6 + offset, 4210752 );
}
offset += 18;
}
}
@Override
protected void mouseClicked( int xCoord, int yCoord, int btn )
{
this.searchField.mouseClicked( xCoord, yCoord, btn );
if ( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
{
this.searchField.setText( "" );
this.refreshList();
@@ -106,26 +150,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
}
@Override
protected void keyTyped(char character, int key)
{
if ( !this.checkHotbarKeys( key ) )
{
if ( character == ' ' && this.searchField.getText().length() == 0 )
return;
if ( this.searchField.textboxKeyTyped( character, key ) )
{
this.refreshList();
}
else
{
super.keyTyped( character, key );
}
}
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/interfaceterminal.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
@@ -133,10 +158,10 @@ public class GuiInterfaceTerminal extends AEBaseGui
int offset = 17;
int ex = this.myScrollBar.getCurrentScroll();
for (int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++)
for( int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++ )
{
Object lineObj = this.lines.get( ex + x );
if ( lineObj instanceof ClientDCInternalInv )
if( lineObj instanceof ClientDCInternalInv )
{
ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
@@ -147,65 +172,41 @@ public class GuiInterfaceTerminal extends AEBaseGui
offset += 18;
}
if ( this.searchField != null )
if( this.searchField != null )
this.searchField.drawTextBox();
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
protected void keyTyped( char character, int key )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
int offset = 17;
int ex = this.myScrollBar.getCurrentScroll();
Iterator<Object> o = this.inventorySlots.inventorySlots.iterator();
while (o.hasNext())
if( !this.checkHotbarKeys( key ) )
{
if ( o.next() instanceof SlotDisconnected )
o.remove();
}
if( character == ' ' && this.searchField.getText().length() == 0 )
return;
for (int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++)
{
Object lineObj = this.lines.get( ex + x );
if ( lineObj instanceof ClientDCInternalInv )
if( this.searchField.textboxKeyTyped( character, key ) )
{
ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.inv.getSizeInventory(); z++)
{
this.inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) );
}
this.refreshList();
}
else if ( lineObj instanceof String )
else
{
String name = (String) lineObj;
int rows = this.byName.get( name ).size();
if ( rows > 1 )
name = name + " (" + rows + ')';
while (name.length() > 2 && this.fontRendererObj.getStringWidth( name ) > 155)
name = name.substring( 0, name.length() - 1 );
this.fontRendererObj.drawString( name, 10, 6 + offset, 4210752 );
super.keyTyped( character, key );
}
offset += 18;
}
}
public void postUpdate(NBTTagCompound in)
public void postUpdate( NBTTagCompound in )
{
if ( in.getBoolean( "clear" ) )
if( in.getBoolean( "clear" ) )
{
this.byId.clear();
this.refreshList = true;
}
for (Object oKey : in.func_150296_c())
for( Object oKey : in.func_150296_c() )
{
String key = (String) oKey;
if ( key.startsWith( "=" ) )
if( key.startsWith( "=" ) )
{
try
{
@@ -213,20 +214,20 @@ public class GuiInterfaceTerminal extends AEBaseGui
NBTTagCompound invData = in.getCompoundTag( key );
ClientDCInternalInv current = this.getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) );
for (int x = 0; x < current.inv.getSizeInventory(); x++)
for( int x = 0; x < current.inv.getSizeInventory(); x++ )
{
String which = Integer.toString( x );
if ( invData.hasKey( which ) )
if( invData.hasKey( which ) )
current.inv.setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) );
}
}
catch (NumberFormatException ignored)
catch( NumberFormatException ignored )
{
}
}
}
if ( this.refreshList )
if( this.refreshList )
{
this.refreshList = false;
// invalid caches on refresh
@@ -249,10 +250,10 @@ public class GuiInterfaceTerminal extends AEBaseGui
final Set<Object> cachedSearch = this.getCacheForSearchTerm( searchFilterLowerCase );
final boolean rebuild = cachedSearch.isEmpty();
for (ClientDCInternalInv entry : this.byId.values())
for( ClientDCInternalInv entry : this.byId.values() )
{
// ignore inventory if not doing a full rebuild or cache already marks it as miss.
if ( !rebuild && !cachedSearch.contains( entry ) )
if( !rebuild && !cachedSearch.contains( entry ) )
{
continue;
}
@@ -261,12 +262,12 @@ public class GuiInterfaceTerminal extends AEBaseGui
boolean found = searchFilterLowerCase.isEmpty();
// Search if the current inventory holds a pattern containing the search term.
if ( !found && !searchFilterLowerCase.isEmpty() )
if( !found && !searchFilterLowerCase.isEmpty() )
{
for (ItemStack itemStack : entry.inv)
for( ItemStack itemStack : entry.inv )
{
found = this.itemStackMatchesSearchTerm( itemStack, searchFilterLowerCase );
if ( found )
if( found )
{
break;
}
@@ -274,7 +275,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
}
// if found, filter skipped or machine name matching the search term, add it
if ( found || entry.getName().toLowerCase().contains( searchFilterLowerCase ) )
if( found || entry.getName().toLowerCase().contains( searchFilterLowerCase ) )
{
this.byName.put( entry.getName(), entry );
cachedSearch.add( entry );
@@ -293,7 +294,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.lines.clear();
this.lines.ensureCapacity( this.getMaxRows() );
for (String n : this.names)
for( String n : this.names )
{
this.lines.add( n );
@@ -307,16 +308,16 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.myScrollBar.setRange( 0, this.lines.size() - LINES_ON_PAGE, 2 );
}
private boolean itemStackMatchesSearchTerm(ItemStack itemStack, String searchTerm)
private boolean itemStackMatchesSearchTerm( ItemStack itemStack, String searchTerm )
{
if ( itemStack == null )
if( itemStack == null )
{
return false;
}
NBTTagCompound encodedValue = itemStack.getTagCompound();
if ( encodedValue == null )
if( encodedValue == null )
{
return false;
}
@@ -325,19 +326,18 @@ public class GuiInterfaceTerminal extends AEBaseGui
// NBTTagList inTag = encodedValue.getTagList( "in", 10 );
NBTTagList outTag = encodedValue.getTagList( "out", 10 );
for (int i = 0; i < outTag.tagCount(); i++)
for( int i = 0; i < outTag.tagCount(); i++ )
{
ItemStack parsedItemStack = ItemStack.loadItemStackFromNBT( outTag.getCompoundTagAt( i ) );
if ( parsedItemStack != null )
if( parsedItemStack != null )
{
String displayName = Platform.getItemDisplayName( AEApi.instance().storage().createItemStack( parsedItemStack ) ).toLowerCase();
if ( displayName.contains( searchTerm ) )
if( displayName.contains( searchTerm ) )
{
return true;
}
}
}
return false;
}
@@ -348,20 +348,20 @@ public class GuiInterfaceTerminal extends AEBaseGui
* If this cache should be empty, it will populate it with an earlier cache if available or at least the cache for
* the empty string.
*
* @param searchTerm
* the corresponding search
* @param searchTerm the corresponding search
*
* @return a Set matching a superset of the search term
*/
private Set<Object> getCacheForSearchTerm(String searchTerm)
private Set<Object> getCacheForSearchTerm( String searchTerm )
{
if ( !this.cachedSearches.containsKey( searchTerm ) )
if( !this.cachedSearches.containsKey( searchTerm ) )
{
this.cachedSearches.put( searchTerm, new HashSet<Object>() );
}
Set<Object> cache = this.cachedSearches.get( searchTerm );
if ( cache.isEmpty() && searchTerm.length() > 1 )
if( cache.isEmpty() && searchTerm.length() > 1 )
{
cache.addAll( this.getCacheForSearchTerm( searchTerm.substring( 0, searchTerm.length() - 1 ) ) );
return cache;
@@ -380,11 +380,11 @@ public class GuiInterfaceTerminal extends AEBaseGui
return this.names.size() + this.byId.size();
}
private ClientDCInternalInv getById(long id, long sortBy, String string)
private ClientDCInternalInv getById( long id, long sortBy, String string )
{
ClientDCInternalInv o = this.byId.get( id );
if ( o == null )
if( o == null )
{
this.byId.put( id, o = new ClientDCInternalInv( 9, id, sortBy, string ) );
this.refreshList = true;
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import org.lwjgl.input.Mouse;
@@ -42,6 +43,7 @@ import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.parts.automation.PartLevelEmitter;
public class GuiLevelEmitter extends GuiUpgradeable
{
@@ -59,7 +61,8 @@ public class GuiLevelEmitter extends GuiUpgradeable
GuiImgButton levelMode;
GuiImgButton craftingMode;
public GuiLevelEmitter(InventoryPlayer inventoryPlayer, PartLevelEmitter te) {
public GuiLevelEmitter( InventoryPlayer inventoryPlayer, PartLevelEmitter te )
{
super( new ContainerLevelEmitter( inventoryPlayer, te ) );
}
@@ -74,7 +77,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
this.level.setTextColor( 0xFFFFFF );
this.level.setVisible( true );
this.level.setFocused( true );
((ContainerLevelEmitter) this.inventorySlots).setTextField( this.level );
( (ContainerLevelEmitter) this.inventorySlots ).setTextField( this.level );
}
@Override
@@ -107,111 +110,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
}
@Override
protected void actionPerformed(GuiButton btn)
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.craftingMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.craftingMode.getSetting(), backwards ) );
if ( btn == this.levelMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.levelMode.getSetting(), backwards ) );
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if ( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty(long i)
{
try
{
String Out = this.level.getText();
boolean Fixed = false;
while (Out.startsWith( "0" ) && Out.length() > 1)
{
Out = Out.substring( 1 );
Fixed = true;
}
if ( Fixed )
this.level.setText( Out );
if ( Out.length() == 0 )
Out = "0";
long result = Long.parseLong( Out );
result += i;
if ( result < 0 )
result = 0;
this.level.setText( Out = Long.toString( result ) );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
}
catch (NumberFormatException e)
{
// nope..
this.level.setText( "0" );
}
catch (IOException e)
{
AELog.error( e );
}
}
@Override
protected void handleButtonVisibility()
{
this.craftingMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
this.fuzzyMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
}
@Override
protected void keyTyped(char character, int key)
{
if ( !this.checkHotbarKeys( key ) )
{
if ( (key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit( character )) && this.level.textboxKeyTyped( character, key ) )
{
try
{
String Out = this.level.getText();
boolean Fixed = false;
while (Out.startsWith( "0" ) && Out.length() > 1)
{
Out = Out.substring( 1 );
Fixed = true;
}
if ( Fixed )
this.level.setText( Out );
if ( Out.length() == 0 )
Out = "0";
NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
}
catch (IOException e)
{
AELog.error( e );
}
}
else
{
super.keyTyped( character, key );
}
}
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
boolean notCraftingMode = this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) == 0;
@@ -230,20 +129,27 @@ public class GuiLevelEmitter extends GuiUpgradeable
super.drawFG( offsetX, offsetY, mouseX, mouseY );
if ( this.craftingMode != null )
this.craftingMode.set( ((ContainerLevelEmitter) this.cvb).cmType );
if( this.craftingMode != null )
this.craftingMode.set( ( (ContainerLevelEmitter) this.cvb ).cmType );
if ( this.levelMode != null )
this.levelMode.set( ((ContainerLevelEmitter) this.cvb).lvType );
if( this.levelMode != null )
this.levelMode.set( ( (ContainerLevelEmitter) this.cvb ).lvType );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
this.level.drawTextBox();
}
@Override
protected void handleButtonVisibility()
{
this.craftingMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
this.fuzzyMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
}
@Override
protected String getBackground()
{
@@ -255,4 +161,101 @@ public class GuiLevelEmitter extends GuiUpgradeable
{
return GuiText.LevelEmitter;
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.craftingMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.craftingMode.getSetting(), backwards ) );
if( btn == this.levelMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.levelMode.getSetting(), backwards ) );
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty( long i )
{
try
{
String Out = this.level.getText();
boolean Fixed = false;
while( Out.startsWith( "0" ) && Out.length() > 1 )
{
Out = Out.substring( 1 );
Fixed = true;
}
if( Fixed )
this.level.setText( Out );
if( Out.length() == 0 )
Out = "0";
long result = Long.parseLong( Out );
result += i;
if( result < 0 )
result = 0;
this.level.setText( Out = Long.toString( result ) );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
}
catch( NumberFormatException e )
{
// nope..
this.level.setText( "0" );
}
catch( IOException e )
{
AELog.error( e );
}
}
@Override
protected void keyTyped( char character, int key )
{
if( !this.checkHotbarKeys( key ) )
{
if( ( key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit( character ) ) && this.level.textboxKeyTyped( character, key ) )
{
try
{
String Out = this.level.getText();
boolean Fixed = false;
while( Out.startsWith( "0" ) && Out.length() > 1 )
{
Out = Out.substring( 1 );
Fixed = true;
}
if( Fixed )
this.level.setText( Out );
if( Out.length() == 0 )
Out = "0";
NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
}
catch( IOException e )
{
AELog.error( e );
}
}
else
{
super.keyTyped( character, key );
}
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.RedstoneMode;
@@ -29,12 +30,20 @@ import appeng.container.implementations.ContainerMAC;
import appeng.core.localization.GuiText;
import appeng.tile.crafting.TileMolecularAssembler;
public class GuiMAC extends GuiUpgradeable
{
final ContainerMAC container;
GuiProgressBar pb;
public GuiMAC( InventoryPlayer inventoryPlayer, TileMolecularAssembler te )
{
super( new ContainerMAC( inventoryPlayer, te ) );
this.ySize = 197;
this.container = (ContainerMAC) this.inventorySlots;
}
@Override
public void initGui()
{
@@ -45,25 +54,25 @@ public class GuiMAC extends GuiUpgradeable
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
protected void addButtons()
{
this.pb.xPosition = 148 + this.guiLeft;
this.pb.yPosition = 48 + this.guiTop;
super.drawBG( offsetX, offsetY, mouseX, mouseY );
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.buttonList.add( this.redstoneMode );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.pb.setFullMsg( this.container.getCurrentProgress() + "%" );
super.drawFG( offsetX, offsetY, mouseX, mouseY );
}
@Override
protected void addButtons()
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.buttonList.add( this.redstoneMode );
this.pb.xPosition = 148 + this.guiLeft;
this.pb.yPosition = 48 + this.guiTop;
super.drawBG( offsetX, offsetY, mouseX, mouseY );
}
@Override
@@ -72,13 +81,6 @@ public class GuiMAC extends GuiUpgradeable
return "guis/mac.png";
}
public GuiMAC(InventoryPlayer inventoryPlayer, TileMolecularAssembler te)
{
super( new ContainerMAC( inventoryPlayer, te ) );
this.ySize = 197;
this.container = (ContainerMAC) this.inventorySlots;
}
@Override
protected GuiText getName()
{
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.List;
@@ -65,50 +66,42 @@ import appeng.tile.misc.TileSecurity;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfigManagerHost
{
GuiTabButton craftingStatusBtn;
MEGuiTextField searchField;
private static String memoryText = "";
public static int CraftingGridOffsetX;
public static int CraftingGridOffsetY;
private static String memoryText = "";
final ItemRepo repo;
GuiText myName;
final int offsetX = 9;
final int lowerTextureOffset = 0;
final IConfigManager configSrc;
final boolean viewCell;
final ItemStack[] myCurrentViewCells = new ItemStack[5];
final ContainerMEMonitorable monitorableContainer;
GuiTabButton craftingStatusBtn;
MEGuiTextField searchField;
GuiText myName;
int perRow = 9;
int reservedSpace = 0;
final int lowerTextureOffset = 0;
boolean customSortOrder = true;
int rows = 0;
int maxRows = Integer.MAX_VALUE;
int standardSize;
final IConfigManager configSrc;
GuiImgButton ViewBox;
GuiImgButton SortByBox;
GuiImgButton SortDirBox;
GuiImgButton searchBoxSettings;
GuiImgButton terminalStyleBox;
final boolean viewCell;
final ItemStack[] myCurrentViewCells = new ItemStack[5];
final ContainerMEMonitorable monitorableContainer;
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te) {
public GuiMEMonitorable( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
this( inventoryPlayer, te, new ContainerMEMonitorable( inventoryPlayer, te ) );
}
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te, ContainerMEMonitorable c) {
public GuiMEMonitorable( InventoryPlayer inventoryPlayer, ITerminalHost te, ContainerMEMonitorable c )
{
super( c );
this.myScrollBar = new GuiScrollbar();
@@ -117,31 +110,31 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.xSize = 185;
this.ySize = 204;
if ( te instanceof IViewCellStorage )
if( te instanceof IViewCellStorage )
this.xSize += 33;
this.standardSize = this.xSize;
this.configSrc = ((IConfigurableObject) this.inventorySlots).getConfigManager();
(this.monitorableContainer = (ContainerMEMonitorable) this.inventorySlots).gui = this;
this.configSrc = ( (IConfigurableObject) this.inventorySlots ).getConfigManager();
( this.monitorableContainer = (ContainerMEMonitorable) this.inventorySlots ).gui = this;
this.viewCell = te instanceof IViewCellStorage;
if ( te instanceof TileSecurity )
if( te instanceof TileSecurity )
this.myName = GuiText.Security;
else if ( te instanceof WirelessTerminalGuiObject )
else if( te instanceof WirelessTerminalGuiObject )
this.myName = GuiText.WirelessTerminal;
else if ( te instanceof IPortableCell )
else if( te instanceof IPortableCell )
this.myName = GuiText.PortableCell;
else if ( te instanceof IMEChest )
else if( te instanceof IMEChest )
this.myName = GuiText.Chest;
else if ( te instanceof PartTerminal )
else if( te instanceof PartTerminal )
this.myName = GuiText.Terminal;
}
public void postUpdate(List<IAEItemStack> list)
public void postUpdate( List<IAEItemStack> list )
{
for (IAEItemStack is : list)
for( IAEItemStack is : list )
this.repo.postUpdate( is );
this.repo.updateView();
@@ -151,7 +144,49 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
private void setScrollBar()
{
this.myScrollBar.setTop( 18 ).setLeft( 175 ).setHeight( this.rows * 18 - 2 );
this.myScrollBar.setRange( 0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows, Math.max( 1, this.rows / 6 ) );
this.myScrollBar.setRange( 0, ( this.repo.size() + this.perRow - 1 ) / this.perRow - this.rows, Math.max( 1, this.rows / 6 ) );
}
@Override
protected void actionPerformed( GuiButton btn )
{
if( btn == this.craftingStatusBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
}
if( btn instanceof GuiImgButton )
{
boolean backwards = Mouse.isButtonDown( 1 );
GuiImgButton iBtn = (GuiImgButton) btn;
if( iBtn.getSetting() != Settings.ACTIONS )
{
Enum cv = iBtn.getCurrentValue();
Enum next = Platform.rotateEnum( cv, backwards, iBtn.getSetting().getPossibleValues() );
if( btn == this.terminalStyleBox )
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
else if( btn == this.searchBoxSettings )
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
else
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( iBtn.getSetting().name(), next.name() ) );
}
catch( IOException e )
{
AELog.error( e );
}
}
iBtn.set( next );
if( next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class )
this.re_init();
}
}
}
public void re_init()
@@ -160,18 +195,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.initGui();
}
@Override
public void onGuiClosed()
{
super.onGuiClosed();
memoryText = this.searchField.getText();
}
@Override
public void initGui()
{
this.maxRows = this.getMaxRows();
this.perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((this.width - this.standardSize) / 18);
this.perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
boolean hasNEI = AppEng.instance.isIntegrationEnabled( IntegrationType.NEI );
@@ -182,29 +210,29 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
int extraSpace = this.height - magicNumber - NEI - top - this.reservedSpace;
this.rows = (int) Math.floor( extraSpace / 18 );
if ( this.rows > this.maxRows )
if( this.rows > this.maxRows )
{
top += (this.rows - this.maxRows) * 18 / 2;
top += ( this.rows - this.maxRows ) * 18 / 2;
this.rows = this.maxRows;
}
if ( hasNEI )
if( hasNEI )
this.rows--;
if ( this.rows < 3 )
if( this.rows < 3 )
this.rows = 3;
this.meSlots.clear();
for (int y = 0; y < this.rows; y++)
for( int y = 0; y < this.rows; y++ )
{
for (int x = 0; x < this.perRow; x++)
for( int x = 0; x < this.perRow; x++ )
{
this.meSlots.add( new InternalSlotME( this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18 ) );
}
}
if ( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL )
this.xSize = this.standardSize + ((this.perRow - 9) * 18);
if( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL )
this.xSize = this.standardSize + ( ( this.perRow - 9 ) * 18 );
else
this.xSize = this.standardSize;
@@ -216,17 +244,17 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
// this.guiTop = top;
int unusedSpace = this.height - this.ySize;
this.guiTop = (int) Math.floor( unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f) );
this.guiTop = (int) Math.floor( unusedSpace / ( unusedSpace < 0 ? 3.8f : 2.0f ) );
int offset = this.guiTop + 8;
if ( this.customSortOrder )
if( this.customSortOrder )
{
this.buttonList.add( this.SortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting( Settings.SORT_BY ) ) );
offset += 20;
}
if ( this.viewCell || this instanceof GuiWirelessTerm )
if( this.viewCell || this instanceof GuiWirelessTerm )
{
this.buttonList.add( this.ViewBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.VIEW_MODE, this.configSrc.getSetting( Settings.VIEW_MODE ) ) );
offset += 20;
@@ -235,14 +263,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.buttonList.add( this.SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc.getSetting( Settings.SORT_DIRECTION ) ) );
offset += 20;
this.buttonList.add( this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings
.getSetting( Settings.SEARCH_MODE ) ) );
this.buttonList.add( this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE ) ) );
offset += 20;
if ( !(this instanceof GuiMEPortableCell) || this instanceof GuiWirelessTerm )
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm )
{
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings
.getSetting( Settings.TERMINAL_STYLE ) ) );
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings.getSetting( Settings.TERMINAL_STYLE ) ) );
}
this.searchField = new MEGuiTextField( this.fontRendererObj, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 );
@@ -251,10 +277,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.searchField.setTextColor( 0xFFFFFF );
this.searchField.setVisible( true );
if ( this.viewCell || this instanceof GuiWirelessTerm )
if( this.viewCell || this instanceof GuiWirelessTerm )
{
this.buttonList.add( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(),
itemRender ) );
this.buttonList.add( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(), itemRender ) );
this.craftingStatusBtn.hideEdge = 13;
}
@@ -262,7 +287,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting );
if ( this.isSubGui() )
if( this.isSubGui() )
{
this.searchField.setText( memoryText );
this.repo.searchString = memoryText;
@@ -273,18 +298,18 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
CraftingGridOffsetX = Integer.MAX_VALUE;
CraftingGridOffsetY = Integer.MAX_VALUE;
for (Object s : this.inventorySlots.inventorySlots)
for( Object s : this.inventorySlots.inventorySlots )
{
if ( s instanceof AppEngSlot )
if( s instanceof AppEngSlot )
{
if ( ((AppEngSlot) s).xDisplayPosition < 197 )
if( ( (AppEngSlot) s ).xDisplayPosition < 197 )
this.repositionSlot( (AppEngSlot) s );
}
if ( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix )
if( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix )
{
Slot g = (Slot) s;
if ( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 )
if( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 )
{
CraftingGridOffsetX = Math.min( CraftingGridOffsetX, g.xDisplayPosition );
CraftingGridOffsetY = Math.min( CraftingGridOffsetY, g.yDisplayPosition );
@@ -296,64 +321,24 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
CraftingGridOffsetY -= 6;
}
protected void repositionSlot(AppEngSlot s)
@Override
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
s.yDisplayPosition = s.defY + this.ySize - 78 - 5;
this.fontRendererObj.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
protected void actionPerformed(GuiButton btn)
{
if ( btn == this.craftingStatusBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
}
if ( btn instanceof GuiImgButton )
{
boolean backwards = Mouse.isButtonDown( 1 );
GuiImgButton iBtn = (GuiImgButton) btn;
if ( iBtn.getSetting() != Settings.ACTIONS )
{
Enum cv = iBtn.getCurrentValue();
Enum next = Platform.rotateEnum( cv, backwards, iBtn.getSetting().getPossibleValues() );
if ( btn == this.terminalStyleBox )
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
else if ( btn == this.searchBoxSettings )
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
else
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( iBtn.getSetting().name(), next.name() ) );
}
catch (IOException e)
{
AELog.error( e );
}
}
iBtn.set( next );
if ( next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class )
this.re_init();
}
}
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn)
protected void mouseClicked( int xCoord, int yCoord, int btn )
{
Enum searchMode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
if ( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH )
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH )
{
this.searchField.mouseClicked( xCoord, yCoord, btn );
}
if ( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
{
this.searchField.setText( "" );
this.repo.searchString = "";
@@ -365,14 +350,79 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
}
@Override
protected void keyTyped(char character, int key)
public void onGuiClosed()
{
if ( !this.checkHotbarKeys( key ) )
super.onGuiClosed();
memoryText = this.searchField.getText();
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
int x_width = 197;
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
if( this.viewCell || ( this instanceof GuiSecurity ) )
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
for( int x = 0; x < this.rows; x++ )
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
this.drawTexturedModalRect( offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + this.reservedSpace - this.lowerTextureOffset );
if( this.viewCell )
{
if ( character == ' ' && this.searchField.getText().length() == 0 )
boolean update = false;
for( int i = 0; i < 5; i++ )
{
if( this.myCurrentViewCells[i] != this.monitorableContainer.cellView[i].getStack() )
{
update = true;
this.myCurrentViewCells[i] = this.monitorableContainer.cellView[i].getStack();
}
}
if( update )
this.repo.setViewCell( this.myCurrentViewCells );
}
if( this.searchField != null )
this.searchField.drawTextBox();
}
protected String getBackground()
{
return "guis/terminal.png";
}
@Override
protected boolean isPowered()
{
return this.repo.hasPower();
}
int getMaxRows()
{
return AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
}
protected void repositionSlot( AppEngSlot s )
{
s.yDisplayPosition = s.defY + this.ySize - 78 - 5;
}
@Override
protected void keyTyped( char character, int key )
{
if( !this.checkHotbarKeys( key ) )
{
if( character == ' ' && this.searchField.getText().length() == 0 )
return;
if ( this.searchField.textboxKeyTyped( character, key ) )
if( this.searchField.textboxKeyTyped( character, key ) )
{
this.repo.searchString = this.searchField.getText();
this.repo.updateView();
@@ -392,55 +442,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
super.updateScreen();
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
int x_width = 197;
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
if ( this.viewCell || (this instanceof GuiSecurity) )
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
for (int x = 0; x < this.rows; x++)
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
this.drawTexturedModalRect( offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + this.reservedSpace - this.lowerTextureOffset );
if ( this.viewCell )
{
boolean update = false;
for (int i = 0; i < 5; i++)
{
if ( this.myCurrentViewCells[i] != this.monitorableContainer.cellView[i].getStack() )
{
update = true;
this.myCurrentViewCells[i] = this.monitorableContainer.cellView[i].getStack();
}
}
if ( update )
this.repo.setViewCell( this.myCurrentViewCells );
}
if ( this.searchField != null )
this.searchField.drawTextBox();
}
protected String getBackground()
{
return "guis/terminal.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public Enum getSortBy()
{
@@ -460,29 +461,17 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
}
@Override
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
{
if ( this.SortByBox != null )
if( this.SortByBox != null )
this.SortByBox.set( this.configSrc.getSetting( Settings.SORT_BY ) );
if ( this.SortDirBox != null )
if( this.SortDirBox != null )
this.SortDirBox.set( this.configSrc.getSetting( Settings.SORT_DIRECTION ) );
if ( this.ViewBox != null )
if( this.ViewBox != null )
this.ViewBox.set( this.configSrc.getSetting( Settings.VIEW_MODE ) );
this.repo.updateView();
}
@Override
protected boolean isPowered()
{
return this.repo.hasPower();
}
int getMaxRows()
{
return AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
}
}
@@ -18,15 +18,18 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.container.implementations.ContainerMEPortableCell;
public class GuiMEPortableCell extends GuiMEMonitorable
{
public GuiMEPortableCell(InventoryPlayer inventoryPlayer, IPortableCell te) {
public GuiMEPortableCell( InventoryPlayer inventoryPlayer, IPortableCell te )
{
super( inventoryPlayer, te, new ContainerMEPortableCell( inventoryPlayer, null ) );
}
@@ -46,15 +46,17 @@ import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class GuiNetworkStatus extends AEBaseGui implements ISortSource
{
final ItemRepo repo;
GuiImgButton units;
final int rows = 4;
GuiImgButton units;
int tooltip = -1;
public GuiNetworkStatus(InventoryPlayer inventoryPlayer, INetworkTool te) {
public GuiNetworkStatus( InventoryPlayer inventoryPlayer, INetworkTool te )
{
super( new ContainerNetworkStatus( inventoryPlayer, te ) );
this.ySize = 153;
this.xSize = 195;
@@ -64,13 +66,13 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.units )
if( btn == this.units )
{
AEConfig.instance.nextPowerUnit( backwards );
this.units.set( AEConfig.instance.selectedPowerUnit() );
@@ -86,62 +88,34 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
this.buttonList.add( this.units );
}
public void postUpdate(List<IAEItemStack> list)
{
this.repo.clear();
for (IAEItemStack is : list)
this.repo.postUpdate( is );
this.repo.updateView();
this.setScrollBar();
}
private void setScrollBar()
{
int size = this.repo.size();
this.myScrollBar.setTop( 39 ).setLeft( 175 ).setHeight( 78 );
this.myScrollBar.setRange( 0, (size + 4) / 5 - this.rows, 1 );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/networkstatus.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
int tooltip = -1;
@Override
public void drawScreen(int mouse_x, int mouse_y, float btn)
public void drawScreen( int mouse_x, int mouse_y, float btn )
{
int x = 0;
int y = 0;
int gx = (this.width - this.xSize) / 2;
int gy = (this.height - this.ySize) / 2;
int gx = ( this.width - this.xSize ) / 2;
int gy = ( this.height - this.ySize ) / 2;
this.tooltip = -1;
for (int z = 0; z <= 4 * 5; z++)
for( int z = 0; z <= 4 * 5; z++ )
{
int minX = gx + 14 + x * 31;
int minY = gy + 41 + y * 18;
if ( minX < mouse_x && minX + 28 > mouse_x )
if( minX < mouse_x && minX + 28 > mouse_x )
{
if ( minY < mouse_y && minY + 20 > mouse_y )
if( minY < mouse_y && minY + 20 > mouse_y )
{
this.tooltip = z;
break;
}
}
x++;
if ( x > 4 )
if( x > 4 )
{
y++;
x = 0;
@@ -152,7 +126,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
ContainerNetworkStatus ns = (ContainerNetworkStatus) this.inventorySlots;
@@ -177,32 +151,31 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
int toolPosX = 0;
int toolPosY = 0;
for (int z = viewStart; z < Math.min( viewEnd, this.repo.size() ); z++)
for( int z = viewStart; z < Math.min( viewEnd, this.repo.size() ); z++ )
{
IAEItemStack refStack = this.repo.getReferenceItem( z );
if ( refStack != null )
if( refStack != null )
{
GL11.glPushMatrix();
GL11.glScaled( 0.5, 0.5, 0.5 );
String str = Long.toString( refStack.getStackSize() );
if ( refStack.getStackSize() >= 10000 )
if( refStack.getStackSize() >= 10000 )
str = Long.toString( refStack.getStackSize() / 1000 ) + 'k';
int w = this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * 18 + yo + 6) * 2,
4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * sectionLength + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * 18 + yo + 6 ) * 2, 4210752 );
GL11.glPopMatrix();
int posX = x * sectionLength + xo + sectionLength - 18;
int posY = y * 18 + yo;
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
{
toolTip = Platform.getItemDisplayName( this.repo.getItem( z ) );
toolTip += ( '\n' + GuiText.Installed.getLocal() + ": " + ( refStack.getStackSize() ) );
if ( refStack.getCountRequestable() > 0 )
if( refStack.getCountRequestable() > 0 )
toolTip += ( '\n' + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ) );
toolPosX = x * sectionLength + xo + sectionLength - 8;
@@ -213,31 +186,54 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
x++;
if ( x > 4 )
if( x > 4 )
{
y++;
x = 0;
}
}
}
if ( this.tooltip >= 0 && toolTip.length() > 0 )
if( this.tooltip >= 0 && toolTip.length() > 0 )
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
this.drawTooltip( toolPosX, toolPosY + 10, 0, toolTip );
GL11.glPopAttrib();
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/networkstatus.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
public void postUpdate( List<IAEItemStack> list )
{
this.repo.clear();
for( IAEItemStack is : list )
this.repo.postUpdate( is );
this.repo.updateView();
this.setScrollBar();
}
private void setScrollBar()
{
int size = this.repo.size();
this.myScrollBar.setTop( 39 ).setLeft( 175 ).setHeight( 78 );
this.myScrollBar.setRange( 0, ( size + 4 ) / 5 - this.rows, 1 );
}
// @Override - NEI
public List<String> handleItemTooltip(ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip)
public List<String> handleItemTooltip( ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip )
{
if ( stack != null )
if( stack != null )
{
Slot s = this.getSlot( mouseX, mouseY );
if ( s instanceof SlotME )
if( s instanceof SlotME )
{
IAEItemStack myStack = null;
@@ -246,15 +242,14 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
}
catch (Throwable ignore)
catch( Throwable ignore )
{
}
if ( myStack != null )
if( myStack != null )
{
while (currentToolTip.size() > 1)
while( currentToolTip.size() > 1 )
currentToolTip.remove( 1 );
}
}
}
@@ -262,10 +257,10 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
// Vanilla version...
protected void drawItemStackTooltip(ItemStack stack, int x, int y)
protected void drawItemStackTooltip( ItemStack stack, int x, int y )
{
Slot s = this.getSlot( x, y );
if ( s instanceof SlotME && stack != null )
if( s instanceof SlotME && stack != null )
{
IAEItemStack myStack = null;
@@ -274,18 +269,18 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
}
catch (Throwable ignore)
catch( Throwable ignore )
{
}
if ( myStack != null )
if( myStack != null )
{
List currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
while (currentToolTip.size() > 1)
while( currentToolTip.size() > 1 )
currentToolTip.remove( 1 );
currentToolTip.add( GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()) );
currentToolTip.add( GuiText.Installed.getLocal() + ": " + ( myStack.getStackSize() ) );
currentToolTip.add( GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( myStack.getCountRequestable(), true ) );
this.drawTooltip( x, y, 0, join( currentToolTip, "\n" ) );
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
@@ -32,27 +33,29 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
public class GuiNetworkTool extends AEBaseGui
{
GuiToggleButton tFacades;
public GuiNetworkTool(InventoryPlayer inventoryPlayer, INetworkTool te) {
public GuiNetworkTool( InventoryPlayer inventoryPlayer, INetworkTool te )
{
super( new ContainerNetworkTool( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
try
{
if ( btn == this.tFacades )
if( btn == this.tFacades )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "NetworkTool", "Toggle" ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
@@ -69,20 +72,19 @@ public class GuiNetworkTool extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/toolbox.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
if ( this.tFacades != null )
this.tFacades.setState( ((ContainerNetworkTool) this.inventorySlots).facadeMode );
if( this.tFacades != null )
this.tFacades.setState( ( (ContainerNetworkTool) this.inventorySlots ).facadeMode );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/toolbox.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
@@ -36,6 +37,7 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
public class GuiPatternTerm extends GuiMEMonitorable
{
@@ -47,50 +49,37 @@ public class GuiPatternTerm extends GuiMEMonitorable
GuiImgButton encodeBtn;
GuiImgButton clearBtn;
@Override
public void initGui()
public GuiPatternTerm( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super.initGui();
this.buttonList.add( this.tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.crafting_table ),
GuiText.CraftingPattern.getLocal(), itemRender ) );
this.buttonList.add( this.tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.furnace ),
GuiText.ProcessingPattern.getLocal(), itemRender ) );
// buttonList.add( substitutionsBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163,
// Settings.ACTIONS, ActionItems.SUBSTITUTION ) );
// substitutionsBtn.halfSize = true;
this.buttonList.add( this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE ) );
this.clearBtn.halfSize = true;
this.buttonList.add( this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE ) );
super( inventoryPlayer, te, new ContainerPatternTerm( inventoryPlayer, te ) );
this.container = (ContainerPatternTerm) this.inventorySlots;
this.reservedSpace = 81;
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
try
{
if ( this.tabCraftButton == btn || this.tabProcessButton == btn )
if( this.tabCraftButton == btn || this.tabProcessButton == btn )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.CraftMode", this.tabProcessButton == btn ? "1" : "0" ) );
}
if ( this.encodeBtn == btn )
if( this.encodeBtn == btn )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.Encode", "1" ) );
}
if ( this.clearBtn == btn )
if( this.clearBtn == btn )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.Clear", "1" ) );
}
}
catch (IOException e)
catch( IOException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
@@ -103,32 +92,26 @@ public class GuiPatternTerm extends GuiMEMonitorable
}
@Override
protected void repositionSlot(AppEngSlot s)
public void initGui()
{
if ( s.isPlayerSide() )
s.yDisplayPosition = s.defY + this.ySize - 78 - 5;
else
s.yDisplayPosition = s.defY + this.ySize - 78 - 3;
}
super.initGui();
this.buttonList.add( this.tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.crafting_table ), GuiText.CraftingPattern.getLocal(), itemRender ) );
this.buttonList.add( this.tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.furnace ), GuiText.ProcessingPattern.getLocal(), itemRender ) );
public GuiPatternTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super( inventoryPlayer, te, new ContainerPatternTerm( inventoryPlayer, te ) );
this.container = (ContainerPatternTerm) this.inventorySlots;
this.reservedSpace = 81;
// buttonList.add( substitutionsBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163,
// Settings.ACTIONS, ActionItems.SUBSTITUTION ) );
// substitutionsBtn.halfSize = true;
this.buttonList.add( this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE ) );
this.clearBtn.halfSize = true;
this.buttonList.add( this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE ) );
}
@Override
protected String getBackground()
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
if ( this.container.craftingMode )
return "guis/pattern.png";
return "guis/pattern2.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
if ( !this.container.craftingMode )
if( !this.container.craftingMode )
{
this.tabCraftButton.visible = false;
this.tabProcessButton.visible = true;
@@ -143,4 +126,20 @@ public class GuiPatternTerm extends GuiMEMonitorable
this.fontRendererObj.drawString( GuiText.PatternTerminal.getLocal(), 8, this.ySize - 96 + 2 - this.reservedSpace, 4210752 );
}
@Override
protected String getBackground()
{
if( this.container.craftingMode )
return "guis/pattern.png";
return "guis/pattern2.png";
}
@Override
protected void repositionSlot( AppEngSlot s )
{
if( s.isPlayerSide() )
s.yDisplayPosition = s.defY + this.ySize - 78 - 5;
else
s.yDisplayPosition = s.defY + this.ySize - 78 - 3;
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
@@ -48,6 +49,7 @@ import appeng.tile.misc.TileInterface;
import appeng.tile.storage.TileChest;
import appeng.tile.storage.TileDrive;
public class GuiPriority extends AEBaseGui
{
@@ -65,7 +67,8 @@ public class GuiPriority extends AEBaseGui
GuiBridge OriginalGui;
public GuiPriority(InventoryPlayer inventoryPlayer, IPriorityHost te) {
public GuiPriority( InventoryPlayer inventoryPlayer, IPriorityHost te )
{
super( new ContainerPriority( inventoryPlayer, te ) );
}
@@ -90,32 +93,32 @@ public class GuiPriority extends AEBaseGui
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
ItemStack myIcon = null;
Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
final IBlocks blocks = definitions.blocks();
if ( target instanceof PartStorageBus )
if( target instanceof PartStorageBus )
{
for ( ItemStack storageBusStack :parts.storageBus().maybeStack( 1 ).asSet() )
for( ItemStack storageBusStack : parts.storageBus().maybeStack( 1 ).asSet() )
{
myIcon = storageBusStack;
}
this.OriginalGui = GuiBridge.GUI_STORAGEBUS;
}
if ( target instanceof PartFormationPlane )
if( target instanceof PartFormationPlane )
{
for ( ItemStack formationPlaneStack : parts.formationPlane().maybeStack( 1 ).asSet() )
for( ItemStack formationPlaneStack : parts.formationPlane().maybeStack( 1 ).asSet() )
{
myIcon = formationPlaneStack;
}
this.OriginalGui = GuiBridge.GUI_FORMATION_PLANE;
}
if ( target instanceof TileDrive )
if( target instanceof TileDrive )
{
for ( ItemStack driveStack : blocks.drive().maybeStack( 1 ).asSet() )
for( ItemStack driveStack : blocks.drive().maybeStack( 1 ).asSet() )
{
myIcon = driveStack;
}
@@ -123,9 +126,9 @@ public class GuiPriority extends AEBaseGui
this.OriginalGui = GuiBridge.GUI_DRIVE;
}
if ( target instanceof TileChest )
if( target instanceof TileChest )
{
for ( ItemStack chestStack : blocks.chest().maybeStack( 1 ).asSet() )
for( ItemStack chestStack : blocks.chest().maybeStack( 1 ).asSet() )
{
myIcon = chestStack;
}
@@ -133,9 +136,9 @@ public class GuiPriority extends AEBaseGui
this.OriginalGui = GuiBridge.GUI_CHEST;
}
if ( target instanceof TileInterface )
if( target instanceof TileInterface )
{
for ( ItemStack interfaceStack : blocks.iface().maybeStack( 1 ).asSet() )
for( ItemStack interfaceStack : blocks.iface().maybeStack( 1 ).asSet() )
{
myIcon = interfaceStack;
}
@@ -143,16 +146,16 @@ public class GuiPriority extends AEBaseGui
this.OriginalGui = GuiBridge.GUI_INTERFACE;
}
if ( target instanceof PartInterface )
if( target instanceof PartInterface )
{
for ( ItemStack interfaceStack : parts.iface().maybeStack( 1 ).asSet() )
for( ItemStack interfaceStack : parts.iface().maybeStack( 1 ).asSet() )
{
myIcon = interfaceStack;
}
this.OriginalGui = GuiBridge.GUI_INTERFACE;
}
if ( this.OriginalGui != null && myIcon != null )
if( this.OriginalGui != null && myIcon != null )
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
this.priority = new GuiNumberBox( this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT, Long.class );
@@ -161,15 +164,30 @@ public class GuiPriority extends AEBaseGui
this.priority.setTextColor( 0xFFFFFF );
this.priority.setVisible( true );
this.priority.setFocused( true );
((ContainerPriority) this.inventorySlots).setTextField( this.priority );
( (ContainerPriority) this.inventorySlots ).setTextField( this.priority );
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/priority.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
this.priority.drawTextBox();
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
if ( btn == this.originalGuiBtn )
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
}
@@ -177,27 +195,27 @@ public class GuiPriority extends AEBaseGui
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if ( isPlus || isMinus )
if( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty(int i)
private void addQty( int i )
{
try
{
String out = this.priority.getText();
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
while( out.startsWith( "0" ) && out.length() > 1 )
{
out = out.substring( 1 );
fixed = true;
}
if ( fixed )
if( fixed )
this.priority.setText( out );
if ( out.length() == 0 )
if( out.length() == 0 )
out = "0";
long result = Long.parseLong( out );
@@ -207,45 +225,44 @@ public class GuiPriority extends AEBaseGui
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
}
catch(NumberFormatException e )
catch( NumberFormatException e )
{
// nope..
this.priority.setText( "0" );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
}
@Override
protected void keyTyped(char character, int key)
protected void keyTyped( char character, int key )
{
if ( !this.checkHotbarKeys( key ) )
if( !this.checkHotbarKeys( key ) )
{
if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ))
&& this.priority.textboxKeyTyped( character, key ) )
if( ( key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ) ) && this.priority.textboxKeyTyped( character, key ) )
{
try
{
String out = this.priority.getText();
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
while( out.startsWith( "0" ) && out.length() > 1 )
{
out = out.substring( 1 );
fixed = true;
}
if ( fixed )
if( fixed )
this.priority.setText( out );
if ( out.length() == 0 )
if( out.length() == 0 )
out = "0";
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
@@ -257,23 +274,8 @@ public class GuiPriority extends AEBaseGui
}
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/priority.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
this.priority.drawTextBox();
}
protected String getBackground()
{
return "guis/priority.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
@@ -25,26 +26,27 @@ import appeng.container.implementations.ContainerQNB;
import appeng.core.localization.GuiText;
import appeng.tile.qnb.TileQuantumBridge;
public class GuiQNB extends AEBaseGui
{
public GuiQNB(InventoryPlayer inventoryPlayer, TileQuantumBridge te) {
public GuiQNB( InventoryPlayer inventoryPlayer, TileQuantumBridge te )
{
super( new ContainerQNB( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.QuantumLinkChamber.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiTextField;
@@ -31,12 +32,14 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.items.contents.QuartzKnifeObj;
public class GuiQuartzKnife extends AEBaseGui
{
GuiTextField name;
public GuiQuartzKnife(InventoryPlayer inventoryPlayer, QuartzKnifeObj te) {
public GuiQuartzKnife( InventoryPlayer inventoryPlayer, QuartzKnifeObj te )
{
super( new ContainerQuartzKnife( inventoryPlayer, te ) );
this.ySize = 184;
}
@@ -55,7 +58,14 @@ public class GuiQuartzKnife extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.QuartzCuttingKnife.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/quartzknife.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
@@ -63,17 +73,17 @@ public class GuiQuartzKnife extends AEBaseGui
}
@Override
protected void keyTyped(char character, int key)
protected void keyTyped( char character, int key )
{
if ( this.name.textboxKeyTyped( character, key ) )
if( this.name.textboxKeyTyped( character, key ) )
{
try
{
String Out = this.name.getText();
((ContainerQuartzKnife) this.inventorySlots).setName( Out );
( (ContainerQuartzKnife) this.inventorySlots ).setName( Out );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "QuartzKnife.Name", Out ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
@@ -83,12 +93,4 @@ public class GuiQuartzKnife extends AEBaseGui
super.keyTyped( character, key );
}
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.QuartzCuttingKnife.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
}
@@ -33,10 +33,18 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
public class GuiSecurity extends GuiMEMonitorable
{
public GuiSecurity(InventoryPlayer inventoryPlayer, ITerminalHost te) {
GuiToggleButton inject;
GuiToggleButton extract;
GuiToggleButton craft;
GuiToggleButton build;
GuiToggleButton security;
public GuiSecurity( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
this.customSortOrder = false;
this.reservedSpace = 33;
@@ -46,11 +54,36 @@ public class GuiSecurity extends GuiMEMonitorable
this.standardSize = this.xSize;
}
GuiToggleButton inject;
GuiToggleButton extract;
GuiToggleButton craft;
GuiToggleButton build;
GuiToggleButton security;
@Override
protected void actionPerformed( net.minecraft.client.gui.GuiButton btn )
{
super.actionPerformed( btn );
SecurityPermissions toggleSetting = null;
if( btn == this.inject )
toggleSetting = SecurityPermissions.INJECT;
if( btn == this.extract )
toggleSetting = SecurityPermissions.EXTRACT;
if( btn == this.craft )
toggleSetting = SecurityPermissions.CRAFT;
if( btn == this.build )
toggleSetting = SecurityPermissions.BUILD;
if( btn == this.security )
toggleSetting = SecurityPermissions.SECURITY;
if( toggleSetting != null )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileSecurity.ToggleOption", toggleSetting.name() ) );
}
catch( IOException e )
{
AELog.error( e );
}
}
}
@Override
public void initGui()
@@ -58,52 +91,22 @@ public class GuiSecurity extends GuiMEMonitorable
super.initGui();
int top = this.guiTop + this.ySize - 116;
this.buttonList.add( this.inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT
.getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
this.buttonList.add( this.inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT.getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
this.buttonList.add( this.extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT
.getUnlocalizedName(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) );
this.buttonList.add( this.extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT.getUnlocalizedName(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) );
this.buttonList.add( this.craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT.getUnlocalizedName(),
SecurityPermissions.CRAFT.getUnlocalizedTip() ) );
this.buttonList.add( this.craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT.getUnlocalizedName(), SecurityPermissions.CRAFT.getUnlocalizedTip() ) );
this.buttonList.add( this.build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD.getUnlocalizedName(),
SecurityPermissions.BUILD.getUnlocalizedTip() ) );
this.buttonList.add( this.build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD.getUnlocalizedName(), SecurityPermissions.BUILD.getUnlocalizedTip() ) );
this.buttonList.add( this.security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY
.getUnlocalizedName(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) );
this.buttonList.add( this.security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY.getUnlocalizedName(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) );
}
@Override
protected void actionPerformed(net.minecraft.client.gui.GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
SecurityPermissions toggleSetting = null;
if ( btn == this.inject )
toggleSetting = SecurityPermissions.INJECT;
if ( btn == this.extract )
toggleSetting = SecurityPermissions.EXTRACT;
if ( btn == this.craft )
toggleSetting = SecurityPermissions.CRAFT;
if ( btn == this.build )
toggleSetting = SecurityPermissions.BUILD;
if ( btn == this.security )
toggleSetting = SecurityPermissions.SECURITY;
if ( toggleSetting != null )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileSecurity.ToggleOption", toggleSetting.name() ) );
}
catch (IOException e)
{
AELog.error( e );
}
}
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
}
@Override
@@ -111,26 +114,18 @@ public class GuiSecurity extends GuiMEMonitorable
{
ContainerSecurity cs = (ContainerSecurity) this.inventorySlots;
this.inject.setState( (cs.security & (1 << SecurityPermissions.INJECT.ordinal())) > 0 );
this.extract.setState( (cs.security & (1 << SecurityPermissions.EXTRACT.ordinal())) > 0 );
this.craft.setState( (cs.security & (1 << SecurityPermissions.CRAFT.ordinal())) > 0 );
this.build.setState( (cs.security & (1 << SecurityPermissions.BUILD.ordinal())) > 0 );
this.security.setState( (cs.security & (1 << SecurityPermissions.SECURITY.ordinal())) > 0 );
this.inject.setState( ( cs.security & ( 1 << SecurityPermissions.INJECT.ordinal() ) ) > 0 );
this.extract.setState( ( cs.security & ( 1 << SecurityPermissions.EXTRACT.ordinal() ) ) > 0 );
this.craft.setState( ( cs.security & ( 1 << SecurityPermissions.CRAFT.ordinal() ) ) > 0 );
this.build.setState( ( cs.security & ( 1 << SecurityPermissions.BUILD.ordinal() ) ) > 0 );
this.security.setState( ( cs.security & ( 1 << SecurityPermissions.SECURITY.ordinal() ) ) > 0 );
return "guis/security.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
}
@Override
public Enum getSortBy()
{
return SortOrder.NAME;
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
@@ -27,32 +28,33 @@ import appeng.core.localization.GuiText;
import appeng.integration.IntegrationType;
import appeng.tile.storage.TileSkyChest;
public class GuiSkyChest extends AEBaseGui
{
public GuiSkyChest(InventoryPlayer inventoryPlayer, TileSkyChest te) {
public GuiSkyChest( InventoryPlayer inventoryPlayer, TileSkyChest te )
{
super( new ContainerSkyChest( inventoryPlayer, te ) );
this.ySize = 195;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/skychest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.SkyChest.getLocal() ), 8, 8, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/skychest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
protected boolean enableSpaceClicking()
{
return !AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks );
}
}
@@ -33,26 +33,28 @@ import appeng.core.localization.GuiText;
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
public class GuiSpatialIOPort extends AEBaseGui
{
final ContainerSpatialIOPort container;
GuiImgButton units;
public GuiSpatialIOPort(InventoryPlayer inventoryPlayer, TileSpatialIOPort te) {
public GuiSpatialIOPort( InventoryPlayer inventoryPlayer, TileSpatialIOPort te )
{
super( new ContainerSpatialIOPort( inventoryPlayer, te ) );
this.ySize = 199;
this.container = (ContainerSpatialIOPort) this.inventorySlots;
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.units )
if( btn == this.units )
{
AEConfig.instance.nextPowerUnit( backwards );
this.units.set( AEConfig.instance.selectedPowerUnit() );
@@ -69,22 +71,21 @@ public class GuiSpatialIOPort extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/spatialio.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.currentPower, false ), 13, 21, 4210752 );
this.fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.maxPower, false ), 13, 31, 4210752 );
this.fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.reqPower, false ), 13, 78, 4210752 );
this.fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) this.container.eff) / 100) + '%', 13, 88, 4210752 );
this.fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.eff ) / 100 ) + '%', 13, 88, 4210752 );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/spatialio.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import org.lwjgl.input.Mouse;
@@ -42,6 +43,7 @@ import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.parts.misc.PartStorageBus;
public class GuiStorageBus extends GuiUpgradeable
{
@@ -51,27 +53,12 @@ public class GuiStorageBus extends GuiUpgradeable
GuiImgButton partition;
GuiImgButton clear;
public GuiStorageBus(InventoryPlayer inventoryPlayer, PartStorageBus te) {
public GuiStorageBus( InventoryPlayer inventoryPlayer, PartStorageBus te )
{
super( new ContainerStorageBus( inventoryPlayer, te ) );
this.ySize = 251;
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.StorageBus.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if ( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if ( this.storageFilter != null )
this.storageFilter.set( ((ContainerStorageBus) this.cvb).storageFilter );
if ( this.rwMode != null )
this.rwMode.set( ((ContainerStorageBus) this.cvb).rwMode );
}
@Override
protected void addButtons()
{
@@ -91,34 +78,19 @@ public class GuiStorageBus extends GuiUpgradeable
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.StorageBus.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
boolean backwards = Mouse.isButtonDown( 1 );
if( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
try
{
if ( btn == this.partition )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
if( this.storageFilter != null )
this.storageFilter.set( ( (ContainerStorageBus) this.cvb ).storageFilter );
else if ( btn == this.clear )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Clear" ) );
else if ( btn == this.priority )
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
else if ( btn == this.rwMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.rwMode.getSetting(), backwards ) );
else if ( btn == this.storageFilter )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.storageFilter.getSetting(), backwards ) );
}
catch (IOException e)
{
AELog.error( e );
}
if( this.rwMode != null )
this.rwMode.set( ( (ContainerStorageBus) this.cvb ).rwMode );
}
@Override
@@ -127,4 +99,33 @@ public class GuiStorageBus extends GuiUpgradeable
return "guis/storagebus.png";
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
try
{
if( btn == this.partition )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
else if( btn == this.clear )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Clear" ) );
else if( btn == this.priority )
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
else if( btn == this.rwMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.rwMode.getSetting(), backwards ) );
else if( btn == this.storageFilter )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.storageFilter.getSetting(), backwards ) );
}
catch( IOException e )
{
AELog.error( e );
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -37,6 +38,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.parts.automation.PartImportBus;
public class GuiUpgradeable extends AEBaseGui
{
@@ -47,11 +49,13 @@ public class GuiUpgradeable extends AEBaseGui
GuiImgButton fuzzyMode;
GuiImgButton craftMode;
public GuiUpgradeable(InventoryPlayer inventoryPlayer, IUpgradeableHost te) {
public GuiUpgradeable( InventoryPlayer inventoryPlayer, IUpgradeableHost te )
{
this( new ContainerUpgradeable( inventoryPlayer, te ) );
}
public GuiUpgradeable(ContainerUpgradeable te) {
public GuiUpgradeable( ContainerUpgradeable te )
{
super( te );
this.cvb = te;
@@ -60,6 +64,11 @@ public class GuiUpgradeable extends AEBaseGui
this.ySize = 184;
}
protected boolean hasToolbox()
{
return ( (ContainerUpgradeable) this.inventorySlots ).hasToolbox();
}
@Override
public void initGui()
{
@@ -79,43 +88,42 @@ public class GuiUpgradeable extends AEBaseGui
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
this.fontRendererObj.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
boolean backwards = Mouse.isButtonDown( 1 );
if( this.redstoneMode != null )
this.redstoneMode.set( this.cvb.rsMode );
if ( btn == this.redstoneMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.redstoneMode.getSetting(), backwards ) );
if( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if ( btn == this.craftMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.craftMode.getSetting(), backwards ) );
if ( btn == this.fuzzyMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.fuzzyMode.getSetting(), backwards ) );
}
protected boolean hasToolbox()
{
return ((ContainerUpgradeable) this.inventorySlots).hasToolbox();
if( this.craftMode != null )
this.craftMode.set( this.cvb.cMode );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.handleButtonVisibility();
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if ( this.drawUpgrades() )
if( this.drawUpgrades() )
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvb.availableUpgrades() * 18 );
if ( this.hasToolbox() )
if( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68 );
}
protected boolean drawUpgrades()
protected void handleButtonVisibility()
{
return true;
if( this.redstoneMode != null )
this.redstoneMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
if( this.fuzzyMode != null )
this.fuzzyMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
if( this.craftMode != null )
this.craftMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
}
protected String getBackground()
@@ -123,30 +131,9 @@ public class GuiUpgradeable extends AEBaseGui
return "guis/bus.png";
}
protected void handleButtonVisibility()
protected boolean drawUpgrades()
{
if ( this.redstoneMode != null )
this.redstoneMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
if ( this.fuzzyMode != null )
this.fuzzyMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
if ( this.craftMode != null )
this.craftMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if ( this.redstoneMode != null )
this.redstoneMode.set( this.cvb.rsMode );
if ( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if ( this.craftMode != null )
this.craftMode.set( this.cvb.cMode );
return true;
}
protected GuiText getName()
@@ -154,4 +141,20 @@ public class GuiUpgradeable extends AEBaseGui
return this.bc instanceof PartImportBus ? GuiText.ImportBus : GuiText.ExportBus;
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.redstoneMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.redstoneMode.getSetting(), backwards ) );
if( btn == this.craftMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.craftMode.getSetting(), backwards ) );
if( btn == this.fuzzyMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.fuzzyMode.getSetting(), backwards ) );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.opengl.GL11;
import net.minecraft.entity.player.InventoryPlayer;
@@ -29,13 +30,14 @@ import appeng.container.implementations.ContainerVibrationChamber;
import appeng.core.localization.GuiText;
import appeng.tile.misc.TileVibrationChamber;
public class GuiVibrationChamber extends AEBaseGui
{
final ContainerVibrationChamber cvc;
GuiProgressBar pb;
public GuiVibrationChamber(InventoryPlayer inventoryPlayer, TileVibrationChamber te)
public GuiVibrationChamber( InventoryPlayer inventoryPlayer, TileVibrationChamber te )
{
super( new ContainerVibrationChamber( inventoryPlayer, te ) );
this.cvc = (ContainerVibrationChamber) this.inventorySlots;
@@ -52,16 +54,7 @@ public class GuiVibrationChamber extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/vibchamber.png" );
this.pb.xPosition = 99 + this.guiLeft;
this.pb.yPosition = 36 + this.guiTop;
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
@@ -71,7 +64,7 @@ public class GuiVibrationChamber extends AEBaseGui
this.pb.setFullMsg( this.cvc.aePerTick * this.cvc.getCurrentProgress() / 100 + " ae/t" );
if ( this.cvc.getCurrentProgress() > 0 )
if( this.cvc.getCurrentProgress() > 0 )
{
int i1 = this.cvc.getCurrentProgress();
this.bindTexture( "guis/vibchamber.png" );
@@ -80,4 +73,12 @@ public class GuiVibrationChamber extends AEBaseGui
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/vibchamber.png" );
this.pb.xPosition = 99 + this.guiLeft;
this.pb.yPosition = 36 + this.guiTop;
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -32,19 +33,26 @@ import appeng.core.localization.GuiText;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
public class GuiWireless extends AEBaseGui
{
GuiImgButton units;
public GuiWireless( InventoryPlayer inventoryPlayer, TileWireless te )
{
super( new ContainerWireless( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.units )
if( btn == this.units )
{
AEConfig.instance.nextPowerUnit( backwards );
this.units.set( AEConfig.instance.selectedPowerUnit() );
@@ -60,36 +68,30 @@ public class GuiWireless extends AEBaseGui
this.buttonList.add( this.units );
}
public GuiWireless(InventoryPlayer inventoryPlayer, TileWireless te) {
super( new ContainerWireless( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/wireless.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Wireless.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
ContainerWireless cw = (ContainerWireless) this.inventorySlots;
if ( cw.range > 0 )
if( cw.range > 0 )
{
String firstMessage = GuiText.Range.getLocal() + ": " + (cw.range / 10.0) + " m";
String firstMessage = GuiText.Range.getLocal() + ": " + ( cw.range / 10.0 ) + " m";
String secondMessage = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.drain, true );
int strWidth = Math.max( this.fontRendererObj.getStringWidth( firstMessage ), this.fontRendererObj.getStringWidth( secondMessage ) );
int cOffset = (this.xSize / 2) - (strWidth / 2);
int cOffset = ( this.xSize / 2 ) - ( strWidth / 2 );
this.fontRendererObj.drawString( firstMessage, cOffset, 20, 4210752 );
this.fontRendererObj.drawString( secondMessage, cOffset, 20 + 12, 4210752 );
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/wireless.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,14 +18,17 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.implementations.guiobjects.IPortableCell;
public class GuiWirelessTerm extends GuiMEPortableCell
{
public GuiWirelessTerm(InventoryPlayer inventoryPlayer, IPortableCell te) {
public GuiWirelessTerm( InventoryPlayer inventoryPlayer, IPortableCell te )
{
super( inventoryPlayer, te );
this.maxRows = Integer.MAX_VALUE;
}
@@ -72,7 +72,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
this.width = 16;
this.height = 16;
if ( appearances == null )
if( appearances == null )
{
appearances = new HashMap<EnumPair, ButtonAppearance>();
this.registerApp( 16 * 7, Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH, ButtonToolTips.CondenserOutput, ButtonToolTips.Trash );
@@ -165,7 +165,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
{
ButtonAppearance a = new ButtonAppearance();
a.displayName = title.getUnlocalized();
a.displayValue = ( String ) ( hint instanceof String ? hint : ( ( ButtonToolTips ) hint ).getUnlocalized() );
a.displayValue = (String) ( hint instanceof String ? hint : ( (ButtonToolTips) hint ).getUnlocalized() );
a.index = iconIndex;
appearances.put( new EnumPair( setting, val ), a );
}
@@ -179,11 +179,11 @@ public class GuiImgButton extends GuiButton implements ITooltip
@Override
public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
{
if ( this.visible )
if( this.visible )
{
int iconIndex = this.getIconIndex();
if ( this.halfSize )
if( this.halfSize )
{
this.width = 8;
this.height = 8;
@@ -192,7 +192,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F );
GL11.glScalef( 0.5f, 0.5f, 0.5f );
if ( this.enabled )
if( this.enabled )
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
else
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
@@ -200,7 +200,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
int uv_y = ( int ) Math.floor( iconIndex / 16 );
int uv_y = (int) Math.floor( iconIndex / 16 );
int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( 0, 0, 256 - 16, 256 - 16, 16, 16 );
@@ -211,7 +211,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
}
else
{
if ( this.enabled )
if( this.enabled )
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
else
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
@@ -219,7 +219,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
int uv_y = ( int ) Math.floor( iconIndex / 16 );
int uv_y = (int) Math.floor( iconIndex / 16 );
int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16 );
@@ -232,10 +232,10 @@ public class GuiImgButton extends GuiButton implements ITooltip
private int getIconIndex()
{
if ( this.buttonSetting != null && this.currentValue != null )
if( this.buttonSetting != null && this.currentValue != null )
{
ButtonAppearance app = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
if ( app == null )
if( app == null )
return 256 - 1;
return app.index;
}
@@ -244,7 +244,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
public Settings getSetting()
{
return ( Settings ) this.buttonSetting;
return (Settings) this.buttonSetting;
}
public Enum getCurrentValue()
@@ -258,36 +258,36 @@ public class GuiImgButton extends GuiButton implements ITooltip
String displayName = null;
String displayValue = null;
if ( this.buttonSetting != null && this.currentValue != null )
if( this.buttonSetting != null && this.currentValue != null )
{
ButtonAppearance buttonAppearance = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
if ( buttonAppearance == null )
if( buttonAppearance == null )
return "No Such Message";
displayName = buttonAppearance.displayName;
displayValue = buttonAppearance.displayValue;
}
if ( displayName != null )
if( displayName != null )
{
String name = StatCollector.translateToLocal( displayName );
String value = StatCollector.translateToLocal( displayValue );
if ( name == null || name.isEmpty() )
if( name == null || name.isEmpty() )
name = displayName;
if ( value == null || value.isEmpty() )
if( value == null || value.isEmpty() )
value = displayValue;
if ( this.fillVar != null )
if( this.fillVar != null )
value = COMPILE.matcher( value ).replaceFirst( this.fillVar );
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" );
if ( i <= 0 )
if( i <= 0 )
i = 0;
while ( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
while( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
{
sb.replace( i, i + 1, "\n" );
}
@@ -329,7 +329,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
public void set( Enum e )
{
if ( this.currentValue != e )
if( this.currentValue != e )
{
this.currentValue = e;
}
@@ -356,15 +356,16 @@ public class GuiImgButton extends GuiButton implements ITooltip
@Override
public boolean equals( Object obj )
{
if ( obj == null )
if( obj == null )
return false;
if ( this.getClass() != obj.getClass() )
if( this.getClass() != obj.getClass() )
return false;
EnumPair other = ( EnumPair ) obj;
EnumPair other = (EnumPair) obj;
return other.setting == this.setting && other.value == this.value;
}
}
private static class ButtonAppearance
{
public int index;
@@ -18,6 +18,7 @@
package appeng.client.gui.widgets;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
@@ -27,31 +28,30 @@ public class GuiNumberBox extends GuiTextField
final Class type;
public GuiNumberBox(FontRenderer p_i1032_1_, int p_i1032_2_, int p_i1032_3_, int p_i1032_4_, int p_i1032_5_,Class type) {
public GuiNumberBox( FontRenderer p_i1032_1_, int p_i1032_2_, int p_i1032_3_, int p_i1032_4_, int p_i1032_5_, Class type )
{
super( p_i1032_1_, p_i1032_2_, p_i1032_3_, p_i1032_4_, p_i1032_5_ );
this.type = type;
}
@Override
public void writeText(String p_146191_1_)
public void writeText( String p_146191_1_ )
{
String original = this.getText();
super.writeText( p_146191_1_ );
try
{
if ( this.type == int.class || this.type == Integer.class )
if( this.type == int.class || this.type == Integer.class )
Integer.parseInt( this.getText() );
else if ( this.type == long.class || this.type == Long.class )
else if( this.type == long.class || this.type == Long.class )
Long.parseLong( this.getText() );
else if ( this.type == double.class || this.type == Double.class )
else if( this.type == double.class || this.type == Double.class )
Double.parseDouble( this.getText() );
}
catch(NumberFormatException e )
catch( NumberFormatException e )
{
this.setText( original );
}
}
}
@@ -26,29 +26,24 @@ import net.minecraft.util.ResourceLocation;
import appeng.container.interfaces.IProgressProvider;
import appeng.core.localization.GuiText;
public class GuiProgressBar extends GuiButton implements ITooltip
{
public enum Direction
{
HORIZONTAL, VERTICAL
}
private final IProgressProvider source;
private final ResourceLocation texture;
private final int fill_u;
private final int fill_v;
private final Direction layout;
private String fullMsg;
private final String titleName;
private String fullMsg;
public GuiProgressBar(IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir)
public GuiProgressBar( IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir )
{
this( source, texture, posX, posY, u, y, _width, _height, dir, null );
}
public GuiProgressBar(IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir, String title)
public GuiProgressBar( IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir, String title )
{
super( posX, posY, _width, "" );
this.source = source;
@@ -64,22 +59,22 @@ public class GuiProgressBar extends GuiButton implements ITooltip
}
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
{
if ( this.visible )
if( this.visible )
{
par1Minecraft.getTextureManager().bindTexture( this.texture );
int max = this.source.getMaxProgress();
int current = this.source.getCurrentProgress();
if ( this.layout == Direction.VERTICAL )
if( this.layout == Direction.VERTICAL )
{
int diff = this.height - (max > 0 ? (this.height * current) / max : 0);
int diff = this.height - ( max > 0 ? ( this.height * current ) / max : 0 );
this.drawTexturedModalRect( this.xPosition, this.yPosition + diff, this.fill_u, this.fill_v + diff, this.width, this.height - diff );
}
else
{
int diff = this.width - (max > 0 ? (this.width * current) / max : 0);
int diff = this.width - ( max > 0 ? ( this.width * current ) / max : 0 );
this.drawTexturedModalRect( this.xPosition, this.yPosition, this.fill_u + diff, this.fill_v, this.width - diff, this.height );
}
@@ -87,7 +82,7 @@ public class GuiProgressBar extends GuiButton implements ITooltip
}
}
public void setFullMsg(String msg)
public void setFullMsg( String msg )
{
this.fullMsg = msg;
}
@@ -95,10 +90,10 @@ public class GuiProgressBar extends GuiButton implements ITooltip
@Override
public String getMessage()
{
if ( this.fullMsg != null )
if( this.fullMsg != null )
return this.fullMsg;
return (this.titleName != null ? this.titleName : "") + '\n' + this.source.getCurrentProgress() + ' ' + GuiText.Of.getLocal() + ' ' + this.source.getMaxProgress();
return ( this.titleName != null ? this.titleName : "" ) + '\n' + this.source.getCurrentProgress() + ' ' + GuiText.Of.getLocal() + ' ' + this.source.getMaxProgress();
}
@Override
@@ -131,4 +126,8 @@ public class GuiProgressBar extends GuiButton implements ITooltip
return true;
}
public enum Direction
{
HORIZONTAL, VERTICAL
}
}
@@ -18,10 +18,12 @@
package appeng.client.gui.widgets;
import org.lwjgl.opengl.GL11;
import appeng.client.gui.AEBaseGui;
public class GuiScrollbar implements IScrollSource
{
@@ -35,23 +37,18 @@ public class GuiScrollbar implements IScrollSource
private int minScroll = 0;
private int currentScroll = 0;
private void applyRange()
{
this.currentScroll = Math.max( Math.min( this.currentScroll, this.maxScroll ), this.minScroll );
}
public void draw(AEBaseGui g)
public void draw( AEBaseGui g )
{
g.bindTexture( "minecraft", "gui/container/creative_inventory/tabs.png" );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
if ( this.getRange() == 0 )
if( this.getRange() == 0 )
{
g.drawTexturedModalRect( this.displayX, this.displayY, 232 + this.width, 0, this.width, 15 );
}
else
{
int offset = (this.currentScroll - this.minScroll) * (this.height - 15) / this.getRange();
int offset = ( this.currentScroll - this.minScroll ) * ( this.height - 15 ) / this.getRange();
g.drawTexturedModalRect( this.displayX, offset + this.displayY, 232, 0, this.width, 15 );
}
}
@@ -66,85 +63,89 @@ public class GuiScrollbar implements IScrollSource
return this.displayX;
}
public GuiScrollbar setLeft( int v )
{
this.displayX = v;
return this;
}
public int getTop()
{
return this.displayY;
}
public GuiScrollbar setTop( int v )
{
this.displayY = v;
return this;
}
public int getWidth()
{
return this.width;
}
public int getHeight()
{
return this.height;
}
public GuiScrollbar setLeft(int v)
{
this.displayX = v;
return this;
}
public GuiScrollbar setTop(int v)
{
this.displayY = v;
return this;
}
public GuiScrollbar setWidth(int v)
public GuiScrollbar setWidth( int v )
{
this.width = v;
return this;
}
public GuiScrollbar setHeight(int v)
public int getHeight()
{
return this.height;
}
public GuiScrollbar setHeight( int v )
{
this.height = v;
return this;
}
public void setRange(int min, int max, int pageSize)
public void setRange( int min, int max, int pageSize )
{
this.minScroll = min;
this.maxScroll = max;
this.pageSize = pageSize;
if ( this.minScroll > this.maxScroll )
if( this.minScroll > this.maxScroll )
this.maxScroll = this.minScroll;
this.applyRange();
}
private void applyRange()
{
this.currentScroll = Math.max( Math.min( this.currentScroll, this.maxScroll ), this.minScroll );
}
@Override
public int getCurrentScroll()
{
return this.currentScroll;
}
public void click(AEBaseGui aeBaseGui, int x, int y)
public void click( AEBaseGui aeBaseGui, int x, int y )
{
if ( this.getRange() == 0 )
if( this.getRange() == 0 )
return;
if ( x > this.displayX && x <= this.displayX + this.width )
if( x > this.displayX && x <= this.displayX + this.width )
{
if ( y > this.displayY && y <= this.displayY + this.height )
if( y > this.displayY && y <= this.displayY + this.height )
{
this.currentScroll = (y - this.displayY);
this.currentScroll = this.minScroll + ((this.currentScroll * 2 * this.getRange() / this.height));
this.currentScroll = (this.currentScroll + 1) >> 1;
this.currentScroll = ( y - this.displayY );
this.currentScroll = this.minScroll + ( ( this.currentScroll * 2 * this.getRange() / this.height ) );
this.currentScroll = ( this.currentScroll + 1 ) >> 1;
this.applyRange();
}
}
}
public void wheel(int delta)
public void wheel( int delta )
{
delta = Math.max( Math.min( -delta, 1 ), -1 );
this.currentScroll += delta * this.pageSize;
this.applyRange();
}
}
@@ -56,11 +56,11 @@ public class GuiTabButton extends GuiButton implements ITooltip
/**
* Using itemstack as an icon
*
* @param x x pos of button
* @param y y pos of button
* @param ico used icon
* @param x x pos of button
* @param y y pos of button
* @param ico used icon
* @param message mouse over message
* @param ir renderer
* @param ir renderer
*/
public GuiTabButton( int x, int y, ItemStack ico, String message, RenderItem ir )
{
@@ -77,7 +77,7 @@ public class GuiTabButton extends GuiButton implements ITooltip
@Override
public void drawButton( Minecraft minecraft, int x, int y )
{
if ( this.visible )
if( this.visible )
{
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
@@ -89,9 +89,9 @@ public class GuiTabButton extends GuiButton implements ITooltip
this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, 0, 25, 22 );
if ( this.myIcon >= 0 )
if( this.myIcon >= 0 )
{
int uv_y = ( int ) Math.floor( this.myIcon / 16 );
int uv_y = (int) Math.floor( this.myIcon / 16 );
uv_x = this.myIcon - uv_y * 16;
this.drawTexturedModalRect( offsetX + this.xPosition + 3, this.yPosition + 3, uv_x * 16, uv_y * 16, 16, 16 );
@@ -99,7 +99,7 @@ public class GuiTabButton extends GuiButton implements ITooltip
this.mouseDragged( minecraft, x, y );
if ( this.myItem != null )
if( this.myItem != null )
{
this.zLevel = 100.0F;
this.itemRenderer.zLevel = 100.0F;
@@ -62,7 +62,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip
@Override
public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
{
if ( this.visible )
if( this.visible )
{
int iconIndex = this.getIconIndex();
@@ -70,7 +70,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
int uv_y = ( int ) Math.floor( iconIndex / 16 );
int uv_y = (int) Math.floor( iconIndex / 16 );
int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16 );
@@ -87,23 +87,23 @@ public class GuiToggleButton extends GuiButton implements ITooltip
@Override
public String getMessage()
{
if ( this.displayName != null )
if( this.displayName != null )
{
String name = StatCollector.translateToLocal( this.displayName );
String value = StatCollector.translateToLocal( this.displayHint );
if ( name == null || name.isEmpty() )
if( name == null || name.isEmpty() )
name = this.displayName;
if ( value == null || value.isEmpty() )
if( value == null || value.isEmpty() )
value = this.displayHint;
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" );
if ( i <= 0 )
if( i <= 0 )
i = 0;
while ( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
while( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
{
sb.replace( i, i + 1, "\n" );
}
@@ -18,9 +18,9 @@
package appeng.client.gui.widgets;
public interface IScrollSource
{
int getCurrentScroll();
}
@@ -18,9 +18,11 @@
package appeng.client.gui.widgets;
import appeng.api.config.SortDir;
import appeng.api.config.ViewItems;
public interface ISortSource
{
@@ -38,5 +40,4 @@ public interface ISortSource
* @return {@link ViewItems}
*/
Enum getSortDisplay();
}
@@ -18,9 +18,9 @@
package appeng.client.gui.widgets;
/**
* AEBaseGui controlled Tooltip Interface.
*
*/
public interface ITooltip
{
@@ -64,5 +64,4 @@ public interface ITooltip
* @return true if button being drawn
*/
boolean isVisible();
}
@@ -22,6 +22,7 @@ package appeng.client.gui.widgets;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
/**
* A modified version of the Minecraft text field.
* You can initialize it over the full element span.
@@ -44,10 +45,10 @@ public class MEGuiTextField extends GuiTextField
* Pays attention to the '_' caret.
*
* @param fontRenderer renderer for the strings
* @param xPos absolute left position
* @param yPos absolute top position
* @param width absolute width
* @param height absolute height
* @param xPos absolute left position
* @param yPos absolute top position
* @param width absolute width
* @param height absolute height
*/
public MEGuiTextField( FontRenderer fontRenderer, int xPos, int yPos, int width, int height )
{
@@ -18,11 +18,13 @@
package appeng.client.me;
import net.minecraft.util.StatCollector;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.ItemSorters;
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
{
@@ -31,7 +33,8 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
final public long id;
final public long sortBy;
public ClientDCInternalInv(int size, long id, long sortBy, String unlocalizedName) {
public ClientDCInternalInv( int size, long id, long sortBy, String unlocalizedName )
{
this.inv = new AppEngInternalInventory( null, size );
this.unlocalizedName = unlocalizedName;
this.id = id;
@@ -41,15 +44,14 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
public String getName()
{
String s = StatCollector.translateToLocal( this.unlocalizedName + ".name" );
if ( s.equals( this.unlocalizedName + ".name" ) )
if( s.equals( this.unlocalizedName + ".name" ) )
return StatCollector.translateToLocal( this.unlocalizedName );
return s;
}
@Override
public int compareTo(ClientDCInternalInv o)
public int compareTo( ClientDCInternalInv o )
{
return ItemSorters.compareLong( this.sortBy, o.sortBy );
}
}
@@ -18,20 +18,22 @@
package appeng.client.me;
import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack;
public class InternalSlotME
{
private final ItemRepo repo;
public final int offset;
public final int xPos;
public final int yPos;
private final ItemRepo repo;
public InternalSlotME(ItemRepo def, int offset, int displayX, int displayY) {
public InternalSlotME( ItemRepo def, int offset, int displayX, int displayY )
{
this.repo = def;
this.offset = offset;
this.xPos = displayX;
+57 -59
View File
@@ -18,6 +18,7 @@
package appeng.client.me;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -44,6 +45,7 @@ import appeng.util.ItemSorters;
import appeng.util.Platform;
import appeng.util.prioitylist.IPartitionList;
public class ItemRepo
{
@@ -56,42 +58,45 @@ public class ItemRepo
public int rowSize = 9;
public String searchString = "";
IPartitionList<IAEItemStack> myPartitionList;
private String innerSearch = "";
private String NEIWord = null;
private boolean hasPower;
public ItemRepo(IScrollSource src, ISortSource sortSrc)
public ItemRepo( IScrollSource src, ISortSource sortSrc )
{
this.src = src;
this.sortSrc = sortSrc;
}
public IAEItemStack getReferenceItem(int idx)
public IAEItemStack getReferenceItem( int idx )
{
idx += this.src.getCurrentScroll() * this.rowSize;
if ( idx >= this.view.size() )
if( idx >= this.view.size() )
return null;
return this.view.get( idx );
}
public ItemStack getItem(int idx)
public ItemStack getItem( int idx )
{
idx += this.src.getCurrentScroll() * this.rowSize;
if ( idx >= this.dsp.size() )
if( idx >= this.dsp.size() )
return null;
return this.dsp.get( idx );
}
void setSearch(String search)
void setSearch( String search )
{
this.searchString = search == null ? "" : search;
}
public void postUpdate(IAEItemStack is)
public void postUpdate( IAEItemStack is )
{
IAEItemStack st = this.list.findPrecise( is );
if ( st != null )
if( st != null )
{
st.reset();
st.add( is );
@@ -100,40 +105,12 @@ public class ItemRepo
this.list.add( is );
}
IPartitionList<IAEItemStack> myPartitionList;
public void setViewCell(ItemStack[] list)
public void setViewCell( ItemStack[] list )
{
this.myPartitionList = ItemViewCell.createFilter( list );
this.updateView();
}
private String NEIWord = null;
private void updateNEI(String filter)
{
try
{
if ( this.NEIWord == null || !this.NEIWord.equals( filter ) )
{
Class c = ReflectionHelper.getClass( this.getClass().getClassLoader(), "codechicken.nei.LayoutManager" );
Field fldSearchField = c.getField( "searchField" );
Object searchField = fldSearchField.get( c );
Method a = searchField.getClass().getMethod( "setText", String.class );
Method b = searchField.getClass().getMethod( "onTextChange", String.class );
this.NEIWord = filter;
a.invoke( searchField, filter );
b.invoke( searchField, "" );
}
}
catch (Throwable ignore)
{
}
}
public void updateView()
{
this.view.clear();
@@ -144,7 +121,7 @@ public class ItemRepo
Enum viewMode = this.sortSrc.getSortDisplay();
Enum searchMode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
if ( searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH )
if( searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH )
this.updateNEI( this.searchString );
this.innerSearch = this.searchString;
@@ -152,7 +129,7 @@ public class ItemRepo
// boolean terminalSearchMods = Configuration.INSTANCE.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
boolean searchMod = false;
if ( this.innerSearch.startsWith( "@" ) )
if( this.innerSearch.startsWith( "@" ) )
{
searchMod = true;
this.innerSearch = this.innerSearch.substring( 1 );
@@ -163,52 +140,52 @@ public class ItemRepo
{
m = Pattern.compile( this.innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE );
}
catch (Throwable ignore)
catch( Throwable ignore )
{
try
{
m = Pattern.compile( Pattern.quote( this.innerSearch.toLowerCase() ), Pattern.CASE_INSENSITIVE );
}
catch (Throwable __)
catch( Throwable __ )
{
return;
}
}
boolean notDone = false;
for (IAEItemStack is : this.list)
for( IAEItemStack is : this.list )
{
if ( this.myPartitionList != null )
if( this.myPartitionList != null )
{
if ( !this.myPartitionList.isListed( is ) )
if( !this.myPartitionList.isListed( is ) )
continue;
}
if ( viewMode == ViewItems.CRAFTABLE && !is.isCraftable() )
if( viewMode == ViewItems.CRAFTABLE && !is.isCraftable() )
continue;
if ( viewMode == ViewItems.CRAFTABLE )
if( viewMode == ViewItems.CRAFTABLE )
{
is = is.copy();
is.setStackSize( 0 );
}
if ( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
if( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
continue;
String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is );
notDone = true;
if ( m.matcher( dspName.toLowerCase() ).find() )
if( m.matcher( dspName.toLowerCase() ).find() )
{
this.view.add( is );
notDone = false;
}
if ( terminalSearchToolTips && notDone )
if( terminalSearchToolTips && notDone )
{
for (Object lp : Platform.getTooltip( is ))
if ( lp instanceof String && m.matcher( (String) lp ).find() )
for( Object lp : Platform.getTooltip( is ) )
if( lp instanceof String && m.matcher( (String) lp ).find() )
{
this.view.add( is );
notDone = false;
@@ -228,19 +205,43 @@ public class ItemRepo
ItemSorters.Direction = (appeng.api.config.SortDir) SortDir;
ItemSorters.init();
if ( SortBy == SortOrder.MOD )
if( SortBy == SortOrder.MOD )
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_MOD );
else if ( SortBy == SortOrder.AMOUNT )
else if( SortBy == SortOrder.AMOUNT )
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_SIZE );
else if ( SortBy == SortOrder.INVTWEAKS )
else if( SortBy == SortOrder.INVTWEAKS )
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS );
else
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_NAME );
for (IAEItemStack is : this.view)
for( IAEItemStack is : this.view )
this.dsp.add( is.getItemStack() );
}
private void updateNEI( String filter )
{
try
{
if( this.NEIWord == null || !this.NEIWord.equals( filter ) )
{
Class c = ReflectionHelper.getClass( this.getClass().getClassLoader(), "codechicken.nei.LayoutManager" );
Field fldSearchField = c.getField( "searchField" );
Object searchField = fldSearchField.get( c );
Method a = searchField.getClass().getMethod( "setText", String.class );
Method b = searchField.getClass().getMethod( "onTextChange", String.class );
this.NEIWord = filter;
a.invoke( searchField, filter );
b.invoke( searchField, "" );
}
}
catch( Throwable ignore )
{
}
}
public int size()
{
return this.view.size();
@@ -251,16 +252,13 @@ public class ItemRepo
this.list.resetStatus();
}
private boolean hasPower;
public boolean hasPower()
{
return this.hasPower;
}
public void setPower(boolean hasPower)
public void setPower( boolean hasPower )
{
this.hasPower = hasPower;
}
}
@@ -18,6 +18,7 @@
package appeng.client.me;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -26,27 +27,47 @@ import appeng.container.slot.AppEngSlot;
import appeng.items.misc.ItemEncodedPattern;
import appeng.util.Platform;
public class SlotDisconnected extends AppEngSlot
{
public final ClientDCInternalInv mySlot;
public SlotDisconnected(ClientDCInternalInv me, int which, int x, int y) {
public SlotDisconnected( ClientDCInternalInv me, int which, int x, int y )
{
super( me.inv, which, x, y );
this.mySlot = me;
}
@Override
public boolean isItemValid( ItemStack par1ItemStack )
{
return false;
}
@Override
public void putStack( ItemStack par1ItemStack )
{
}
@Override
public boolean canTakeStack( EntityPlayer par1EntityPlayer )
{
return false;
}
@Override
public ItemStack getDisplayStack()
{
if ( Platform.isClient() )
if( Platform.isClient() )
{
ItemStack is = super.getStack();
if ( is != null && is.getItem() instanceof ItemEncodedPattern )
if( is != null && is.getItem() instanceof ItemEncodedPattern )
{
ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
ItemStack out = iep.getOutput( is );
if ( out != null )
if( out != null )
return out;
}
}
@@ -54,21 +75,8 @@ public class SlotDisconnected extends AppEngSlot
}
@Override
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
public void onPickupFromSlot( EntityPlayer par1EntityPlayer, ItemStack par2ItemStack )
{
return false;
}
@Override
public ItemStack decrStackSize(int par1)
{
return null;
}
@Override
public void putStack(ItemStack par1ItemStack)
{
}
@Override
@@ -77,12 +85,6 @@ public class SlotDisconnected extends AppEngSlot
return this.getStack() != null;
}
@Override
public boolean isItemValid(ItemStack par1ItemStack)
{
return false;
}
@Override
public int getSlotStackLimit()
{
@@ -90,14 +92,14 @@ public class SlotDisconnected extends AppEngSlot
}
@Override
public boolean isSlotInInventory(IInventory par1iInventory, int par2)
public ItemStack decrStackSize( int par1 )
{
return false;
return null;
}
@Override
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
public boolean isSlotInInventory( IInventory par1iInventory, int par2 )
{
return false;
}
}
+26 -24
View File
@@ -18,6 +18,7 @@
package appeng.client.me;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
@@ -25,61 +26,56 @@ import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack;
public class SlotME extends Slot
{
public final InternalSlotME mySlot;
public SlotME(InternalSlotME me) {
public SlotME( InternalSlotME me )
{
super( null, 0, me.xPos, me.yPos );
this.mySlot = me;
}
@Override
public ItemStack getStack()
{
if ( this.mySlot.hasPower() )
return this.mySlot.getStack();
return null;
}
public IAEItemStack getAEStack()
{
if ( this.mySlot.hasPower() )
if( this.mySlot.hasPower() )
return this.mySlot.getAEStack();
return null;
}
@Override
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
public void onPickupFromSlot( EntityPlayer par1EntityPlayer, ItemStack par2ItemStack )
{
}
@Override
public boolean isItemValid( ItemStack par1ItemStack )
{
return false;
}
@Override
public ItemStack decrStackSize(int par1)
public ItemStack getStack()
{
if( this.mySlot.hasPower() )
return this.mySlot.getStack();
return null;
}
@Override
public void putStack(ItemStack par1ItemStack)
{
}
@Override
public boolean getHasStack()
{
if ( this.mySlot.hasPower() )
if( this.mySlot.hasPower() )
return this.getStack() != null;
return false;
}
@Override
public boolean isItemValid(ItemStack par1ItemStack)
public void putStack( ItemStack par1ItemStack )
{
return false;
}
@Override
@@ -89,14 +85,20 @@ public class SlotME extends Slot
}
@Override
public boolean isSlotInInventory(IInventory par1iInventory, int par2)
public ItemStack decrStackSize( int par1 )
{
return null;
}
@Override
public boolean isSlotInInventory( IInventory par1iInventory, int par2 )
{
return false;
}
@Override
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
public boolean canTakeStack( EntityPlayer par1EntityPlayer )
{
return false;
}
}
@@ -109,6 +109,17 @@ public class AppEngRenderItem extends RenderItem
}
}
private void renderQuad( Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6 )
{
par1Tessellator.startDrawingQuads();
par1Tessellator.setColorOpaque_I( par6 );
par1Tessellator.addVertex( par2, par3, 0.0D );
par1Tessellator.addVertex( par2, par3 + par5, 0.0D );
par1Tessellator.addVertex( par2 + par4, par3 + par5, 0.0D );
par1Tessellator.addVertex( par2 + par4, par3, 0.0D );
par1Tessellator.draw();
}
private String getToBeRenderedStackSize( long originalSize )
{
if( AEConfig.instance.useTerminalUseLargeFont() )
@@ -120,15 +131,4 @@ public class AppEngRenderItem extends RenderItem
return NUMBER_CONVERTER.toHumanReadableForm( originalSize );
}
}
private void renderQuad( Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6 )
{
par1Tessellator.startDrawingQuads();
par1Tessellator.setColorOpaque_I( par6 );
par1Tessellator.addVertex( par2, par3, 0.0D );
par1Tessellator.addVertex( par2, par3 + par5, 0.0D );
par1Tessellator.addVertex( par2 + par4, par3 + par5, 0.0D );
par1Tessellator.addVertex( par2 + par4, par3, 0.0D );
par1Tessellator.draw();
}
}
@@ -21,7 +21,6 @@ package appeng.client.render;
import java.nio.FloatBuffer;
import java.util.EnumSet;
import javax.annotation.Nullable;
import org.lwjgl.BufferUtils;
@@ -287,9 +286,9 @@ public class BaseBlockRender
Tessellator tess = Tessellator.instance;
BlockRenderInfo info = block.getRendererInstance();
if ( info.isValid() )
if( info.isValid() )
{
if ( block.hasSubtypes() )
if( block.hasSubtypes() )
block.setRenderStateByMeta( item.getItemDamage() );
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, ForgeDirection.SOUTH, ForgeDirection.UP ) );
@@ -304,7 +303,7 @@ public class BaseBlockRender
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), block, item, tess, 0xffffff, renderer );
if ( block.hasSubtypes() )
if( block.hasSubtypes() )
info.setTemporaryRenderIcon( null );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
@@ -312,7 +311,7 @@ public class BaseBlockRender
static public int getOrientation( ForgeDirection in, ForgeDirection forward, ForgeDirection up )
{
if ( in == null || in == ForgeDirection.UNKNOWN // 1
if( in == null || in == ForgeDirection.UNKNOWN // 1
|| forward == null || forward == ForgeDirection.UNKNOWN // 2
|| up == null || up == ForgeDirection.UNKNOWN )
return 0;
@@ -326,14 +325,14 @@ public class BaseBlockRender
public void renderInvBlock( EnumSet<ForgeDirection> sides, AEBaseBlock block, ItemStack item, Tessellator tess, int color, RenderBlocks renderer )
{
if ( Platform.isDrawing( tess ) )
if( Platform.isDrawing( tess ) )
tess.draw();
int meta = 0;
if ( block != null && block.hasSubtypes() && item != null )
if( block != null && block.hasSubtypes() && item != null )
meta = item.getItemDamage();
if ( sides.contains( ForgeDirection.DOWN ) )
if( sides.contains( ForgeDirection.DOWN ) )
{
tess.startDrawingQuads();
tess.setNormal( 0.0F, -1.0F, 0.0F );
@@ -342,7 +341,7 @@ public class BaseBlockRender
tess.draw();
}
if ( sides.contains( ForgeDirection.UP ) )
if( sides.contains( ForgeDirection.UP ) )
{
tess.startDrawingQuads();
tess.setNormal( 0.0F, 1.0F, 0.0F );
@@ -351,7 +350,7 @@ public class BaseBlockRender
tess.draw();
}
if ( sides.contains( ForgeDirection.NORTH ) )
if( sides.contains( ForgeDirection.NORTH ) )
{
tess.startDrawingQuads();
tess.setNormal( 0.0F, 0.0F, -1.0F );
@@ -360,7 +359,7 @@ public class BaseBlockRender
tess.draw();
}
if ( sides.contains( ForgeDirection.SOUTH ) )
if( sides.contains( ForgeDirection.SOUTH ) )
{
tess.startDrawingQuads();
tess.setNormal( 0.0F, 0.0F, 1.0F );
@@ -369,7 +368,7 @@ public class BaseBlockRender
tess.draw();
}
if ( sides.contains( ForgeDirection.WEST ) )
if( sides.contains( ForgeDirection.WEST ) )
{
tess.startDrawingQuads();
tess.setNormal( -1.0F, 0.0F, 0.0F );
@@ -378,7 +377,7 @@ public class BaseBlockRender
tess.draw();
}
if ( sides.contains( ForgeDirection.EAST ) )
if( sides.contains( ForgeDirection.EAST ) )
{
tess.startDrawingQuads();
tess.setNormal( 1.0F, 0.0F, 0.0F );
@@ -390,8 +389,8 @@ public class BaseBlockRender
public IIcon firstNotNull( IIcon... s )
{
for ( IIcon o : s )
if ( o != null )
for( IIcon o : s )
if( o != null )
return o;
return ExtraBlockTextures.getMissing();
}
@@ -413,7 +412,7 @@ public class BaseBlockRender
BlockRenderInfo info = block.getRendererInstance();
IOrientable te = this.getOrientable( block, world, x, y, z );
if ( te != null )
if( te != null )
{
forward = te.getForward();
up = te.getUp();
@@ -437,9 +436,9 @@ public class BaseBlockRender
@Nullable
public IOrientable getOrientable( AEBaseBlock block, IBlockAccess w, int x, int y, int z )
{
if ( block.hasBlockTileEntity() )
if( block.hasBlockTileEntity() )
return (AEBaseTile) block.getTileEntity( w, x, y, z );
else if ( block instanceof IOrientableBlock )
else if( block instanceof IOrientableBlock )
return ( (IOrientableBlock) block ).getOrientable( w, x, y, z );
return null;
}
@@ -472,19 +471,19 @@ public class BaseBlockRender
double bY = maxX * x.offsetY + maxY * y.offsetY + maxZ * z.offsetY;
double bZ = maxX * x.offsetZ + maxY * y.offsetZ + maxZ * z.offsetZ;
if ( x.offsetX + y.offsetX + z.offsetX < 0 )
if( x.offsetX + y.offsetX + z.offsetX < 0 )
{
aX += 1;
bX += 1;
}
if ( x.offsetY + y.offsetY + z.offsetY < 0 )
if( x.offsetY + y.offsetY + z.offsetY < 0 )
{
aY += 1;
bY += 1;
}
if ( x.offsetZ + y.offsetZ + z.offsetZ < 0 )
if( x.offsetZ + y.offsetZ + z.offsetZ < 0 )
{
aZ += 1;
bZ += 1;
@@ -514,7 +513,7 @@ public class BaseBlockRender
double layerBZ = 0.0;
boolean flip = false;
switch ( orientation )
switch( orientation )
{
case NORTH:
@@ -594,7 +593,7 @@ public class BaseBlockRender
@SideOnly( Side.CLIENT )
private void renderFace( Tessellator tess, double offsetX, double offsetY, double offsetZ, double ax, double ay, double az, double bx, double by, double bz, double ua, double ub, double va, double vb, IIcon ico, boolean flip )
{
if ( flip )
if( flip )
{
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
@@ -613,7 +612,7 @@ public class BaseBlockRender
@SideOnly( Side.CLIENT )
protected void renderFace( int x, int y, int z, Block block, IIcon ico, RenderBlocks renderer, ForgeDirection orientation )
{
switch ( orientation )
switch( orientation )
{
case NORTH:
renderer.renderFaceZNeg( block, x, y, z, ico );
@@ -663,10 +662,10 @@ public class BaseBlockRender
private double mapFaceUV( int offset, int uv )
{
if ( offset == 0 )
if( offset == 0 )
return 0;
if ( offset > 0 )
if( offset > 0 )
return uv / 16.0;
return ( 16.0 - uv ) / 16.0;
@@ -684,7 +683,7 @@ public class BaseBlockRender
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
RenderHelper.disableStandardItemLighting();
if ( Minecraft.isAmbientOcclusionEnabled() )
if( Minecraft.isAmbientOcclusionEnabled() )
GL11.glShadeModel( GL11.GL_SMOOTH );
else
GL11.glShadeModel( GL11.GL_FLAT );
@@ -707,12 +706,12 @@ public class BaseBlockRender
protected void applyTESRRotation( double x, double y, double z, ForgeDirection forward, ForgeDirection up )
{
if ( forward != null && up != null )
if( forward != null && up != null )
{
if ( forward == ForgeDirection.UNKNOWN )
if( forward == ForgeDirection.UNKNOWN )
forward = ForgeDirection.SOUTH;
if ( up == ForgeDirection.UNKNOWN )
if( up == ForgeDirection.UNKNOWN )
up = ForgeDirection.UP;
ForgeDirection west = Platform.crossProduct( forward, up );
@@ -749,7 +748,7 @@ public class BaseBlockRender
public void doRenderItem( ItemStack itemstack, TileEntity par1EntityItemFrame )
{
if ( itemstack != null )
if( itemstack != null )
{
EntityItem entityitem = new EntityItem( par1EntityItemFrame.getWorldObj(), 0.0D, 0.0D, 0.0D, itemstack );
entityitem.getEntityItem().stackSize = 1;
@@ -18,29 +18,25 @@
package appeng.client.render;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.client.texture.FlippableIcon;
import appeng.client.texture.TmpFlippableIcon;
public class BlockRenderInfo
{
public BlockRenderInfo(BaseBlockRender inst) {
this.rendererInstance = inst;
}
final public BaseBlockRender rendererInstance;
private boolean useTmp = false;
private final TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpNorthIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpEastIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpWestIcon = new TmpFlippableIcon();
private boolean useTmp = false;
private FlippableIcon topIcon = null;
private FlippableIcon bottomIcon = null;
private FlippableIcon southIcon = null;
@@ -48,7 +44,12 @@ public class BlockRenderInfo
private FlippableIcon eastIcon = null;
private FlippableIcon westIcon = null;
public void updateIcons(FlippableIcon Bottom, FlippableIcon Top, FlippableIcon North, FlippableIcon South, FlippableIcon East, FlippableIcon West)
public BlockRenderInfo( BaseBlockRender inst )
{
this.rendererInstance = inst;
}
public void updateIcons( FlippableIcon Bottom, FlippableIcon Top, FlippableIcon North, FlippableIcon South, FlippableIcon East, FlippableIcon West )
{
this.topIcon = Top;
this.bottomIcon = Bottom;
@@ -56,12 +57,11 @@ public class BlockRenderInfo
this.northIcon = North;
this.eastIcon = East;
this.westIcon = West;
}
public void setTemporaryRenderIcon(IIcon IIcon)
public void setTemporaryRenderIcon( IIcon IIcon )
{
if ( IIcon == null )
if( IIcon == null )
this.useTmp = false;
else
{
@@ -75,7 +75,7 @@ public class BlockRenderInfo
}
}
public void setTemporaryRenderIcons(IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, IIcon nWestIcon)
public void setTemporaryRenderIcons( IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, IIcon nWestIcon )
{
this.tmpTopIcon.setOriginal( nTopIcon == null ? this.getTexture( ForgeDirection.UP ) : nTopIcon );
this.tmpBottomIcon.setOriginal( nBottomIcon == null ? this.getTexture( ForgeDirection.DOWN ) : nBottomIcon );
@@ -86,45 +86,45 @@ public class BlockRenderInfo
this.useTmp = true;
}
public FlippableIcon getTexture(ForgeDirection dir)
public FlippableIcon getTexture( ForgeDirection dir )
{
if ( this.useTmp )
if( this.useTmp )
{
switch (dir)
switch( dir )
{
case DOWN:
return this.tmpBottomIcon;
case UP:
return this.tmpTopIcon;
case NORTH:
return this.tmpNorthIcon;
case SOUTH:
return this.tmpSouthIcon;
case EAST:
return this.tmpEastIcon;
case WEST:
return this.tmpWestIcon;
default:
break;
case DOWN:
return this.tmpBottomIcon;
case UP:
return this.tmpTopIcon;
case NORTH:
return this.tmpNorthIcon;
case SOUTH:
return this.tmpSouthIcon;
case EAST:
return this.tmpEastIcon;
case WEST:
return this.tmpWestIcon;
default:
break;
}
}
switch (dir)
switch( dir )
{
case DOWN:
return this.bottomIcon;
case UP:
return this.topIcon;
case NORTH:
return this.northIcon;
case SOUTH:
return this.southIcon;
case EAST:
return this.eastIcon;
case WEST:
return this.westIcon;
default:
break;
case DOWN:
return this.bottomIcon;
case UP:
return this.topIcon;
case NORTH:
return this.northIcon;
case SOUTH:
return this.southIcon;
case EAST:
return this.eastIcon;
case WEST:
return this.westIcon;
default:
break;
}
return this.topIcon;
@@ -134,5 +134,4 @@ public class BlockRenderInfo
{
return this.topIcon != null && this.bottomIcon != null && this.southIcon != null && this.northIcon != null && this.eastIcon != null && this.westIcon != null;
}
}
@@ -89,7 +89,7 @@ public final class BusRenderHelper implements IPartRenderHelper
this.az = ForgeDirection.SOUTH;
this.ay = ForgeDirection.UP;
this.color = HEX_WHITE;
this.maybeBlock = AEApi.instance().definitions().blocks().multiPart().maybeBlock();
this.maybeBlock = AEApi.instance().definitions().blocks().multiPart().maybeBlock();
this.maybeBaseBlock = this.maybeBlock.transform( new BaseBlockTransformFunction() );
}
@@ -107,7 +107,7 @@ public final class BusRenderHelper implements IPartRenderHelper
public double getBound( ForgeDirection side )
{
switch ( side )
switch( side )
{
default:
case UNKNOWN:
@@ -129,7 +129,7 @@ public final class BusRenderHelper implements IPartRenderHelper
public void setRenderColor( int color )
{
for ( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
{
final BlockCableBus cableBus = (BlockCableBus) block;
cableBus.setRenderColor( color );
@@ -150,7 +150,7 @@ public final class BusRenderHelper implements IPartRenderHelper
public void setBounds( double[] bounds )
{
if ( bounds == null || bounds.length != 6 )
if( bounds == null || bounds.length != 6 )
return;
this.minX = bounds[0];
@@ -161,7 +161,6 @@ public final class BusRenderHelper implements IPartRenderHelper
this.maxZ = bounds[5];
}
private static class BoundBoxCalculator implements IPartCollisionHelper
{
private final BusRenderHelper helper;
@@ -183,7 +182,7 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public void addBox( double minX, double minY, double minZ, double maxX, double maxY, double maxZ )
{
if ( this.started )
if( this.started )
{
this.minX = Math.min( this.minX, (float) minX );
this.minY = Math.min( this.minY, (float) minY );
@@ -227,17 +226,33 @@ public final class BusRenderHelper implements IPartRenderHelper
{
return false;
}
} @Override
}
private static final class BaseBlockTransformFunction implements Function<Block, AEBaseBlock>
{
@Nullable
@Override
public AEBaseBlock apply( Block input )
{
if( input instanceof AEBaseBlock )
{
return ( (AEBaseBlock) input );
}
return null;
}
}
@Override
public void renderForPass( int pass )
{
this.renderingForPass = pass;
}
public boolean renderThis()
{
if ( this.renderingForPass == this.currentPass || this.noAlphaPass )
if( this.renderingForPass == this.currentPass || this.noAlphaPass )
{
this.itemsRendered++;
return true;
@@ -259,7 +274,7 @@ public final class BusRenderHelper implements IPartRenderHelper
{
RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.renderer;
if ( sim != null && this.maybeBlock.isPresent() && rbw.similarLighting( this.maybeBlock.get(), rbw.blockAccess, x, y, z, sim ) )
if( sim != null && this.maybeBlock.isPresent() && rbw.similarLighting( this.maybeBlock.get(), rbw.blockAccess, x, y, z, sim ) )
{
rbw.populate( sim );
rbw.faces = EnumSet.allOf( ForgeDirection.class );
@@ -276,7 +291,7 @@ public final class BusRenderHelper implements IPartRenderHelper
rbw.faces.clear();
this.bbc.started = false;
if ( p == null )
if( p == null )
{
this.bbc.minX = this.bbc.minY = this.bbc.minZ = 0;
this.bbc.maxX = this.bbc.maxY = this.bbc.maxZ = 16;
@@ -285,18 +300,18 @@ public final class BusRenderHelper implements IPartRenderHelper
{
p.getBoxes( this.bbc );
if ( this.bbc.minX < 1 )
if( this.bbc.minX < 1 )
this.bbc.minX = 1;
if ( this.bbc.minY < 1 )
if( this.bbc.minY < 1 )
this.bbc.minY = 1;
if ( this.bbc.minZ < 1 )
if( this.bbc.minZ < 1 )
this.bbc.minZ = 1;
if ( this.bbc.maxX > 15 )
if( this.bbc.maxX > 15 )
this.bbc.maxX = 15;
if ( this.bbc.maxY > 15 )
if( this.bbc.maxY > 15 )
this.bbc.maxY = 15;
if ( this.bbc.maxZ > 15 )
if( this.bbc.maxZ > 15 )
this.bbc.maxZ = 15;
}
@@ -304,7 +319,7 @@ public final class BusRenderHelper implements IPartRenderHelper
this.bbr.renderBlockBounds( rbw, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
for ( Block block : this.maybeBlock.asSet() )
for( Block block : this.maybeBlock.asSet() )
{
rbw.renderStandardBlock( block, x, y, z );
}
@@ -338,7 +353,7 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public void setTexture( IIcon ico )
{
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
{
baseBlock.getRendererInstance().setTemporaryRenderIcon( ico );
}
@@ -356,7 +371,7 @@ public final class BusRenderHelper implements IPartRenderHelper
list[4] = West;
list[5] = East;
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
{
baseBlock.getRendererInstance().setTemporaryRenderIcons( list[this.mapRotation( ForgeDirection.UP ).ordinal()], list[this.mapRotation( ForgeDirection.DOWN ).ordinal()], list[this.mapRotation( ForgeDirection.SOUTH ).ordinal()], list[this.mapRotation( ForgeDirection.NORTH ).ordinal()], list[this.mapRotation( ForgeDirection.EAST ).ordinal()], list[this.mapRotation( ForgeDirection.WEST ).ordinal()] );
}
@@ -368,30 +383,30 @@ public final class BusRenderHelper implements IPartRenderHelper
ForgeDirection up = this.ay;
ForgeDirection west = ForgeDirection.UNKNOWN;
if ( forward == null || up == null )
if( forward == null || up == null )
return dir;
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
for ( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS )
if ( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
for( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS )
if( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
west = dx;
if ( dir == forward )
if( dir == forward )
return ForgeDirection.SOUTH;
if ( dir == forward.getOpposite() )
if( dir == forward.getOpposite() )
return ForgeDirection.NORTH;
if ( dir == up )
if( dir == up )
return ForgeDirection.UP;
if ( dir == up.getOpposite() )
if( dir == up.getOpposite() )
return ForgeDirection.DOWN;
if ( dir == west )
if( dir == west )
return ForgeDirection.WEST;
if ( dir == west.getOpposite() )
if( dir == west.getOpposite() )
return ForgeDirection.EAST;
return ForgeDirection.UNKNOWN;
@@ -402,7 +417,7 @@ public final class BusRenderHelper implements IPartRenderHelper
{
renderer.setRenderBounds( this.minX / 16.0, this.minY / 16.0, this.minZ / 16.0, this.maxX / 16.0, this.maxY / 16.0, this.maxZ / 16.0 );
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
{
this.bbr.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), baseBlock, null, Tessellator.instance, this.color, renderer );
}
@@ -414,7 +429,7 @@ public final class BusRenderHelper implements IPartRenderHelper
renderer.setRenderBounds( this.minX / 16.0, this.minY / 16.0, this.minZ / 16.0, this.maxX / 16.0, this.maxY / 16.0, this.maxZ / 16.0 );
this.setTexture( IIcon );
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
{
this.bbr.renderInvBlock( EnumSet.of( face ), baseBlock, null, Tessellator.instance, this.color, renderer );
}
@@ -423,10 +438,10 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public void renderBlock( int x, int y, int z, RenderBlocks renderer )
{
if ( !this.renderThis() )
if( !this.renderThis() )
return;
for ( Block multiPart : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
for( Block multiPart : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
{
final AEBaseBlock block = (AEBaseBlock) multiPart;
@@ -452,7 +467,7 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public Block getBlock()
{
for ( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
{
return block;
}
@@ -474,10 +489,10 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public void renderBlockCurrentBounds( int x, int y, int z, RenderBlocks renderer )
{
if ( !this.renderThis() )
if( !this.renderThis() )
return;
for ( Block block : this.maybeBlock.asSet() )
for( Block block : this.maybeBlock.asSet() )
{
renderer.renderStandardBlock( block, x, y, z );
}
@@ -486,10 +501,10 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public void renderFaceCutout( int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer )
{
if ( !this.renderThis() )
if( !this.renderThis() )
return;
switch ( face )
switch( face )
{
case DOWN:
face = this.ay.getOpposite();
@@ -515,7 +530,7 @@ public final class BusRenderHelper implements IPartRenderHelper
break;
}
for ( Block block : this.maybeBlock.asSet() )
for( Block block : this.maybeBlock.asSet() )
{
this.bbr.renderCutoutFace( block, ico, x, y, z, renderer, face, edgeThickness );
}
@@ -524,11 +539,11 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public void renderFace( int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer )
{
if ( !this.renderThis() )
if( !this.renderThis() )
return;
this.prepareBounds( renderer );
switch ( face )
switch( face )
{
case DOWN:
face = this.ay.getOpposite();
@@ -554,7 +569,7 @@ public final class BusRenderHelper implements IPartRenderHelper
break;
}
for ( Block block : this.maybeBlock.asSet() )
for( Block block : this.maybeBlock.asSet() )
{
this.bbr.renderFace( x, y, z, block, ico, renderer, face );
}
@@ -577,19 +592,4 @@ public final class BusRenderHelper implements IPartRenderHelper
{
return this.az;
}
private static final class BaseBlockTransformFunction implements Function<Block, AEBaseBlock>
{
@Nullable
@Override
public AEBaseBlock apply( Block input )
{
if ( input instanceof AEBaseBlock )
{
return ( (AEBaseBlock) input );
}
return null;
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.render;
import java.util.HashMap;
import java.util.Map;
@@ -42,46 +43,31 @@ import appeng.core.features.AEFeature;
import appeng.facade.IFacadeItem;
import appeng.util.Platform;
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
public class BusRenderer implements IItemRenderer
{
public static final BusRenderer INSTANCE = new BusRenderer();
public final RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
private static final Map<Integer, IPart> RENDER_PART = new HashMap<Integer, IPart>();
public IPart getRenderer(ItemStack is, IPartItem c)
{
int id = (Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET) | is.getItemDamage();
IPart part = RENDER_PART.get( id );
if ( part == null )
{
part = c.createPartFromItemStack( is );
if ( part != null )
RENDER_PART.put( id, part );
}
return part;
}
public final RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
public boolean handleRenderType( ItemStack item, ItemRenderType type )
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
{
if ( item == null )
if( item == null )
return;
GL11.glPushMatrix();
@@ -90,8 +76,7 @@ public class BusRenderer implements IItemRenderer
GL11.glEnable( GL11.GL_TEXTURE_2D );
GL11.glEnable( GL11.GL_LIGHTING );
if ( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) && item.getItem() instanceof IAlphaPassItem
&& ((IAlphaPassItem) item.getItem()).useAlphaPass( item ) )
if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) && item.getItem() instanceof IAlphaPassItem && ( (IAlphaPassItem) item.getItem() ).useAlphaPass( item ) )
{
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
@@ -105,19 +90,19 @@ public class BusRenderer implements IItemRenderer
GL11.glDisable( GL11.GL_BLEND );
}
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
{
GL11.glTranslatef( -0.2f, -0.1f, -0.3f );
}
if ( type == ItemRenderType.ENTITY )
if( type == ItemRenderType.ENTITY )
{
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
GL11.glScalef( 0.8f, 0.8f, 0.8f );
GL11.glTranslatef( -0.8f, -0.87f, -0.7f );
}
if ( type == ItemRenderType.INVENTORY )
if( type == ItemRenderType.INVENTORY )
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
GL11.glTranslated( 0.2, 0.3, 0.1 );
@@ -138,29 +123,29 @@ public class BusRenderer implements IItemRenderer
this.renderer.useInventoryTint = false;
this.renderer.overrideBlockTexture = null;
if ( item.getItem() instanceof IFacadeItem )
if( item.getItem() instanceof IFacadeItem )
{
IFacadeItem fi = (IFacadeItem) item.getItem();
IFacadePart fp = fi.createPartFromItemStack( item, ForgeDirection.SOUTH );
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
{
GL11.glRotatef( 160.0f, 0.0f, 1.0f, 0.0f );
GL11.glTranslated( -0.4, 0.1, -1.6 );
}
if ( fp != null )
if( fp != null )
fp.renderInventory( BusRenderHelper.INSTANCE, this.renderer );
}
else
{
IPart ip = this.getRenderer( item, (IPartItem) item.getItem() );
if ( ip != null )
if( ip != null )
{
if ( type == ItemRenderType.ENTITY )
if( type == ItemRenderType.ENTITY )
{
int depth = ip.cableConnectionRenderTo();
GL11.glTranslatef( 0.0f, 0.0f, -0.04f * (8 - depth) - 0.06f );
GL11.glTranslatef( 0.0f, 0.0f, -0.04f * ( 8 - depth ) - 0.06f );
}
ip.renderInventory( BusRenderHelper.INSTANCE, this.renderer );
@@ -172,4 +157,19 @@ public class BusRenderer implements IItemRenderer
GL11.glPopAttrib();
GL11.glPopMatrix();
}
public IPart getRenderer( ItemStack is, IPartItem c )
{
int id = ( Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET ) | is.getItemDamage();
IPart part = RENDER_PART.get( id );
if( part == null )
{
part = c.createPartFromItemStack( is );
if( part != null )
RENDER_PART.put( id, part );
}
return part;
}
}
@@ -18,6 +18,7 @@
package appeng.client.render;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
@@ -33,6 +34,7 @@ import appeng.api.parts.IPart;
import appeng.parts.BusCollisionHelper;
import appeng.parts.CableBusContainer;
public class CableRenderHelper
{
@@ -43,70 +45,21 @@ public class CableRenderHelper
return INSTANCE;
}
private void setSide(ForgeDirection s)
{
ForgeDirection ax;
ForgeDirection ay;
ForgeDirection az;
switch (s)
{
case DOWN:
ax = ForgeDirection.EAST;
ay = ForgeDirection.NORTH;
az = ForgeDirection.DOWN;
break;
case UP:
ax = ForgeDirection.EAST;
ay = ForgeDirection.SOUTH;
az = ForgeDirection.UP;
break;
case EAST:
ax = ForgeDirection.SOUTH;
ay = ForgeDirection.UP;
az = ForgeDirection.EAST;
break;
case WEST:
ax = ForgeDirection.NORTH;
ay = ForgeDirection.UP;
az = ForgeDirection.WEST;
break;
case NORTH:
ax = ForgeDirection.WEST;
ay = ForgeDirection.UP;
az = ForgeDirection.NORTH;
break;
case SOUTH:
ax = ForgeDirection.EAST;
ay = ForgeDirection.UP;
az = ForgeDirection.SOUTH;
break;
case UNKNOWN:
default:
ax = ForgeDirection.EAST;
ay = ForgeDirection.UP;
az = ForgeDirection.SOUTH;
break;
}
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
}
public void renderStatic(CableBusContainer cableBusContainer, IFacadeContainer iFacadeContainer)
public void renderStatic( CableBusContainer cableBusContainer, IFacadeContainer iFacadeContainer )
{
TileEntity te = cableBusContainer.getTile();
RenderBlocksWorkaround renderer = BusRenderer.INSTANCE.renderer;
if ( renderer.overrideBlockTexture != null )
if( renderer.overrideBlockTexture != null )
BusRenderHelper.INSTANCE.setPass( 0 );
if ( renderer.blockAccess == null )
if( renderer.blockAccess == null )
renderer.blockAccess = Minecraft.getMinecraft().theWorld;
for (ForgeDirection s : ForgeDirection.values())
for( ForgeDirection s : ForgeDirection.values() )
{
IPart part = cableBusContainer.getPart( s );
if ( part != null )
if( part != null )
{
this.setSide( s );
renderer.renderAllFaces = true;
@@ -122,16 +75,16 @@ public class CableRenderHelper
}
}
if ( !iFacadeContainer.isEmpty() )
if( !iFacadeContainer.isEmpty() )
{
/**
* snag list of boxes...
*/
List<AxisAlignedBB> boxes = new ArrayList<AxisAlignedBB>();
for (ForgeDirection s : ForgeDirection.values())
for( ForgeDirection s : ForgeDirection.values() )
{
IPart part = cableBusContainer.getPart( s );
if ( part != null )
if( part != null )
{
this.setSide( s );
BusRenderHelper brh = BusRenderHelper.INSTANCE;
@@ -144,7 +97,7 @@ public class CableRenderHelper
double min = 2.0 / 16.0;
double max = 14.0 / 16.0;
for (AxisAlignedBB bb : boxes)
for( AxisAlignedBB bb : boxes )
{
int o = 0;
o += bb.maxX > max ? 1 : 0;
@@ -154,23 +107,23 @@ public class CableRenderHelper
o += bb.minY < min ? 1 : 0;
o += bb.minZ < min ? 1 : 0;
if ( o >= 2 )
if( o >= 2 )
useThinFacades = true;
}
for (ForgeDirection s : ForgeDirection.VALID_DIRECTIONS)
for( ForgeDirection s : ForgeDirection.VALID_DIRECTIONS )
{
IFacadePart fPart = iFacadeContainer.getFacade( s );
if ( fPart != null )
if( fPart != null )
{
AxisAlignedBB b = null;
fPart.setThinFacades( useThinFacades );
AxisAlignedBB pb = fPart.getPrimaryBox();
for (AxisAlignedBB bb : boxes)
for( AxisAlignedBB bb : boxes )
{
if ( bb.intersectsWith( pb ) )
if( bb.intersectsWith( pb ) )
{
if ( b == null )
if( b == null )
b = bb;
else
{
@@ -188,8 +141,7 @@ public class CableRenderHelper
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
this.setSide( s );
fPart.renderStatic( te.xCoord, te.yCoord, te.zCoord, BusRenderHelper.INSTANCE, renderer, iFacadeContainer, b,
cableBusContainer.getPart( s ) == null );
fPart.renderStatic( te.xCoord, te.yCoord, te.zCoord, BusRenderHelper.INSTANCE, renderer, iFacadeContainer, b, cableBusContainer.getPart( s ) == null );
}
}
@@ -200,55 +152,104 @@ public class CableRenderHelper
}
}
public void renderDynamic(CableBusContainer cableBusContainer, double x, double y, double z)
private void setSide( ForgeDirection s )
{
for (ForgeDirection s : ForgeDirection.values())
ForgeDirection ax;
ForgeDirection ay;
ForgeDirection az;
switch( s )
{
case DOWN:
ax = ForgeDirection.EAST;
ay = ForgeDirection.NORTH;
az = ForgeDirection.DOWN;
break;
case UP:
ax = ForgeDirection.EAST;
ay = ForgeDirection.SOUTH;
az = ForgeDirection.UP;
break;
case EAST:
ax = ForgeDirection.SOUTH;
ay = ForgeDirection.UP;
az = ForgeDirection.EAST;
break;
case WEST:
ax = ForgeDirection.NORTH;
ay = ForgeDirection.UP;
az = ForgeDirection.WEST;
break;
case NORTH:
ax = ForgeDirection.WEST;
ay = ForgeDirection.UP;
az = ForgeDirection.NORTH;
break;
case SOUTH:
ax = ForgeDirection.EAST;
ay = ForgeDirection.UP;
az = ForgeDirection.SOUTH;
break;
case UNKNOWN:
default:
ax = ForgeDirection.EAST;
ay = ForgeDirection.UP;
az = ForgeDirection.SOUTH;
break;
}
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
}
public void renderDynamic( CableBusContainer cableBusContainer, double x, double y, double z )
{
for( ForgeDirection s : ForgeDirection.values() )
{
IPart part = cableBusContainer.getPart( s );
if ( part != null )
if( part != null )
{
ForgeDirection ax;
ForgeDirection ay;
ForgeDirection az;
switch (s)
switch( s )
{
case DOWN:
ax = ForgeDirection.EAST;
ay = ForgeDirection.NORTH;
az = ForgeDirection.DOWN;
break;
case UP:
ax = ForgeDirection.EAST;
ay = ForgeDirection.SOUTH;
az = ForgeDirection.UP;
break;
case EAST:
ax = ForgeDirection.SOUTH;
ay = ForgeDirection.UP;
az = ForgeDirection.EAST;
break;
case WEST:
ax = ForgeDirection.NORTH;
ay = ForgeDirection.UP;
az = ForgeDirection.WEST;
break;
case NORTH:
ax = ForgeDirection.WEST;
ay = ForgeDirection.UP;
az = ForgeDirection.NORTH;
break;
case SOUTH:
ax = ForgeDirection.EAST;
ay = ForgeDirection.UP;
az = ForgeDirection.SOUTH;
break;
case UNKNOWN:
default:
ax = ForgeDirection.EAST;
ay = ForgeDirection.UP;
az = ForgeDirection.SOUTH;
break;
case DOWN:
ax = ForgeDirection.EAST;
ay = ForgeDirection.NORTH;
az = ForgeDirection.DOWN;
break;
case UP:
ax = ForgeDirection.EAST;
ay = ForgeDirection.SOUTH;
az = ForgeDirection.UP;
break;
case EAST:
ax = ForgeDirection.SOUTH;
ay = ForgeDirection.UP;
az = ForgeDirection.EAST;
break;
case WEST:
ax = ForgeDirection.NORTH;
ay = ForgeDirection.UP;
az = ForgeDirection.WEST;
break;
case NORTH:
ax = ForgeDirection.WEST;
ay = ForgeDirection.UP;
az = ForgeDirection.NORTH;
break;
case SOUTH:
ax = ForgeDirection.EAST;
ay = ForgeDirection.UP;
az = ForgeDirection.SOUTH;
break;
case UNKNOWN:
default:
ax = ForgeDirection.EAST;
ay = ForgeDirection.UP;
az = ForgeDirection.SOUTH;
break;
}
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
@@ -256,5 +257,4 @@ public class CableRenderHelper
}
}
}
}
@@ -18,30 +18,32 @@
package appeng.client.render;
import org.lwjgl.opengl.GL11;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class ItemRenderer implements IItemRenderer
{
public static final ItemRenderer INSTANCE = new ItemRenderer();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
public boolean handleRenderType( ItemStack item, ItemRenderType type )
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
{
GL11.glPushMatrix();
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
@@ -51,9 +53,9 @@ public class ItemRenderer implements IItemRenderer
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
if ( type == ItemRenderType.ENTITY )
if( type == ItemRenderType.ENTITY )
GL11.glTranslatef( -0.5f, -0.5f, -0.5f );
if ( type == ItemRenderType.INVENTORY )
if( type == ItemRenderType.INVENTORY )
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
WorldRender.INSTANCE.renderItemBlock( item, type, data );
@@ -61,5 +63,4 @@ public class ItemRenderer implements IItemRenderer
GL11.glPopAttrib();
GL11.glPopMatrix();
}
}
File diff suppressed because it is too large Load Diff
@@ -18,6 +18,7 @@
package appeng.client.render;
import java.util.Random;
import org.lwjgl.opengl.GL11;
@@ -30,24 +31,31 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraftforge.client.IRenderHandler;
public class SpatialSkyRender extends IRenderHandler
{
private static final SpatialSkyRender INSTANCE = new SpatialSkyRender();
private final Random random = new Random();
private long cycle = 0;
private final int dspList;
private long cycle = 0;
public SpatialSkyRender() {
public SpatialSkyRender()
{
this.dspList = GLAllocation.generateDisplayLists( 1 );
}
public static IRenderHandler getInstance()
{
return INSTANCE;
}
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc)
public void render( float partialTicks, WorldClient world, Minecraft mc )
{
long now = System.currentTimeMillis();
if ( now - this.cycle > 2000 )
if( now - this.cycle > 2000 )
{
this.cycle = now;
GL11.glNewList( this.dspList, GL11.GL_COMPILE );
@@ -57,59 +65,59 @@ public class SpatialSkyRender extends IRenderHandler
float fade = now - this.cycle;
fade /= 1000;
fade = 0.15f * (1.0f - Math.abs( (fade - 1.0f) * (fade - 1.0f) ));
fade = 0.15f * ( 1.0f - Math.abs( ( fade - 1.0f ) * ( fade - 1.0f ) ) );
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
GL11.glDisable(GL11.GL_FOG);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(false);
GL11.glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
Tessellator tessellator = Tessellator.instance;
GL11.glDisable( GL11.GL_FOG );
GL11.glDisable( GL11.GL_ALPHA_TEST );
GL11.glDisable( GL11.GL_BLEND );
GL11.glDepthMask( false );
GL11.glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
Tessellator tessellator = Tessellator.instance;
for (int i = 0; i < 6; ++i)
{
GL11.glPushMatrix();
for( int i = 0; i < 6; ++i )
{
GL11.glPushMatrix();
if (i == 1)
{
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
}
if( i == 1 )
{
GL11.glRotatef( 90.0F, 1.0F, 0.0F, 0.0F );
}
if (i == 2)
{
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
}
if( i == 2 )
{
GL11.glRotatef( -90.0F, 1.0F, 0.0F, 0.0F );
}
if (i == 3)
{
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
}
if( i == 3 )
{
GL11.glRotatef( 180.0F, 1.0F, 0.0F, 0.0F );
}
if (i == 4)
{
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
}
if( i == 4 )
{
GL11.glRotatef( 90.0F, 0.0F, 0.0F, 1.0F );
}
if (i == 5)
{
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
}
if( i == 5 )
{
GL11.glRotatef( -90.0F, 0.0F, 0.0F, 1.0F );
}
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(0);
tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, 0.0D, 0.0D);
tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, 0.0D, 16.0D);
tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, 16.0D, 16.0D);
tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, 16.0D, 0.0D);
tessellator.draw();
GL11.glPopMatrix();
}
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I( 0 );
tessellator.addVertexWithUV( -100.0D, -100.0D, -100.0D, 0.0D, 0.0D );
tessellator.addVertexWithUV( -100.0D, -100.0D, 100.0D, 0.0D, 16.0D );
tessellator.addVertexWithUV( 100.0D, -100.0D, 100.0D, 16.0D, 16.0D );
tessellator.addVertexWithUV( 100.0D, -100.0D, -100.0D, 16.0D, 0.0D );
tessellator.draw();
GL11.glPopMatrix();
}
GL11.glDepthMask(true);
GL11.glDepthMask( true );
if ( fade > 0.0f )
if( fade > 0.0f )
{
GL11.glDisable( GL11.GL_FOG );
GL11.glDisable( GL11.GL_ALPHA_TEST );
@@ -129,7 +137,7 @@ public class SpatialSkyRender extends IRenderHandler
GL11.glPopAttrib();
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
}
private void renderTwinkles()
@@ -137,7 +145,7 @@ public class SpatialSkyRender extends IRenderHandler
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
for (int i = 0; i < 50; ++i)
for( int i = 0; i < 50; ++i )
{
double iX = this.random.nextFloat() * 2.0F - 1.0F;
double iY = this.random.nextFloat() * 2.0F - 1.0F;
@@ -145,7 +153,7 @@ public class SpatialSkyRender extends IRenderHandler
double d3 = 0.05F + this.random.nextFloat() * 0.1F;
double dist = iX * iX + iY * iY + iZ * iZ;
if ( dist < 1.0D && dist > 0.01D )
if( dist < 1.0D && dist > 0.01D )
{
dist = 1.0D / Math.sqrt( dist );
iX *= dist;
@@ -164,11 +172,11 @@ public class SpatialSkyRender extends IRenderHandler
double d15 = Math.sin( d14 );
double d16 = Math.cos( d14 );
for (int j = 0; j < 4; ++j)
for( int j = 0; j < 4; ++j )
{
double d17 = 0.0D;
double d18 = ((j & 2) - 1) * d3;
double d19 = ((j + 1 & 2) - 1) * d3;
double d18 = ( ( j & 2 ) - 1 ) * d3;
double d19 = ( ( j + 1 & 2 ) - 1 ) * d3;
double d20 = d18 * d16 - d19 * d15;
double d21 = d19 * d16 + d18 * d15;
double d22 = d20 * d12 + d17 * d13;
@@ -182,10 +190,4 @@ public class SpatialSkyRender extends IRenderHandler
tessellator.draw();
}
public static IRenderHandler getInstance()
{
return INSTANCE;
}
}
@@ -18,6 +18,7 @@
package appeng.client.render;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
@@ -34,7 +35,8 @@ import appeng.core.AELog;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
public class TESRWrapper extends TileEntitySpecialRenderer
{
@@ -43,26 +45,27 @@ public class TESRWrapper extends TileEntitySpecialRenderer
final BaseBlockRender blkRender;
final double MAX_DISTANCE;
public TESRWrapper(BaseBlockRender render) {
public TESRWrapper( BaseBlockRender render )
{
this.blkRender = render;
this.MAX_DISTANCE = this.blkRender.getTesrRenderDistance();
}
@Override
final public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f)
final public void renderTileEntityAt( TileEntity te, double x, double y, double z, float f )
{
if ( te instanceof AEBaseTile )
if( te instanceof AEBaseTile )
{
Block b = te.getBlockType();
if ( b instanceof AEBaseBlock && ((AEBaseTile) te).requiresTESR() )
if( b instanceof AEBaseBlock && ( (AEBaseTile) te ).requiresTESR() )
{
if ( Math.abs( x ) > this.MAX_DISTANCE || Math.abs( y ) > this.MAX_DISTANCE || Math.abs( z ) > this.MAX_DISTANCE )
if( Math.abs( x ) > this.MAX_DISTANCE || Math.abs( y ) > this.MAX_DISTANCE || Math.abs( z ) > this.MAX_DISTANCE )
return;
Tessellator tess = Tessellator.instance;
if ( Platform.isDrawing( tess ) )
if( Platform.isDrawing( tess ) )
return;
try
@@ -73,20 +76,19 @@ public class TESRWrapper extends TileEntitySpecialRenderer
this.renderBlocksInstance.blockAccess = te.getWorldObj();
this.blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, this.renderBlocksInstance );
if ( Platform.isDrawing( tess ) )
if( Platform.isDrawing( tess ) )
throw new RuntimeException( "Error during rendering." );
GL11.glPopAttrib();
GL11.glPopMatrix();
}
catch (Throwable t)
catch( Throwable t )
{
AELog.severe( "Hi, Looks like there was a crash while rendering something..." );
t.printStackTrace();
AELog.severe( "MC will now crash ( probably )!" );
throw new RuntimeException( t );
}
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.render;
import java.util.HashMap;
import net.minecraft.block.Block;
@@ -34,33 +35,34 @@ import cpw.mods.fml.relauncher.SideOnly;
import appeng.block.AEBaseBlock;
import appeng.core.AELog;
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
public final class WorldRender implements ISimpleBlockRenderingHandler
{
private final RenderBlocks renderer = new RenderBlocks();
final int renderID = RenderingRegistry.getNextAvailableRenderId();
public static final WorldRender INSTANCE = new WorldRender();
public final HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
final int renderID = RenderingRegistry.getNextAvailableRenderId();
private final RenderBlocks renderer = new RenderBlocks();
boolean hasError = false;
public final HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
private WorldRender()
{
}
void setRender(AEBaseBlock in, BaseBlockRender r)
void setRender( AEBaseBlock in, BaseBlockRender r )
{
this.blockRenders.put( in, r );
}
private WorldRender() {
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
public void renderInventoryBlock( Block block, int metadata, int modelID, RenderBlocks renderer )
{
// wtf is this for?
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer )
{
AEBaseBlock blk = (AEBaseBlock) block;
renderer.setRenderBoundsFromBlock( block );
@@ -68,7 +70,7 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
}
@Override
public boolean shouldRender3DInInventory(int modelId)
public boolean shouldRender3DInInventory( int modelId )
{
return true;
}
@@ -79,10 +81,15 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
return this.renderID;
}
public void renderItemBlock(ItemStack item, ItemRenderType type, Object[] data)
private BaseBlockRender getRender( AEBaseBlock block )
{
return block.getRendererInstance().rendererInstance;
}
public void renderItemBlock( ItemStack item, ItemRenderType type, Object[] data )
{
Block blk = Block.getBlockFromItem( item.getItem() );
if ( blk instanceof AEBaseBlock )
if( blk instanceof AEBaseBlock )
{
AEBaseBlock block = (AEBaseBlock) blk;
this.renderer.setRenderBoundsFromBlock( block );
@@ -93,7 +100,7 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
}
else
{
if ( !this.hasError )
if( !this.hasError )
{
this.hasError = true;
AELog.severe( "Invalid render - item/block mismatch" );
@@ -102,9 +109,4 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
}
}
}
private BaseBlockRender getRender(AEBaseBlock block)
{
return block.getRendererInstance().rendererInstance;
}
}
@@ -47,90 +47,17 @@ import appeng.parts.networking.PartCable;
import appeng.tile.crafting.TileMolecularAssembler;
import appeng.util.Platform;
public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvider
{
IIcon getConnectedCable(IBlockAccess world, int x, int y, int z, ForgeDirection side, boolean covered)
public RenderBlockAssembler()
{
final int tileYPos = y + side.offsetY;
if ( -1 < tileYPos && tileYPos < 256 )
{
TileEntity ne = world.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
if ( ne instanceof IGridHost && ne instanceof IPartHost )
{
IPartHost ph = (IPartHost) ne;
IPart pcx = ph.getPart( ForgeDirection.UNKNOWN );
if ( pcx instanceof PartCable )
{
PartCable pc = (PartCable) pcx;
if ( pc.isConnected( side.getOpposite() ) )
{
if ( covered )
return pc.getCoveredTexture( pc.getCableColor() );
return pc.getGlassTexture( pc.getCableColor() );
}
}
}
}
return null;
}
public void renderCableAt(double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, double pull, boolean covered)
{
IIcon texture = null;
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.WEST, covered ) );
if ( texture != null )
{
renderer.setRenderBounds( 0.0D, 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness - pull, 0.5D + Thickness, 0.5D + Thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.EAST, covered ) );
if ( texture != null )
{
renderer.setRenderBounds( 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D - Thickness, 1.0D, 0.5D + Thickness, 0.5D + Thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.NORTH, covered ) );
if ( texture != null )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.0D, 0.5D + Thickness, 0.5D + Thickness, 0.5D - Thickness - pull );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.SOUTH, covered ) );
if ( texture != null )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D + Thickness, 0.5D + Thickness, 1.0D );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.DOWN, covered ) );
if ( texture != null )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.0D, 0.5D - Thickness, 0.5D + Thickness, 0.5D - Thickness - pull, 0.5D + Thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.UP, covered ) );
if ( texture != null )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D + Thickness, 1.0D, 0.5D + Thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( null );
}
public RenderBlockAssembler() {
super( false, 20 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
renderer.setOverrideBlockTexture( blk.getIcon( 0, 0 ) );
@@ -177,14 +104,14 @@ public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvide
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
BlockMolecularAssembler blk = (BlockMolecularAssembler) block;
TileMolecularAssembler tma = blk.getTileEntity( world, x, y, z );
if ( BlockMolecularAssembler.booleanAlphaPass )
if( BlockMolecularAssembler.booleanAlphaPass )
{
if ( tma.isPowered() )
if( tma.isPowered() )
{
this.renderBlockBounds( renderer, 1, 1, 1, 15, 15, 15, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.SOUTH );
TaughtIcon lights = new TaughtIcon( ExtraBlockTextures.BlockMolecularAssemblerLights.getIcon(), -2.0f );
@@ -274,8 +201,83 @@ public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvide
return true;
}
public void renderCableAt( double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, double pull, boolean covered )
{
IIcon texture = null;
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.WEST, covered ) );
if( texture != null )
{
renderer.setRenderBounds( 0.0D, 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness - pull, 0.5D + Thickness, 0.5D + Thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.EAST, covered ) );
if( texture != null )
{
renderer.setRenderBounds( 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D - Thickness, 1.0D, 0.5D + Thickness, 0.5D + Thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.NORTH, covered ) );
if( texture != null )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.0D, 0.5D + Thickness, 0.5D + Thickness, 0.5D - Thickness - pull );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.SOUTH, covered ) );
if( texture != null )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D + Thickness, 0.5D + Thickness, 1.0D );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.DOWN, covered ) );
if( texture != null )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.0D, 0.5D - Thickness, 0.5D + Thickness, 0.5D - Thickness - pull, 0.5D + Thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.UP, covered ) );
if( texture != null )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D + Thickness, 1.0D, 0.5D + Thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( null );
}
IIcon getConnectedCable( IBlockAccess world, int x, int y, int z, ForgeDirection side, boolean covered )
{
final int tileYPos = y + side.offsetY;
if( -1 < tileYPos && tileYPos < 256 )
{
TileEntity ne = world.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
if( ne instanceof IGridHost && ne instanceof IPartHost )
{
IPartHost ph = (IPartHost) ne;
IPart pcx = ph.getPart( ForgeDirection.UNKNOWN );
if( pcx instanceof PartCable )
{
PartCable pc = (PartCable) pcx;
if( pc.isConnected( side.getOpposite() ) )
{
if( covered )
return pc.getCoveredTexture( pc.getCableColor() );
return pc.getGlassTexture( pc.getCableColor() );
}
}
}
}
return null;
}
@Override
public void getBoxes(IPartCollisionHelper bch)
public void getBoxes( IPartCollisionHelper bch )
{
bch.addBox( 0, 0, 0, 16, 16, 16 );
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import org.lwjgl.opengl.GL11;
@@ -42,15 +43,17 @@ import appeng.core.AELog;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
public class RenderBlockCharger extends BaseBlockRender
{
public RenderBlockCharger() {
public RenderBlockCharger()
{
super( true, 30 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
Tessellator tess = Tessellator.instance;
@@ -78,11 +81,10 @@ public class RenderBlockCharger extends BaseBlockRender
renderer.renderAllFaces = false;
blk.getRendererInstance().setTemporaryRenderIcon( null );
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
this.preRenderInWorld( block, world, x, y, z, renderer );
@@ -124,13 +126,13 @@ public class RenderBlockCharger extends BaseBlockRender
}
@Override
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
ItemStack sis = null;
if ( tile instanceof IInventory )
sis = ((IInventory) tile).getStackInSlot( 0 );
if( tile instanceof IInventory )
sis = ( (IInventory) tile ).getStackInSlot( 0 );
if ( sis != null )
if( sis != null )
{
GL11.glPushMatrix();
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
@@ -142,7 +144,7 @@ public class RenderBlockCharger extends BaseBlockRender
GL11.glScalef( 1.0f, 1.0f, 1.0f );
Block blk = Block.getBlockFromItem( sis.getItem() );
if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
if( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
{
GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
@@ -162,7 +164,7 @@ public class RenderBlockCharger extends BaseBlockRender
this.doRenderItem( sis, tile );
}
catch (Exception err)
catch( Exception err )
{
AELog.error( err );
}
@@ -170,5 +172,4 @@ public class RenderBlockCharger extends BaseBlockRender
GL11.glPopMatrix();
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
@@ -28,15 +29,17 @@ import appeng.client.render.BaseBlockRender;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.networking.TileController;
public class RenderBlockController extends BaseBlockRender
{
public RenderBlockController() {
public RenderBlockController()
{
super( false, 20 );
}
@Override
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
boolean xx = this.getTileEntity( world, x - 1, y, z ) instanceof TileController && this.getTileEntity( world, x + 1, y, z ) instanceof TileController;
@@ -49,12 +52,12 @@ public class RenderBlockController extends BaseBlockRender
ExtraBlockTextures lights = null;
if ( xx && !yy && !zz )
if( xx && !yy && !zz )
{
if ( hasPower )
if( hasPower )
{
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
if ( isConflict )
if( isConflict )
lights = ExtraBlockTextures.BlockControllerColumnConflict;
else
lights = ExtraBlockTextures.BlockControllerColumnLights;
@@ -67,12 +70,12 @@ public class RenderBlockController extends BaseBlockRender
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 1;
}
else if ( !xx && yy && !zz )
else if( !xx && yy && !zz )
{
if ( hasPower )
if( hasPower )
{
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
if ( isConflict )
if( isConflict )
lights = ExtraBlockTextures.BlockControllerColumnConflict;
else
lights = ExtraBlockTextures.BlockControllerColumnLights;
@@ -83,12 +86,12 @@ public class RenderBlockController extends BaseBlockRender
renderer.uvRotateEast = 0;
renderer.uvRotateNorth = 0;
}
else if ( !xx && !yy && zz )
else if( !xx && !yy && zz )
{
if ( hasPower )
if( hasPower )
{
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
if ( isConflict )
if( isConflict )
lights = ExtraBlockTextures.BlockControllerColumnConflict;
else
lights = ExtraBlockTextures.BlockControllerColumnLights;
@@ -100,33 +103,32 @@ public class RenderBlockController extends BaseBlockRender
renderer.uvRotateSouth = 1;
renderer.uvRotateTop = 0;
}
else if ( (xx ? 1 : 0) + (yy ? 1 : 0) + (zz ? 1 : 0) >= 2 )
else if( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) >= 2 )
{
int v = (Math.abs( x ) + Math.abs( y ) + Math.abs( z )) % 2;
int v = ( Math.abs( x ) + Math.abs( y ) + Math.abs( z ) ) % 2;
renderer.uvRotateEast = renderer.uvRotateBottom = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
if ( v == 0 )
if( v == 0 )
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerInsideA.getIcon() );
else
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerInsideB.getIcon() );
}
else
{
if ( hasPower )
if( hasPower )
{
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerPowered.getIcon() );
if ( isConflict )
if( isConflict )
lights = ExtraBlockTextures.BlockControllerConflict;
else
lights = ExtraBlockTextures.BlockControllerLights;
}
else
blk.getRendererInstance().setTemporaryRenderIcon( null );
}
boolean out = renderer.renderStandardBlock( blk, x, y, z );
if ( lights != null )
if( lights != null )
{
Tessellator.instance.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
Tessellator.instance.setBrightness( 14 << 20 | 14 << 4 );
@@ -143,9 +145,9 @@ public class RenderBlockController extends BaseBlockRender
return out;
}
private TileEntity getTileEntity(IBlockAccess world, int x, int y, int z)
private TileEntity getTileEntity( IBlockAccess world, int x, int y, int z )
{
if ( y >= 0 )
if( y >= 0 )
return world.getTileEntity( x, y, z );
return null;
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.block.Block;
@@ -40,26 +41,29 @@ import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.crafting.TileCraftingMonitorTile;
import appeng.tile.crafting.TileCraftingTile;
public class RenderBlockCraftingCPU extends BaseBlockRender
{
protected RenderBlockCraftingCPU(boolean useTESR, int range) {
protected RenderBlockCraftingCPU( boolean useTESR, int range )
{
super( useTESR, range );
}
public RenderBlockCraftingCPU() {
public RenderBlockCraftingCPU()
{
super( false, 20 );
}
@Override
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess w, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess w, int x, int y, int z, RenderBlocks renderer )
{
IIcon theIcon = null;
boolean formed = false;
boolean emitsLight = false;
TileCraftingTile ct = blk.getTileEntity( w, x, y, z );
if ( ct != null && ct.isFormed() )
if( ct != null && ct.isFormed() )
{
formed = true;
emitsLight = ct.isPowered();
@@ -67,18 +71,18 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
int meta = w.getBlockMetadata( x, y, z ) & 3;
boolean isMonitor = blk.getClass() == BlockCraftingMonitor.class;
theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | (formed ? 8 : 0) );
theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | ( formed ? 8 : 0 ) );
IIcon nonForward = theIcon;
if ( isMonitor )
if( isMonitor )
{
for ( Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
for( Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
{
nonForward = craftingBlock.getIcon( 0, meta | ( formed ? 8 : 0 ) );
}
}
if ( formed && renderer.overrideBlockTexture == null )
if( formed && renderer.overrideBlockTexture == null )
{
renderer = BusRenderer.INSTANCE.renderer;
BusRenderHelper i = BusRenderHelper.INSTANCE;
@@ -92,7 +96,7 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
{
ct.lightCache = i.useSimplifiedRendering( x, y, z, null, ct.lightCache );
}
catch (Throwable ignored)
catch( Throwable ignored )
{
}
@@ -115,14 +119,13 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.NORTH );
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.SOUTH );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
{
i.setBounds( this.fso( side, lowX, ForgeDirection.WEST ), this.fso( side, lowY, ForgeDirection.DOWN ), this.fso( side, lowZ, ForgeDirection.NORTH ),
this.fso( side, highX, ForgeDirection.EAST ), this.fso( side, highY, ForgeDirection.UP ), this.fso( side, highZ, ForgeDirection.SOUTH ) );
i.setBounds( this.fso( side, lowX, ForgeDirection.WEST ), this.fso( side, lowY, ForgeDirection.DOWN ), this.fso( side, lowZ, ForgeDirection.NORTH ), this.fso( side, highX, ForgeDirection.EAST ), this.fso( side, highY, ForgeDirection.UP ), this.fso( side, highZ, ForgeDirection.SOUTH ) );
i.prepareBounds( renderer );
boolean LocalEmit = emitsLight;
if ( blk instanceof BlockCraftingMonitor && ct.getForward() != side )
if( blk instanceof BlockCraftingMonitor && ct.getForward() != side )
LocalEmit = false;
this.handleSide( blk, meta, x, y, z, i, renderer, ct.getForward() == side ? theIcon : nonForward, LocalEmit, isMonitor, side, w );
@@ -144,74 +147,75 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
}
}
private void renderCorner(BusRenderHelper i, RenderBlocks renderer, IBlockAccess w, int x, int y, int z, ForgeDirection up, ForgeDirection east,
ForgeDirection south)
private boolean isConnected( IBlockAccess w, int x, int y, int z, ForgeDirection side )
{
if ( this.isConnected( w, x, y, z, up ) )
final int tileYPos = y + side.offsetY;
if( 0 <= tileYPos && tileYPos <= 255 )
{
final TileEntity tile = w.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
return tile instanceof TileCraftingTile;
}
else
{
return false;
}
}
private void renderCorner( BusRenderHelper i, RenderBlocks renderer, IBlockAccess w, int x, int y, int z, ForgeDirection up, ForgeDirection east, ForgeDirection south )
{
if( this.isConnected( w, x, y, z, up ) )
return;
if ( this.isConnected( w, x, y, z, east ) )
if( this.isConnected( w, x, y, z, east ) )
return;
if ( this.isConnected( w, x, y, z, south ) )
if( this.isConnected( w, x, y, z, south ) )
return;
i.setBounds( this.gso( east, 3, ForgeDirection.WEST ), this.gso( up, 3, ForgeDirection.DOWN ), this.gso( south, 3, ForgeDirection.NORTH ),
this.gso( east, 13, ForgeDirection.EAST ), this.gso( up, 13, ForgeDirection.UP ), this.gso( south, 13, ForgeDirection.SOUTH ) );
i.setBounds( this.gso( east, 3, ForgeDirection.WEST ), this.gso( up, 3, ForgeDirection.DOWN ), this.gso( south, 3, ForgeDirection.NORTH ), this.gso( east, 13, ForgeDirection.EAST ), this.gso( up, 13, ForgeDirection.UP ), this.gso( south, 13, ForgeDirection.SOUTH ) );
i.prepareBounds( renderer );
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRing.getIcon() );
i.renderBlockCurrentBounds( x, y, z, renderer );
}
private float gso(ForgeDirection side, float def, ForgeDirection target)
private float fso( ForgeDirection side, float def, ForgeDirection target )
{
if ( side != target )
if( side == target )
{
if ( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
if( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
return 16;
return 0;
}
return def;
}
private float fso(ForgeDirection side, float def, ForgeDirection target)
private void handleSide( AEBaseBlock blk, int meta, int x, int y, int z, BusRenderHelper i, RenderBlocks renderer, IIcon color, boolean emitsLight, boolean isMonitor, ForgeDirection side, IBlockAccess w )
{
if ( side == target )
{
if ( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
return 16;
return 0;
}
return def;
}
private void handleSide(AEBaseBlock blk, int meta, int x, int y, int z, BusRenderHelper i, RenderBlocks renderer, IIcon color, boolean emitsLight,
boolean isMonitor, ForgeDirection side, IBlockAccess w)
{
if ( this.isConnected( w, x, y, z, side ) )
if( this.isConnected( w, x, y, z, side ) )
return;
i.setFacesToRender( EnumSet.of( side ) );
if ( meta == 0 && blk.getClass() == BlockCraftingUnit.class )
if( meta == 0 && blk.getClass() == BlockCraftingUnit.class )
{
i.setTexture( ExtraBlockTextures.BlockCraftingUnitFit.getIcon() );
i.renderBlockCurrentBounds( x, y, z, renderer );
}
else
{
if ( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
if( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
i.setTexture( ExtraBlockTextures.BlockCraftingMonitorOuter.getIcon() );
else
i.setTexture( ExtraBlockTextures.BlockCraftingFitSolid.getIcon() );
i.renderBlockCurrentBounds( x, y, z, renderer );
if ( color != null )
if( color != null )
{
i.setTexture( color );
if ( !emitsLight )
if( !emitsLight )
{
if ( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
if( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
{
int b = w.getLightBrightnessForSkyBlocks( x + side.offsetX, y + side.offsetY, z + side.offsetZ, 0 );
@@ -233,7 +237,7 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
}
else
{
if ( isMonitor )
if( isMonitor )
{
TileCraftingMonitorTile sr = blk.getTileEntity( w, x, y, z );
AEColor col = sr.getColor();
@@ -257,68 +261,66 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
i.renderFace( x, y, z, color, side, renderer );
}
}
}
}
for (ForgeDirection a : ForgeDirection.VALID_DIRECTIONS)
for( ForgeDirection a : ForgeDirection.VALID_DIRECTIONS )
{
if ( a == side || a == side.getOpposite() )
if( a == side || a == side.getOpposite() )
continue;
if ( (side.offsetX != 0 || side.offsetZ != 0)
&& (a == ForgeDirection.NORTH || a == ForgeDirection.EAST || a == ForgeDirection.WEST || a == ForgeDirection.SOUTH) )
if( ( side.offsetX != 0 || side.offsetZ != 0 ) && ( a == ForgeDirection.NORTH || a == ForgeDirection.EAST || a == ForgeDirection.WEST || a == ForgeDirection.SOUTH ) )
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
else if ( (side.offsetY != 0) && (a == ForgeDirection.EAST || a == ForgeDirection.WEST) )
else if( ( side.offsetY != 0 ) && ( a == ForgeDirection.EAST || a == ForgeDirection.WEST ) )
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
else
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLong.getIcon() );
double width = 3.0 / 16.0;
if ( !(i.getBound( a ) < 0.001 || i.getBound( a ) > 15.999) )
if( !( i.getBound( a ) < 0.001 || i.getBound( a ) > 15.999 ) )
{
switch (a)
switch( a )
{
case DOWN:
renderer.renderMinY = 0;
renderer.renderMaxY = width;
break;
case EAST:
renderer.renderMaxX = 1;
renderer.renderMinX = 1.0 - width;
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 1;
renderer.uvRotateWest = 1;
renderer.uvRotateEast = 1;
break;
case NORTH:
renderer.renderMinZ = 0;
renderer.renderMaxZ = width;
renderer.uvRotateWest = 1;
renderer.uvRotateNorth = 1;
renderer.uvRotateSouth = 1;
break;
case SOUTH:
renderer.renderMaxZ = 1;
renderer.renderMinZ = 1.0 - width;
renderer.uvRotateNorth = 1;
renderer.uvRotateSouth = 1;
break;
case UP:
renderer.renderMaxY = 1;
renderer.renderMinY = 1.0 - width;
break;
case WEST:
renderer.renderMinX = 0;
renderer.renderMaxX = width;
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 1;
renderer.uvRotateWest = 1;
renderer.uvRotateEast = 1;
break;
case UNKNOWN:
default:
case DOWN:
renderer.renderMinY = 0;
renderer.renderMaxY = width;
break;
case EAST:
renderer.renderMaxX = 1;
renderer.renderMinX = 1.0 - width;
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 1;
renderer.uvRotateWest = 1;
renderer.uvRotateEast = 1;
break;
case NORTH:
renderer.renderMinZ = 0;
renderer.renderMaxZ = width;
renderer.uvRotateWest = 1;
renderer.uvRotateNorth = 1;
renderer.uvRotateSouth = 1;
break;
case SOUTH:
renderer.renderMaxZ = 1;
renderer.renderMinZ = 1.0 - width;
renderer.uvRotateNorth = 1;
renderer.uvRotateSouth = 1;
break;
case UP:
renderer.renderMaxY = 1;
renderer.renderMinY = 1.0 - width;
break;
case WEST:
renderer.renderMinX = 0;
renderer.renderMaxX = width;
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 1;
renderer.uvRotateWest = 1;
renderer.uvRotateEast = 1;
break;
case UNKNOWN:
default:
}
i.renderBlockCurrentBounds( x, y, z, renderer );
@@ -327,18 +329,14 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
}
}
private boolean isConnected(IBlockAccess w, int x, int y, int z, ForgeDirection side)
private float gso( ForgeDirection side, float def, ForgeDirection target )
{
final int tileYPos = y + side.offsetY;
if ( 0 <= tileYPos && tileYPos <= 255)
if( side != target )
{
final TileEntity tile = w.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
return tile instanceof TileCraftingTile;
}
else
{
return false;
if( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
return 16;
return 0;
}
return def;
}
}
@@ -45,33 +45,34 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
{
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
public RenderBlockCraftingCPUMonitor() {
public RenderBlockCraftingCPUMonitor()
{
super( true, 20 );
}
@Override
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
if ( Platform.isDrawing( tess ) )
if( Platform.isDrawing( tess ) )
return;
if ( tile instanceof TileCraftingMonitorTile )
if( tile instanceof TileCraftingMonitorTile )
{
TileCraftingMonitorTile cmt = (TileCraftingMonitorTile) tile;
IAEItemStack ais = cmt.getJobProgress();
if ( cmt.dspList == null )
if( cmt.dspList == null )
{
cmt.updateList = true;
cmt.dspList = GLAllocation.generateDisplayLists( 1 );
}
if ( ais != null )
if( ais != null )
{
GL11.glPushMatrix();
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
if ( cmt.updateList )
if( cmt.updateList )
{
cmt.updateList = false;
GL11.glNewList( cmt.dspList, GL11.GL_COMPILE_AND_EXECUTE );
@@ -86,7 +87,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
}
}
private void tesrRenderScreen(Tessellator tess, TileCraftingMonitorTile cmt, IAEItemStack ais)
private void tesrRenderScreen( Tessellator tess, TileCraftingMonitorTile cmt, IAEItemStack ais )
{
ForgeDirection side = cmt.getForward();
@@ -94,7 +95,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
int spin = 0;
int max = 5;
while (walrus != cmt.getUp() && max > 0)
while( walrus != cmt.getUp() && max > 0 )
{
max--;
spin++;
@@ -108,38 +109,38 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
float scale = 0.7f;
GL11.glScalef( scale, scale, scale );
if ( side == ForgeDirection.UP )
if( side == ForgeDirection.UP )
{
GL11.glScalef( 1.0f, -1.0f, 1.0f );
GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( spin * 90.0F, 0, 0, 1 );
}
if ( side == ForgeDirection.DOWN )
if( side == ForgeDirection.DOWN )
{
GL11.glScalef( 1.0f, -1.0f, 1.0f );
GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( spin * -90.0F, 0, 0, 1 );
}
if ( side == ForgeDirection.EAST )
if( side == ForgeDirection.EAST )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
}
if ( side == ForgeDirection.WEST )
if( side == ForgeDirection.WEST )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
}
if ( side == ForgeDirection.NORTH )
if( side == ForgeDirection.NORTH )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
}
if ( side == ForgeDirection.SOUTH )
if( side == ForgeDirection.SOUTH )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
@@ -164,9 +165,8 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
ClientHelper.proxy.doRenderItem( sis, cmt.getWorldObj() );
}
catch (Exception e)
catch( Exception e )
{
AELog.error( e );
}
@@ -186,5 +186,4 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
GL11.glPopAttrib();
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
@@ -35,15 +36,17 @@ import appeng.client.render.BaseBlockRender;
import appeng.tile.AEBaseTile;
import appeng.tile.grindstone.TileCrank;
public class RenderBlockCrank extends BaseBlockRender
{
public RenderBlockCrank() {
public RenderBlockCrank()
{
super( true, 60 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
renderer.renderAllFaces = true;
@@ -57,22 +60,22 @@ public class RenderBlockCrank extends BaseBlockRender
}
@Override
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
return true;
}
@Override
public void renderTile(AEBaseBlock blk, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderBlocks)
public void renderTile( AEBaseBlock blk, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderBlocks )
{
TileCrank tc = (TileCrank) tile;
if ( tc.getUp() == null || tc.getUp() == ForgeDirection.UNKNOWN )
if( tc.getUp() == null || tc.getUp() == ForgeDirection.UNKNOWN )
return;
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
RenderHelper.disableStandardItemLighting();
if ( Minecraft.isAmbientOcclusionEnabled() )
if( Minecraft.isAmbientOcclusionEnabled() )
GL11.glShadeModel( GL11.GL_SMOOTH );
else
GL11.glShadeModel( GL11.GL_FLAT );
@@ -102,5 +105,4 @@ public class RenderBlockCrank extends BaseBlockRender
tess.setTranslation( 0, 0, 0 );
RenderHelper.enableStandardItemLighting();
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
@@ -27,25 +28,27 @@ import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
public class RenderBlockEnergyCube extends BaseBlockRender
{
public RenderBlockEnergyCube() {
public RenderBlockEnergyCube()
{
super( false, 20 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
IAEItemPowerStorage myItem = (IAEItemPowerStorage) is.getItem();
double internalCurrentPower = myItem.getAECurrentPower( is );
double internalMaxPower = myItem.getAEMaxPower( is );
int meta = (int) (8.0 * (internalCurrentPower / internalMaxPower));
int meta = (int) ( 8.0 * ( internalCurrentPower / internalMaxPower ) );
if ( meta > 7 )
if( meta > 7 )
meta = 7;
if ( meta < 0 )
if( meta < 0 )
meta = 0;
renderer.setOverrideBlockTexture( blk.getIcon( 0, meta ) );
@@ -54,7 +57,7 @@ public class RenderBlockEnergyCube extends BaseBlockRender
}
@Override
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
int meta = world.getBlockMetadata( x, y, z );
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import org.lwjgl.opengl.GL11;
@@ -46,15 +47,17 @@ import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileInscriber;
import appeng.util.Platform;
public class RenderBlockInscriber extends BaseBlockRender
{
public RenderBlockInscriber() {
public RenderBlockInscriber()
{
super( true, 30 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
Tessellator tess = Tessellator.instance;
@@ -95,14 +98,15 @@ public class RenderBlockInscriber extends BaseBlockRender
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
this.preRenderInWorld( block, world, x, y, z, renderer );
BlockInscriber blk = (BlockInscriber) block;
IOrientable te = this.getOrientable( block, world, x, y, z );
if ( te == null ) return false;
if( te == null )
return false;
ForgeDirection fdy = te.getUp();
ForgeDirection fdz = te.getForward();
@@ -137,7 +141,7 @@ public class RenderBlockInscriber extends BaseBlockRender
}
@Override
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
TileInscriber inv = (TileInscriber) tile;
@@ -163,19 +167,19 @@ public class RenderBlockInscriber extends BaseBlockRender
float base = 0.4f;
long absoluteProgress = 0;
if ( inv.smash )
if( inv.smash )
{
long currentTime = System.currentTimeMillis();
absoluteProgress = currentTime - inv.clientStart;
if ( absoluteProgress > 800 )
if( absoluteProgress > 800 )
inv.smash = false;
}
float relativeProgress = absoluteProgress % 800 / 400.0f;
float progress = relativeProgress;
if ( progress > 1.0f )
progress = 1.0f - (progress - 1.0f);
if( progress > 1.0f )
progress = 1.0f - ( progress - 1.0f );
press -= progress / 5.0f;
IIcon ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
@@ -189,8 +193,8 @@ public class RenderBlockInscriber extends BaseBlockRender
tess.addVertexWithUV( TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
tess.addVertexWithUV( TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
tess.addVertexWithUV( TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
middle -= 2.0f * 0.02f;
tess.addVertexWithUV( 1.0 - TwoPx, middle - press, TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) );
@@ -200,29 +204,29 @@ public class RenderBlockInscriber extends BaseBlockRender
tess.addVertexWithUV( 1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
tess.addVertexWithUV( TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
tess.addVertexWithUV( TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
tess.addVertexWithUV( TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
tess.draw();
GL11.glPopMatrix();
int items = 0;
if ( inv.getStackInSlot( 0 ) != null )
if( inv.getStackInSlot( 0 ) != null )
items++;
if ( inv.getStackInSlot( 1 ) != null )
if( inv.getStackInSlot( 1 ) != null )
items++;
if ( inv.getStackInSlot( 2 ) != null )
if( inv.getStackInSlot( 2 ) != null )
items++;
if ( relativeProgress > 1.0f || items == 0 )
if( relativeProgress > 1.0f || items == 0 )
{
ItemStack is = inv.getStackInSlot( 3 );
if ( is == null )
if( is == null )
{
InscriberRecipe ir = inv.getTask();
if ( ir != null )
if( ir != null )
is = ir.output.copy();
}
@@ -234,13 +238,11 @@ public class RenderBlockInscriber extends BaseBlockRender
this.renderItem( inv.getStackInSlot( 1 ), -press, block, tile, tess, x, y, z, f, renderer );
this.renderItem( inv.getStackInSlot( 2 ), 0.0f, block, tile, tess, x, y, z, f, renderer );
}
}
public void renderItem(ItemStack sis, float o, AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f,
RenderBlocks renderer)
public void renderItem( ItemStack sis, float o, AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
if ( sis != null )
if( sis != null )
{
sis = sis.copy();
GL11.glPushMatrix();
@@ -253,7 +255,7 @@ public class RenderBlockInscriber extends BaseBlockRender
GL11.glScalef( 1.0f, 1.0f, 1.0f );
Block blk = Block.getBlockFromItem( sis.getItem() );
if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
if( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
{
GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
@@ -275,7 +277,7 @@ public class RenderBlockInscriber extends BaseBlockRender
this.doRenderItem( sis, tile );
}
catch (Exception err)
catch( Exception err )
{
AELog.error( err );
}
@@ -283,5 +285,4 @@ public class RenderBlockInscriber extends BaseBlockRender
GL11.glPopMatrix();
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@@ -29,20 +30,22 @@ import appeng.client.render.BlockRenderInfo;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.misc.TileInterface;
public class RenderBlockInterface extends BaseBlockRender
{
public RenderBlockInterface() {
public RenderBlockInterface()
{
super( false, 20 );
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
TileInterface ti = block.getTileEntity( world, x, y, z );
BlockRenderInfo info = block.getRendererInstance();
if ( ti != null && ti.getForward() != ForgeDirection.UNKNOWN )
if( ti != null && ti.getForward() != ForgeDirection.UNKNOWN )
{
IIcon side = ExtraBlockTextures.BlockInterfaceAlternateArrow.getIcon();
info.setTemporaryRenderIcons( ExtraBlockTextures.BlockInterfaceAlternate.getIcon(), block.getIcon( 0, 0 ), side, side, side, side );
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.client.renderer.RenderBlocks;
@@ -34,25 +35,27 @@ import appeng.client.texture.ExtraBlockTextures;
import appeng.helpers.Splotch;
import appeng.tile.misc.TilePaint;
public class RenderBlockPaint extends BaseBlockRender
{
public RenderBlockPaint() {
public RenderBlockPaint()
{
super( false, 0 );
}
@Override
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
}
@Override
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
TilePaint tp = imb.getTileEntity( world, x, y, z );
boolean out = false;
if ( tp != null )
if( tp != null )
{
// super.renderInWorld( imb, world, x, y, z, renderer );
@@ -67,18 +70,18 @@ public class RenderBlockPaint extends BaseBlockRender
EnumSet<ForgeDirection> validSides = EnumSet.noneOf( ForgeDirection.class );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
{
if ( tp.isSideValid( side ) )
if( tp.isSideValid( side ) )
validSides.add( side );
}
for (Splotch s : tp.getDots())
for( Splotch s : tp.getDots() )
{
if ( !validSides.contains( s.side ) )
if( !validSides.contains( s.side ) )
continue;
if ( s.lumen )
if( s.lumen )
{
tess.setColorOpaque_I( s.color.whiteVariant );
tess.setBrightness( lumen );
@@ -100,13 +103,13 @@ public class RenderBlockPaint extends BaseBlockRender
pos_x = Math.max( H, Math.min( 1.0 - H, pos_x ) );
pos_y = Math.max( H, Math.min( 1.0 - H, pos_y ) );
if ( s.side == ForgeDirection.SOUTH || s.side == ForgeDirection.NORTH )
if( s.side == ForgeDirection.SOUTH || s.side == ForgeDirection.NORTH )
{
pos_x += x;
pos_y += y;
}
else if ( s.side == ForgeDirection.UP || s.side == ForgeDirection.DOWN )
else if( s.side == ForgeDirection.UP || s.side == ForgeDirection.DOWN )
{
pos_x += x;
pos_y += z;
@@ -120,54 +123,54 @@ public class RenderBlockPaint extends BaseBlockRender
IIcon ico = icoSet[s.getSeed() % icoSet.length];
switch (s.side)
switch( s.side )
{
case UP:
offset = 1.0 - offset;
tess.addVertexWithUV( pos_x - H, y + offset, pos_y - H, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( pos_x + H, y + offset, pos_y - H, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( pos_x + H, y + offset, pos_y + H, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( pos_x - H, y + offset, pos_y + H, ico.getMinU(), ico.getMaxV() );
break;
case UP:
offset = 1.0 - offset;
tess.addVertexWithUV( pos_x - H, y + offset, pos_y - H, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( pos_x + H, y + offset, pos_y - H, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( pos_x + H, y + offset, pos_y + H, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( pos_x - H, y + offset, pos_y + H, ico.getMinU(), ico.getMaxV() );
break;
case DOWN:
tess.addVertexWithUV( pos_x + H, y + offset, pos_y - H, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( pos_x - H, y + offset, pos_y - H, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( pos_x - H, y + offset, pos_y + H, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( pos_x + H, y + offset, pos_y + H, ico.getMinU(), ico.getMaxV() );
break;
case DOWN:
tess.addVertexWithUV( pos_x + H, y + offset, pos_y - H, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( pos_x - H, y + offset, pos_y - H, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( pos_x - H, y + offset, pos_y + H, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( pos_x + H, y + offset, pos_y + H, ico.getMinU(), ico.getMaxV() );
break;
case EAST:
offset = 1.0 - offset;
tess.addVertexWithUV( x + offset, pos_x + H, pos_y - H, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( x + offset, pos_x - H, pos_y - H, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( x + offset, pos_x - H, pos_y + H, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( x + offset, pos_x + H, pos_y + H, ico.getMinU(), ico.getMaxV() );
break;
case EAST:
offset = 1.0 - offset;
tess.addVertexWithUV( x + offset, pos_x + H, pos_y - H, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( x + offset, pos_x - H, pos_y - H, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( x + offset, pos_x - H, pos_y + H, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( x + offset, pos_x + H, pos_y + H, ico.getMinU(), ico.getMaxV() );
break;
case WEST:
tess.addVertexWithUV( x + offset, pos_x - H, pos_y - H, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( x + offset, pos_x + H, pos_y - H, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( x + offset, pos_x + H, pos_y + H, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( x + offset, pos_x - H, pos_y + H, ico.getMinU(), ico.getMaxV() );
break;
case WEST:
tess.addVertexWithUV( x + offset, pos_x - H, pos_y - H, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( x + offset, pos_x + H, pos_y - H, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( x + offset, pos_x + H, pos_y + H, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( x + offset, pos_x - H, pos_y + H, ico.getMinU(), ico.getMaxV() );
break;
case SOUTH:
offset = 1.0 - offset;
tess.addVertexWithUV( pos_x + H, pos_y - H, z + offset, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( pos_x - H, pos_y - H, z + offset, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( pos_x - H, pos_y + H, z + offset, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( pos_x + H, pos_y + H, z + offset, ico.getMinU(), ico.getMaxV() );
break;
case SOUTH:
offset = 1.0 - offset;
tess.addVertexWithUV( pos_x + H, pos_y - H, z + offset, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( pos_x - H, pos_y - H, z + offset, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( pos_x - H, pos_y + H, z + offset, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( pos_x + H, pos_y + H, z + offset, ico.getMinU(), ico.getMaxV() );
break;
case NORTH:
tess.addVertexWithUV( pos_x - H, pos_y - H, z + offset, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( pos_x + H, pos_y - H, z + offset, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( pos_x + H, pos_y + H, z + offset, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( pos_x - H, pos_y + H, z + offset, ico.getMinU(), ico.getMaxV() );
break;
case NORTH:
tess.addVertexWithUV( pos_x - H, pos_y - H, z + offset, ico.getMinU(), ico.getMinV() );
tess.addVertexWithUV( pos_x + H, pos_y - H, z + offset, ico.getMaxU(), ico.getMinV() );
tess.addVertexWithUV( pos_x + H, pos_y + H, z + offset, ico.getMaxU(), ico.getMaxV() );
tess.addVertexWithUV( pos_x - H, pos_y + H, z + offset, ico.getMinU(), ico.getMaxV() );
break;
default:
default:
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@@ -28,20 +29,22 @@ import appeng.client.render.BaseBlockRender;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
public class RenderBlockQuartzAccelerator extends BaseBlockRender
{
public RenderBlockQuartzAccelerator() {
public RenderBlockQuartzAccelerator()
{
super( false, 20 );
}
@Override
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
TileEntity te = world.getTileEntity( x, y, z );
if ( te instanceof TileQuartzGrowthAccelerator )
if( te instanceof TileQuartzGrowthAccelerator )
{
if ( ((TileQuartzGrowthAccelerator) te).hasPower )
if( ( (TileQuartzGrowthAccelerator) te ).hasPower )
{
IIcon top_Bottom = ExtraBlockTextures.BlockQuartzGrowthAcceleratorOn.getIcon();
IIcon side = ExtraBlockTextures.BlockQuartzGrowthAcceleratorSideOn.getIcon();
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
@@ -34,23 +35,25 @@ import appeng.client.render.BaseBlockRender;
import appeng.tile.AEBaseTile;
import appeng.tile.storage.TileSkyChest;
public class RenderBlockSkyChest extends BaseBlockRender
{
final ModelChest model = new ModelChest();
public RenderBlockSkyChest() {
public RenderBlockSkyChest()
{
super( true, 80 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
ResourceLocation loc;
if ( is.getItemDamage() == 1 )
if( is.getItemDamage() == 1 )
loc = new ResourceLocation( "appliedenergistics2", "textures/models/skyblockchest.png" );
else
loc = new ResourceLocation( "appliedenergistics2", "textures/models/skychest.png" );
@@ -62,37 +65,37 @@ public class RenderBlockSkyChest extends BaseBlockRender
GL11.glScalef( 1.0F, -1F, -1F );
GL11.glTranslatef( -0.0F, -1.0F, -1.0F );
this.model.chestLid.offsetY = -(0.9f / 16.0f);
this.model.chestLid.rotateAngleX = -((lidAngle * 3.141593F) / 2.0F);
this.model.chestLid.offsetY = -( 0.9f / 16.0f );
this.model.chestLid.rotateAngleX = -( ( lidAngle * 3.141593F ) / 2.0F );
this.model.renderAll();
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
}
@Override
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
return true;
}
@Override
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer)
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer )
{
if ( !(tile instanceof TileSkyChest) )
if( !( tile instanceof TileSkyChest ) )
return;
TileSkyChest skyChest = (TileSkyChest) tile;
if ( !skyChest.hasWorldObj() )
if( !skyChest.hasWorldObj() )
return;
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
ResourceLocation loc;
if ( tile.getWorldObj().getBlockMetadata( tile.xCoord, tile.yCoord, tile.zCoord ) == 1 )
if( tile.getWorldObj().getBlockMetadata( tile.xCoord, tile.yCoord, tile.zCoord ) == 1 )
loc = new ResourceLocation( "appliedenergistics2", "textures/models/skyblockchest.png" );
else
loc = new ResourceLocation( "appliedenergistics2", "textures/models/skychest.png" );
@@ -107,26 +110,26 @@ public class RenderBlockSkyChest extends BaseBlockRender
long now = System.currentTimeMillis();
long distance = now - skyChest.lastEvent;
if ( skyChest.playerOpen > 0 )
if( skyChest.playerOpen > 0 )
skyChest.lidAngle += distance * 0.0001;
else
skyChest.lidAngle -= distance * 0.0001;
if ( skyChest.lidAngle > 0.5f )
if( skyChest.lidAngle > 0.5f )
skyChest.lidAngle = 0.5f;
if ( skyChest.lidAngle < 0.0f )
if( skyChest.lidAngle < 0.0f )
skyChest.lidAngle = 0.0f;
float lidAngle = skyChest.lidAngle;
lidAngle = 1.0F - lidAngle;
lidAngle = 1.0F - lidAngle * lidAngle * lidAngle;
this.model.chestLid.offsetY = -(1.01f / 16.0f);
this.model.chestLid.rotateAngleX = -((lidAngle * 3.141593F) / 2.0F);
this.model.chestLid.offsetY = -( 1.01f / 16.0f );
this.model.chestLid.rotateAngleX = -( ( lidAngle * 3.141593F ) / 2.0F );
this.model.renderAll();
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
@@ -39,40 +40,42 @@ import appeng.hooks.CompassResult;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileSkyCompass;
public class RenderBlockSkyCompass extends BaseBlockRender
{
float r = 0;
final ModelCompass model = new ModelCompass();
float r = 0;
public RenderBlockSkyCompass() {
public RenderBlockSkyCompass()
{
super( true, 80 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
if ( type == ItemRenderType.INVENTORY )
if( type == ItemRenderType.INVENTORY )
{
boolean isGood = false;
IInventory inv = Minecraft.getMinecraft().thePlayer.inventory;
for (int x = 0; x < inv.getSizeInventory(); x++)
if ( inv.getStackInSlot( x ) == is )
for( int x = 0; x < inv.getSizeInventory(); x++ )
if( inv.getStackInSlot( x ) == is )
isGood = true;
if ( !isGood )
if( !isGood )
type = ItemRenderType.FIRST_PERSON_MAP;
}
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/models/compass.png" );
Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
if ( type == ItemRenderType.ENTITY )
if( type == ItemRenderType.ENTITY )
{
GL11.glRotatef( -90.0f, 0.0f, 0.0f, 1.0f );
GL11.glScalef( 1.0F, -1F, -1F );
@@ -81,25 +84,25 @@ public class RenderBlockSkyCompass extends BaseBlockRender
}
else
{
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
GL11.glRotatef( 15.3f, 0.0f, 0.0f, 1.0f );
GL11.glScalef( 1.0F, -1F, -1F );
GL11.glScalef( 2.5f, 2.5f, 2.5f );
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
GL11.glTranslatef( 0.3F, -1.65F, -0.19F );
else
GL11.glTranslatef( 0.2F, -1.65F, -0.19F );
}
long now = System.currentTimeMillis();
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED )
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED )
{
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
float rYaw = p.rotationYaw;
if ( type == ItemRenderType.EQUIPPED )
if( type == ItemRenderType.EQUIPPED )
{
p = (EntityPlayer) obj[1];
rYaw = p.renderYawOffset;
@@ -110,20 +113,20 @@ public class RenderBlockSkyCompass extends BaseBlockRender
int z = (int) p.posZ;
CompassResult cr = CompassManager.INSTANCE.getCompassDirection( 0, x, y, z );
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
for( int i = 0; i < 3; i++ )
for( int j = 0; j < 3; j++ )
CompassManager.INSTANCE.getCompassDirection( 0, x + i - 1, y, z + j - 1 );
if ( cr.hasResult )
if( cr.hasResult )
{
if ( cr.spin )
if( cr.spin )
{
now %= 100000;
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
}
else
{
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
{
float offRads = rYaw / 180.0f * (float) Math.PI;
float adjustment = (float) Math.PI * 0.74f;
@@ -140,38 +143,37 @@ public class RenderBlockSkyCompass extends BaseBlockRender
else
{
now %= 1000000;
this.model.renderAll( (now / 500000.0f) * (float) Math.PI * 500.0f );
this.model.renderAll( ( now / 500000.0f ) * (float) Math.PI * 500.0f );
}
}
else
{
now %= 100000;
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
}
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
}
@Override
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
return true;
}
@Override
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer)
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer )
{
if ( !(tile instanceof TileSkyCompass) )
if( !( tile instanceof TileSkyCompass ) )
return;
TileSkyCompass skyCompass = (TileSkyCompass) tile;
if ( !skyCompass.hasWorldObj() )
if( !skyCompass.hasWorldObj() )
return;
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/models/compass.png" );
@@ -186,33 +188,32 @@ public class RenderBlockSkyCompass extends BaseBlockRender
long now = System.currentTimeMillis();
CompassResult cr = null;
if ( skyCompass.getForward() == ForgeDirection.UP || skyCompass.getForward() == ForgeDirection.DOWN )
if( skyCompass.getForward() == ForgeDirection.UP || skyCompass.getForward() == ForgeDirection.DOWN )
cr = CompassManager.INSTANCE.getCompassDirection( 0, tile.xCoord, tile.yCoord, tile.zCoord );
else
cr = new CompassResult( false, true, 0 );
if ( cr.hasResult )
if( cr.hasResult )
{
if ( cr.spin )
if( cr.spin )
{
now %= 100000;
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
}
else
this.model.renderAll( (float) (skyCompass.getForward() == ForgeDirection.DOWN ? this.flipidiy( cr.rad ) : cr.rad) );
this.model.renderAll( (float) ( skyCompass.getForward() == ForgeDirection.DOWN ? this.flipidiy( cr.rad ) : cr.rad ) );
}
else
{
now %= 1000000;
this.model.renderAll( (now / 500000.0f) * (float) Math.PI * 500.0f );
this.model.renderAll( ( now / 500000.0f ) * (float) Math.PI * 500.0f );
}
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
}
private double flipidiy(double rad)
private double flipidiy( double rad )
{
double x = Math.cos( rad );
double y = Math.sin( rad );
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.client.renderer.RenderBlocks;
@@ -38,15 +39,24 @@ import appeng.client.texture.OffsetIcon;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
public class RenderBlockWireless extends BaseBlockRender
{
public RenderBlockWireless() {
int centerX = 0;
int centerY = 0;
int centerZ = 0;
AEBaseBlock blk;
boolean hasChan = false;
boolean hasPower = false;
public RenderBlockWireless()
{
super( false, 20 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
this.blk = blk;
this.centerX = 0;
@@ -81,43 +91,30 @@ public class RenderBlockWireless extends BaseBlockRender
int s = 1;
for (ForgeDirection side : sides)
for( ForgeDirection side : sides )
{
this.renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 2 : -2), 8 + (side.offsetY != 0 ? side.offsetY * 2 : -2), 2
+ (side.offsetZ != 0 ? side.offsetZ * 2 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 4 : 2),
8 + (side.offsetY != 0 ? side.offsetY * 4 : 2), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, ForgeDirection.EAST, ForgeDirection.UP,
ForgeDirection.SOUTH );
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 2 : -2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 2 : -2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 2 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : 2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : 2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
}
s = 3;
for (ForgeDirection side : sides)
for( ForgeDirection side : sides )
{
this.renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 4 : -1), 8 + (side.offsetY != 0 ? side.offsetY * 4 : -1), 1
+ (side.offsetZ != 0 ? side.offsetZ * 4 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 5 : 1),
8 + (side.offsetY != 0 ? side.offsetY * 5 : 1), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, ForgeDirection.EAST, ForgeDirection.UP,
ForgeDirection.SOUTH );
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : -1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : -1 ), 1 + ( side.offsetZ != 0 ? side.offsetZ * 4 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 5 : 1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 5 : 1 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
}
}
int centerX = 0;
int centerY = 0;
int centerZ = 0;
AEBaseBlock blk;
boolean hasChan = false;
boolean hasPower = false;
@Override
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
TileWireless tw = blk.getTileEntity( world, x, y, z );
this.blk = blk;
if ( tw != null )
if( tw != null )
{
this.hasChan = (tw.clientFlags & (TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG)) == (TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG);
this.hasPower = (tw.clientFlags & TileWireless.POWERED_FLAG) == TileWireless.POWERED_FLAG;
this.hasChan = ( tw.clientFlags & ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG ) ) == ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG );
this.hasPower = ( tw.clientFlags & TileWireless.POWERED_FLAG ) == TileWireless.POWERED_FLAG;
BlockRenderInfo ri = blk.getRendererInstance();
@@ -151,20 +148,16 @@ public class RenderBlockWireless extends BaseBlockRender
int s = 1;
for (ForgeDirection side : sides)
for( ForgeDirection side : sides )
{
this.renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 2 : -2), 8 + (side.offsetY != 0 ? side.offsetY * 2 : -2), 2
+ (side.offsetZ != 0 ? side.offsetZ * 2 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 4 : 2),
8 + (side.offsetY != 0 ? side.offsetY * 4 : 2), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, fdx, fdy, fdz );
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 2 : -2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 2 : -2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 2 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : 2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : 2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, fdx, fdy, fdz );
super.renderInWorld( blk, world, x, y, z, renderer );
}
s = 3;
for (ForgeDirection side : sides)
for( ForgeDirection side : sides )
{
this.renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 4 : -1), 8 + (side.offsetY != 0 ? side.offsetY * 4 : -1), 1
+ (side.offsetZ != 0 ? side.offsetZ * 4 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 5 : 1),
8 + (side.offsetY != 0 ? side.offsetY * 5 : 1), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, fdx, fdy, fdz );
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : -1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : -1 ), 1 + ( side.offsetZ != 0 ? side.offsetZ * 4 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 5 : 1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 5 : 1 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, fdx, fdy, fdz );
super.renderInWorld( blk, world, x, y, z, renderer );
}
@@ -173,13 +166,13 @@ public class RenderBlockWireless extends BaseBlockRender
// ExtraTextures.BlockChargerInside.getIcon(), r, r );
this.renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, fdx, fdy, fdz );
if ( this.hasChan )
if( this.hasChan )
{
int l = 14;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
Tessellator.instance.setColorOpaque_I( AEColor.Transparent.blackVariant );
}
else if ( this.hasPower )
else if( this.hasPower )
{
int l = 9;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
@@ -191,17 +184,17 @@ public class RenderBlockWireless extends BaseBlockRender
Tessellator.instance.setColorOpaque_I( 0x000000 );
}
if ( ForgeDirection.UP != fdz.getOpposite() )
if( ForgeDirection.UP != fdz.getOpposite() )
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.UP );
if ( ForgeDirection.DOWN != fdz.getOpposite() )
if( ForgeDirection.DOWN != fdz.getOpposite() )
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.DOWN );
if ( ForgeDirection.EAST != fdz.getOpposite() )
if( ForgeDirection.EAST != fdz.getOpposite() )
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.EAST );
if ( ForgeDirection.WEST != fdz.getOpposite() )
if( ForgeDirection.WEST != fdz.getOpposite() )
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.WEST );
if ( ForgeDirection.SOUTH != fdz.getOpposite() )
if( ForgeDirection.SOUTH != fdz.getOpposite() )
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.SOUTH );
if ( ForgeDirection.NORTH != fdz.getOpposite() )
if( ForgeDirection.NORTH != fdz.getOpposite() )
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.NORTH );
ri.setTemporaryRenderIcon( null );
@@ -211,45 +204,45 @@ public class RenderBlockWireless extends BaseBlockRender
return true;
}
private void renderTorchAtAngle(RenderBlocks renderer, ForgeDirection x, ForgeDirection y, ForgeDirection z)
private void renderTorchAtAngle( RenderBlocks renderer, ForgeDirection x, ForgeDirection y, ForgeDirection z )
{
IIcon r = (this.hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : this.blk.getIcon( 0, 0 ));
IIcon r = ( this.hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : this.blk.getIcon( 0, 0 ) );
IIcon sides = new OffsetIcon( r, 0.0f, -2.0f );
switch (z)
switch( z )
{
case DOWN:
renderer.uvRotateNorth = 3;
renderer.uvRotateSouth = 3;
renderer.uvRotateEast = 3;
renderer.uvRotateWest = 3;
break;
case EAST:
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 2;
renderer.uvRotateEast = 2;
renderer.uvRotateWest = 1;
break;
case NORTH:
renderer.uvRotateTop = 0;
renderer.uvRotateBottom = 0;
renderer.uvRotateNorth = 2;
renderer.uvRotateSouth = 1;
break;
case SOUTH:
renderer.uvRotateTop = 3;
renderer.uvRotateBottom = 3;
renderer.uvRotateNorth = 1;
renderer.uvRotateSouth = 2;
break;
case WEST:
renderer.uvRotateTop = 2;
renderer.uvRotateBottom = 1;
renderer.uvRotateEast = 1;
renderer.uvRotateWest = 2;
break;
default:
break;
case DOWN:
renderer.uvRotateNorth = 3;
renderer.uvRotateSouth = 3;
renderer.uvRotateEast = 3;
renderer.uvRotateWest = 3;
break;
case EAST:
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 2;
renderer.uvRotateEast = 2;
renderer.uvRotateWest = 1;
break;
case NORTH:
renderer.uvRotateTop = 0;
renderer.uvRotateBottom = 0;
renderer.uvRotateNorth = 2;
renderer.uvRotateSouth = 1;
break;
case SOUTH:
renderer.uvRotateTop = 3;
renderer.uvRotateBottom = 3;
renderer.uvRotateNorth = 1;
renderer.uvRotateSouth = 2;
break;
case WEST:
renderer.uvRotateTop = 2;
renderer.uvRotateBottom = 1;
renderer.uvRotateEast = 1;
renderer.uvRotateWest = 2;
break;
default:
break;
}
Tessellator.instance.setColorOpaque_I( 0xffffff );
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.client.renderer.RenderBlocks;
@@ -34,15 +35,17 @@ import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.storage.TileDrive;
import appeng.util.Platform;
public class RenderDrive extends BaseBlockRender
{
public RenderDrive() {
public RenderDrive()
{
super( false, 0 );
}
@Override
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
@@ -52,7 +55,7 @@ public class RenderDrive extends BaseBlockRender
}
@Override
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
TileDrive sp = imb.getTileEntity( world, x, y, z );
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
@@ -68,219 +71,149 @@ public class RenderDrive extends BaseBlockRender
int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
for (int yy = 0; yy < 5; yy++)
for( int yy = 0; yy < 5; yy++ )
{
for (int xx = 0; xx < 2; xx++)
for( int xx = 0; xx < 2; xx++ )
{
int stat = sp.getCellStatus( yy * 2 + (1 - xx) );
int stat = sp.getCellStatus( yy * 2 + ( 1 - xx ) );
this.selectFace( renderer, west, up, forward, 2 + xx * 7, 7 + xx * 7, 1 + yy * 3, 3 + yy * 3 );
int spin = 0;
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
{
case 1:
switch (up)
{
case UP:
spin = 3;
case 1:
switch( up )
{
case UP:
spin = 3;
break;
case DOWN:
spin = 1;
break;
case NORTH:
spin = 0;
break;
case SOUTH:
spin = 2;
break;
default:
}
break;
case DOWN:
spin = 1;
case -1:
switch( up )
{
case UP:
spin = 1;
break;
case DOWN:
spin = 3;
break;
case NORTH:
spin = 0;
break;
case SOUTH:
spin = 2;
break;
default:
}
break;
case NORTH:
spin = 0;
case -2:
switch( up )
{
case EAST:
spin = 1;
break;
case WEST:
spin = 3;
break;
case NORTH:
spin = 2;
break;
case SOUTH:
spin = 0;
break;
default:
}
break;
case SOUTH:
spin = 2;
case 2:
switch( up )
{
case EAST:
spin = 1;
break;
case WEST:
spin = 3;
break;
case NORTH:
spin = 0;
break;
case SOUTH:
spin = 0;
break;
default:
}
break;
default:
}
break;
case -1:
switch (up)
{
case UP:
spin = 1;
case 3:
switch( up )
{
case UP:
spin = 2;
break;
case DOWN:
spin = 0;
break;
case EAST:
spin = 3;
break;
case WEST:
spin = 1;
break;
default:
}
break;
case DOWN:
spin = 3;
case -3:
switch( up )
{
case UP:
spin = 2;
break;
case DOWN:
spin = 0;
break;
case EAST:
spin = 1;
break;
case WEST:
spin = 3;
break;
default:
}
break;
case NORTH:
spin = 0;
break;
case SOUTH:
spin = 2;
break;
default:
}
break;
case -2:
switch (up)
{
case EAST:
spin = 1;
break;
case WEST:
spin = 3;
break;
case NORTH:
spin = 2;
break;
case SOUTH:
spin = 0;
break;
default:
}
break;
case 2:
switch (up)
{
case EAST:
spin = 1;
break;
case WEST:
spin = 3;
break;
case NORTH:
spin = 0;
break;
case SOUTH:
spin = 0;
break;
default:
}
break;
case 3:
switch (up)
{
case UP:
spin = 2;
break;
case DOWN:
spin = 0;
break;
case EAST:
spin = 3;
break;
case WEST:
spin = 1;
break;
default:
}
break;
case -3:
switch (up)
{
case UP:
spin = 2;
break;
case DOWN:
spin = 0;
break;
case EAST:
spin = 1;
break;
case WEST:
spin = 3;
break;
default:
}
break;
}
double u1 = ico.getInterpolatedU( (spin % 4 < 2) ? 1 : 6 );
double u2 = ico.getInterpolatedU( ((spin + 1) % 4 < 2) ? 1 : 6 );
double u3 = ico.getInterpolatedU( ((spin + 2) % 4 < 2) ? 1 : 6 );
double u4 = ico.getInterpolatedU( ((spin + 3) % 4 < 2) ? 1 : 6 );
double u1 = ico.getInterpolatedU( ( spin % 4 < 2 ) ? 1 : 6 );
double u2 = ico.getInterpolatedU( ( ( spin + 1 ) % 4 < 2 ) ? 1 : 6 );
double u3 = ico.getInterpolatedU( ( ( spin + 2 ) % 4 < 2 ) ? 1 : 6 );
double u4 = ico.getInterpolatedU( ( ( spin + 3 ) % 4 < 2 ) ? 1 : 6 );
int m = 1;
int mx = 3;
if ( stat == 0 )
if( stat == 0 )
{
m = 4;
mx = 5;
}
double v1 = ico.getInterpolatedV( ((spin + 1) % 4 < 2) ? m : mx );
double v2 = ico.getInterpolatedV( ((spin + 2) % 4 < 2) ? m : mx );
double v3 = ico.getInterpolatedV( ((spin + 3) % 4 < 2) ? m : mx );
double v4 = ico.getInterpolatedV( ((spin) % 4 < 2) ? m : mx );
double v1 = ico.getInterpolatedV( ( ( spin + 1 ) % 4 < 2 ) ? m : mx );
double v2 = ico.getInterpolatedV( ( ( spin + 2 ) % 4 < 2 ) ? m : mx );
double v3 = ico.getInterpolatedV( ( ( spin + 3 ) % 4 < 2 ) ? m : mx );
double v4 = ico.getInterpolatedV( ( ( spin ) % 4 < 2 ) ? m : mx );
tess.setBrightness( b );
tess.setColorOpaque_I( 0xffffff );
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
{
case 1:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
break;
case -1:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
break;
case -2:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
break;
case 2:
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
break;
case 3:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
break;
case -3:
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
break;
}
if ( (forward == ForgeDirection.UP && up == ForgeDirection.SOUTH) || forward == ForgeDirection.DOWN )
this.selectFace( renderer, west, up, forward, 3 + xx * 7, 4 + xx * 7, 1 + yy * 3, 2 + yy * 3 );
else
this.selectFace( renderer, west, up, forward, 5 + xx * 7, 6 + xx * 7, 2 + yy * 3, 3 + yy * 3 );
if ( stat != 0 )
{
IIcon whiteIcon = ExtraBlockTextures.White.getIcon();
u1 = whiteIcon.getInterpolatedU( (spin % 4 < 2) ? 1 : 6 );
u2 = whiteIcon.getInterpolatedU( ((spin + 1) % 4 < 2) ? 1 : 6 );
u3 = whiteIcon.getInterpolatedU( ((spin + 2) % 4 < 2) ? 1 : 6 );
u4 = whiteIcon.getInterpolatedU( ((spin + 3) % 4 < 2) ? 1 : 6 );
v1 = whiteIcon.getInterpolatedV( ((spin + 1) % 4 < 2) ? 1 : 3 );
v2 = whiteIcon.getInterpolatedV( ((spin + 2) % 4 < 2) ? 1 : 3 );
v3 = whiteIcon.getInterpolatedV( ((spin + 3) % 4 < 2) ? 1 : 3 );
v4 = whiteIcon.getInterpolatedV( ((spin) % 4 < 2) ? 1 : 3 );
if ( sp.isPowered() )
tess.setBrightness( 15 << 20 | 15 << 4 );
else
tess.setBrightness( 0 );
if ( stat == 1 )
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
if ( stat == 2 )
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
if ( stat == 3 )
Tessellator.instance.setColorOpaque_I( 0xff0000 );
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
{
case 1:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
@@ -317,6 +250,76 @@ public class RenderDrive extends BaseBlockRender
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
break;
}
if( ( forward == ForgeDirection.UP && up == ForgeDirection.SOUTH ) || forward == ForgeDirection.DOWN )
this.selectFace( renderer, west, up, forward, 3 + xx * 7, 4 + xx * 7, 1 + yy * 3, 2 + yy * 3 );
else
this.selectFace( renderer, west, up, forward, 5 + xx * 7, 6 + xx * 7, 2 + yy * 3, 3 + yy * 3 );
if( stat != 0 )
{
IIcon whiteIcon = ExtraBlockTextures.White.getIcon();
u1 = whiteIcon.getInterpolatedU( ( spin % 4 < 2 ) ? 1 : 6 );
u2 = whiteIcon.getInterpolatedU( ( ( spin + 1 ) % 4 < 2 ) ? 1 : 6 );
u3 = whiteIcon.getInterpolatedU( ( ( spin + 2 ) % 4 < 2 ) ? 1 : 6 );
u4 = whiteIcon.getInterpolatedU( ( ( spin + 3 ) % 4 < 2 ) ? 1 : 6 );
v1 = whiteIcon.getInterpolatedV( ( ( spin + 1 ) % 4 < 2 ) ? 1 : 3 );
v2 = whiteIcon.getInterpolatedV( ( ( spin + 2 ) % 4 < 2 ) ? 1 : 3 );
v3 = whiteIcon.getInterpolatedV( ( ( spin + 3 ) % 4 < 2 ) ? 1 : 3 );
v4 = whiteIcon.getInterpolatedV( ( ( spin ) % 4 < 2 ) ? 1 : 3 );
if( sp.isPowered() )
tess.setBrightness( 15 << 20 | 15 << 4 );
else
tess.setBrightness( 0 );
if( stat == 1 )
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
if( stat == 2 )
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
if( stat == 3 )
Tessellator.instance.setColorOpaque_I( 0xff0000 );
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
{
case 1:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
break;
case -1:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
break;
case -2:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
break;
case 2:
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
break;
case 3:
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
break;
case -3:
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
break;
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.client.renderer.RenderBlocks;
@@ -39,35 +40,37 @@ import appeng.client.texture.OffsetIcon;
import appeng.tile.storage.TileChest;
import appeng.util.Platform;
public class RenderMEChest extends BaseBlockRender
{
public RenderMEChest() {
public RenderMEChest()
{
super( false, 0 );
}
@Override
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
Tessellator.instance.setBrightness( 0 );
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ),
renderer );
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
renderer.overrideBlockTexture = null;
super.renderInventory( block, is, renderer, type, obj );
}
@Override
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
TileChest sp = imb.getTileEntity( world, x, y, z );
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
if ( sp == null ) return false;
if( sp == null )
return false;
ForgeDirection up = sp.getUp();
ForgeDirection forward = sp.getForward();
@@ -82,7 +85,7 @@ public class RenderMEChest extends BaseBlockRender
int offsetU = -4;
int offsetV = 8;
if ( stat == 0 )
if( stat == 0 )
offsetV = 3;
int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
@@ -90,15 +93,15 @@ public class RenderMEChest extends BaseBlockRender
Tessellator.instance.setColorOpaque_I( 0xffffff );
FlippableIcon flippableIcon = new FlippableIcon( new OffsetIcon( ExtraBlockTextures.MEStorageCellTextures.getIcon(), offsetU, offsetV ) );
if ( forward == ForgeDirection.EAST && (up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH) )
if( forward == ForgeDirection.EAST && ( up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH ) )
flippableIcon.setFlip( true, false );
else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.EAST )
else if( forward == ForgeDirection.NORTH && up == ForgeDirection.EAST )
flippableIcon.setFlip( false, true );
else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.WEST )
else if( forward == ForgeDirection.NORTH && up == ForgeDirection.WEST )
flippableIcon.setFlip( true, false );
else if ( forward == ForgeDirection.DOWN && up == ForgeDirection.EAST )
else if( forward == ForgeDirection.DOWN && up == ForgeDirection.EAST )
flippableIcon.setFlip( false, true );
else if ( forward == ForgeDirection.DOWN )
else if( forward == ForgeDirection.DOWN )
flippableIcon.setFlip( true, false );
/*
@@ -110,27 +113,27 @@ public class RenderMEChest extends BaseBlockRender
this.renderFace( x, y, z, imb, flippableIcon, renderer, forward );
if ( stat != 0 )
if( stat != 0 )
{
b = 0;
if ( sp.isPowered() )
if( sp.isPowered() )
{
b = 15 << 20 | 15 << 4;
}
Tessellator.instance.setBrightness( b );
if ( stat == 1 )
if( stat == 1 )
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
if ( stat == 2 )
if( stat == 2 )
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
if ( stat == 3 )
if( stat == 3 )
Tessellator.instance.setColorOpaque_I( 0xff0000 );
this.selectFace( renderer, west, up, forward, 9, 10, 11, 12 );
this.renderFace( x, y, z, imb, ExtraBlockTextures.White.getIcon(), renderer, forward );
}
b = world.getLightBrightnessForSkyBlocks( x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0 );
if ( sp.isPowered() )
if( sp.isPowered() )
{
b = 15 << 20 | 15 << 4;
}
@@ -145,7 +148,7 @@ public class RenderMEChest extends BaseBlockRender
IIcon ico = ch == null ? null : ch.getTopTexture_Light();
this.renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
if ( ico != null )
if( ico != null )
{
Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
ico = ch == null ? null : ch.getTopTexture_Medium();
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
@@ -26,23 +27,24 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
public class RenderNull extends BaseBlockRender
{
public RenderNull() {
public RenderNull()
{
super( false, 20 );
}
@Override
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
return true;
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.Collection;
import java.util.EnumSet;
@@ -41,61 +42,12 @@ import appeng.client.render.BaseBlockRender;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.qnb.TileQuantumBridge;
public class RenderQNB extends BaseBlockRender
{
public void renderCableAt(double thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, IIcon texture, double pull,
Collection<ForgeDirection> connections)
{
block.getRendererInstance().setTemporaryRenderIcon( texture );
if ( connections.contains( ForgeDirection.UNKNOWN ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D - thickness, 0.5D + thickness, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.WEST ) )
{
renderer.setRenderBounds( 0.0D, 0.5D - thickness, 0.5D - thickness, 0.5D - thickness - pull, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.EAST ) )
{
renderer.setRenderBounds( 0.5D + thickness + pull, 0.5D - thickness, 0.5D - thickness, 1.0D, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.NORTH ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.0D, 0.5D + thickness, 0.5D + thickness, 0.5D - thickness - pull );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.SOUTH ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D + thickness + pull, 0.5D + thickness, 0.5D + thickness, 1.0D );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.DOWN ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.0D, 0.5D - thickness, 0.5D + thickness, 0.5D - thickness - pull, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.UP ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.5D + thickness + pull, 0.5D - thickness, 0.5D + thickness, 1.0D, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( null );
}
@Override
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
float minPx = 2.0f / 16.0f;
float maxPx = 14.0f / 16.0f;
@@ -105,10 +57,10 @@ public class RenderQNB extends BaseBlockRender
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
TileQuantumBridge tqb = block.getTileEntity( world, x, y, z );
if ( tqb == null )
if( tqb == null )
return false;
renderer.renderAllFaces = true;
@@ -117,11 +69,11 @@ public class RenderQNB extends BaseBlockRender
final IBlocks blocks = definitions.blocks();
final IParts parts = definitions.parts();
for ( Block linkBlock : blocks.quantumLink().maybeBlock().asSet() )
for( Block linkBlock : blocks.quantumLink().maybeBlock().asSet() )
{
if ( tqb.getBlockType() == linkBlock )
if( tqb.getBlockType() == linkBlock )
{
if ( tqb.isFormed() )
if( tqb.isFormed() )
{
EnumSet<ForgeDirection> sides = tqb.getConnections();
@@ -139,18 +91,17 @@ public class RenderQNB extends BaseBlockRender
}
else
{
if ( !tqb.isFormed() )
if( !tqb.isFormed() )
{
float renderMin = 2.0f / 16.0f;
float renderMax = 14.0f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
}
else if ( tqb.isCorner() )
else if( tqb.isCorner() )
{
Item transCoveredCable = parts.cableCovered().item( AEColor.Transparent );
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transCoveredCable.getIconIndex( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.05D,
tqb.getConnections() );
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transCoveredCable.getIconIndex( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.05D, tqb.getConnections() );
float renderMin = 4.0f / 16.0f;
float renderMax = 12.0f / 16.0f;
@@ -158,7 +109,7 @@ public class RenderQNB extends BaseBlockRender
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
if ( tqb.isPowered() )
if( tqb.isPowered() )
{
renderMin = 3.9f / 16.0f;
@@ -168,9 +119,8 @@ public class RenderQNB extends BaseBlockRender
int bn = 15;
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingCornerLight.getIcon(), renderer, side );
}
}
else
@@ -186,7 +136,7 @@ public class RenderQNB extends BaseBlockRender
renderer.setRenderBounds( renderMin, renderMin, 0, renderMax, renderMax, 1 );
renderer.renderStandardBlock( block, x, y, z );
if ( tqb.isPowered() )
if( tqb.isPowered() )
{
renderMin = -0.01f / 16.0f;
renderMax = 16.01f / 16.0f;
@@ -195,7 +145,7 @@ public class RenderQNB extends BaseBlockRender
int bn = 15;
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingEdgeLight.getIcon(), renderer, side );
}
}
@@ -205,4 +155,53 @@ public class RenderQNB extends BaseBlockRender
renderer.renderAllFaces = false;
return true;
}
public void renderCableAt( double thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, IIcon texture, double pull, Collection<ForgeDirection> connections )
{
block.getRendererInstance().setTemporaryRenderIcon( texture );
if( connections.contains( ForgeDirection.UNKNOWN ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D - thickness, 0.5D + thickness, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if( connections.contains( ForgeDirection.WEST ) )
{
renderer.setRenderBounds( 0.0D, 0.5D - thickness, 0.5D - thickness, 0.5D - thickness - pull, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if( connections.contains( ForgeDirection.EAST ) )
{
renderer.setRenderBounds( 0.5D + thickness + pull, 0.5D - thickness, 0.5D - thickness, 1.0D, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if( connections.contains( ForgeDirection.NORTH ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.0D, 0.5D + thickness, 0.5D + thickness, 0.5D - thickness - pull );
renderer.renderStandardBlock( block, x, y, z );
}
if( connections.contains( ForgeDirection.SOUTH ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D + thickness + pull, 0.5D + thickness, 0.5D + thickness, 1.0D );
renderer.renderStandardBlock( block, x, y, z );
}
if( connections.contains( ForgeDirection.DOWN ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.0D, 0.5D - thickness, 0.5D + thickness, 0.5D - thickness - pull, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if( connections.contains( ForgeDirection.UP ) )
{
renderer.setRenderBounds( 0.5D - thickness, 0.5D + thickness + pull, 0.5D - thickness, 0.5D + thickness, 1.0D, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
block.getRendererInstance().setTemporaryRenderIcon( null );
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.Random;
import net.minecraft.client.renderer.RenderBlocks;
@@ -32,117 +33,27 @@ import appeng.client.render.BaseBlockRender;
import appeng.client.texture.ExtraBlockTextures;
import appeng.client.texture.OffsetIcon;
public class RenderQuartzGlass extends BaseBlockRender
{
static byte[][][] offsets;
public RenderQuartzGlass() {
public RenderQuartzGlass()
{
super( false, 0 );
if ( offsets == null )
if( offsets == null )
{
Random r = new Random( 924 );
offsets = new byte[10][10][10];
for (int x = 0; x < 10; x++)
for (int y = 0; y < 10; y++)
for( int x = 0; x < 10; x++ )
for( int y = 0; y < 10; y++ )
r.nextBytes( offsets[x][y] );
}
}
boolean isFlush(AEBaseBlock imb, IBlockAccess world, int x, int y, int z)
{
return this.isGlass( imb, world, x, y, z );
}
boolean isGlass(AEBaseBlock imb, IBlockAccess world, int x, int y, int z)
{
return this.isQuartzGlass( world, x, y, z ) || this.isVibrantQuartzGlass( world, x, y, z );
}
private boolean isQuartzGlass( IBlockAccess world, int x, int y, int z )
{
return AEApi.instance().definitions().blocks().quartzGlass().isSameAs( world, x, y, z );
}
private boolean isVibrantQuartzGlass( IBlockAccess world, int x, int y, int z )
{
return AEApi.instance().definitions().blocks().quartzVibrantGlass().isSameAs( world, x, y, z );
}
void renderEdge(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer, ForgeDirection side, ForgeDirection direction)
{
if ( !this.isFlush( imb, world, x + side.offsetX, y + side.offsetY, z + side.offsetZ ) )
{
if ( !this.isFlush( imb, world, x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ ) )
{
float minX = 0.5f + (side.offsetX + direction.offsetX) / 2.0f;
float minY = 0.5f + (side.offsetY + direction.offsetY) / 2.0f;
float minZ = 0.5f + (side.offsetZ + direction.offsetZ) / 2.0f;
float maxX = 0.5f + (side.offsetX + direction.offsetX) / 2.0f;
float maxY = 0.5f + (side.offsetY + direction.offsetY) / 2.0f;
float maxZ = 0.5f + (side.offsetZ + direction.offsetZ) / 2.0f;
if ( 0 == side.offsetX && 0 == direction.offsetX )
{
minX = 0.0f;
maxX = 1.0f;
}
if ( 0 == side.offsetY && 0 == direction.offsetY )
{
minY = 0.0f;
maxY = 1.0f;
}
if ( 0 == side.offsetZ && 0 == direction.offsetZ )
{
minZ = 0.0f;
maxZ = 1.0f;
}
if ( maxX <= 0.001f )
maxX += 0.9f / 16.0f;
if ( maxY <= 0.001f )
maxY += 0.9f / 16.0f;
if ( maxZ <= 0.001f )
maxZ += 0.9f / 16.0f;
if ( minX >= 0.999f )
minX -= 0.9f / 16.0f;
if ( minY >= 0.999f )
minY -= 0.9f / 16.0f;
if ( minZ >= 0.999f )
minZ -= 0.9f / 16.0f;
renderer.setRenderBounds( minX, minY, minZ, maxX, maxY, maxZ );
switch (side)
{
case WEST:
renderer.renderFaceXNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case EAST:
renderer.renderFaceXPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case NORTH:
renderer.renderFaceZNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case SOUTH:
renderer.renderFaceZPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case DOWN:
renderer.renderFaceYNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case UP:
renderer.renderFaceYPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
default:
break;
}
}
}
}
@Override
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
renderer.overrideBlockTexture = ExtraBlockTextures.GlassFrame.getIcon();
super.renderInventory( block, is, renderer, type, obj );
@@ -151,7 +62,7 @@ public class RenderQuartzGlass extends BaseBlockRender
}
@Override
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
@@ -162,20 +73,20 @@ public class RenderQuartzGlass extends BaseBlockRender
int u = offsets[cx][cy][cz] % 4;
int v = offsets[9 - cx][9 - cy][9 - cz] % 4;
switch (Math.abs( (offsets[cx][cy][cz] + (x + y + z)) % 4 ))
switch( Math.abs( ( offsets[cx][cy][cz] + ( x + y + z ) ) % 4 ) )
{
case 0:
renderer.overrideBlockTexture = new OffsetIcon( imb.getIcon( 0, 0 ), u / 2, v / 2 );
break;
case 1:
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassB.getIcon(), u / 2, v / 2 );
break;
case 2:
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassC.getIcon(), u, v );
break;
case 3:
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassD.getIcon(), u, v );
break;
case 0:
renderer.overrideBlockTexture = new OffsetIcon( imb.getIcon( 0, 0 ), u / 2, v / 2 );
break;
case 1:
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassB.getIcon(), u / 2, v / 2 );
break;
case 2:
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassC.getIcon(), u, v );
break;
case 3:
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassD.getIcon(), u, v );
break;
}
boolean result = renderer.renderStandardBlock( imb, x, y, z );
@@ -214,4 +125,95 @@ public class RenderQuartzGlass extends BaseBlockRender
return result;
}
void renderEdge( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer, ForgeDirection side, ForgeDirection direction )
{
if( !this.isFlush( imb, world, x + side.offsetX, y + side.offsetY, z + side.offsetZ ) )
{
if( !this.isFlush( imb, world, x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ ) )
{
float minX = 0.5f + ( side.offsetX + direction.offsetX ) / 2.0f;
float minY = 0.5f + ( side.offsetY + direction.offsetY ) / 2.0f;
float minZ = 0.5f + ( side.offsetZ + direction.offsetZ ) / 2.0f;
float maxX = 0.5f + ( side.offsetX + direction.offsetX ) / 2.0f;
float maxY = 0.5f + ( side.offsetY + direction.offsetY ) / 2.0f;
float maxZ = 0.5f + ( side.offsetZ + direction.offsetZ ) / 2.0f;
if( 0 == side.offsetX && 0 == direction.offsetX )
{
minX = 0.0f;
maxX = 1.0f;
}
if( 0 == side.offsetY && 0 == direction.offsetY )
{
minY = 0.0f;
maxY = 1.0f;
}
if( 0 == side.offsetZ && 0 == direction.offsetZ )
{
minZ = 0.0f;
maxZ = 1.0f;
}
if( maxX <= 0.001f )
maxX += 0.9f / 16.0f;
if( maxY <= 0.001f )
maxY += 0.9f / 16.0f;
if( maxZ <= 0.001f )
maxZ += 0.9f / 16.0f;
if( minX >= 0.999f )
minX -= 0.9f / 16.0f;
if( minY >= 0.999f )
minY -= 0.9f / 16.0f;
if( minZ >= 0.999f )
minZ -= 0.9f / 16.0f;
renderer.setRenderBounds( minX, minY, minZ, maxX, maxY, maxZ );
switch( side )
{
case WEST:
renderer.renderFaceXNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case EAST:
renderer.renderFaceXPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case NORTH:
renderer.renderFaceZNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case SOUTH:
renderer.renderFaceZPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case DOWN:
renderer.renderFaceYNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
case UP:
renderer.renderFaceYPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
break;
default:
break;
}
}
}
}
boolean isFlush( AEBaseBlock imb, IBlockAccess world, int x, int y, int z )
{
return this.isGlass( imb, world, x, y, z );
}
boolean isGlass( AEBaseBlock imb, IBlockAccess world, int x, int y, int z )
{
return this.isQuartzGlass( world, x, y, z ) || this.isVibrantQuartzGlass( world, x, y, z );
}
private boolean isQuartzGlass( IBlockAccess world, int x, int y, int z )
{
return AEApi.instance().definitions().blocks().quartzGlass().isSameAs( world, x, y, z );
}
private boolean isVibrantQuartzGlass( IBlockAccess world, int x, int y, int z )
{
return AEApi.instance().definitions().blocks().quartzVibrantGlass().isSameAs( world, x, y, z );
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
@@ -28,15 +29,17 @@ import appeng.block.solids.OreQuartz;
import appeng.client.render.BaseBlockRender;
import appeng.client.texture.ExtraBlockTextures;
public class RenderQuartzOre extends BaseBlockRender
{
public RenderQuartzOre() {
public RenderQuartzOre()
{
super( false, 20 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
super.renderInventory( blk, is, renderer, type, obj );
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.OreQuartzStone.getIcon() );
@@ -45,7 +48,7 @@ public class RenderQuartzOre extends BaseBlockRender
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
OreQuartz blk = (OreQuartz) block;
blk.setEnhanceBrightness( true );
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.client.renderer.RenderBlocks;
@@ -34,15 +35,17 @@ import appeng.block.AEBaseBlock;
import appeng.block.misc.BlockQuartzTorch;
import appeng.client.render.BaseBlockRender;
public class RenderQuartzTorch extends BaseBlockRender
{
public RenderQuartzTorch() {
public RenderQuartzTorch()
{
super( false, 20 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
Tessellator tess = Tessellator.instance;
@@ -90,15 +93,14 @@ public class RenderQuartzTorch extends BaseBlockRender
renderer.renderAllFaces = false;
blk.getRendererInstance().setTemporaryRenderIcon( null );
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
BlockQuartzTorch blk = (BlockQuartzTorch) block;
IOrientable te = ((IOrientableBlock) block).getOrientable( world, x, y, z );
IOrientable te = ( (IOrientableBlock) block ).getOrientable( world, x, y, z );
float Point2 = 6.0f / 16.0f;
float Point3 = 7.0f / 16.0f;
@@ -117,19 +119,19 @@ public class RenderQuartzTorch extends BaseBlockRender
float zOff = 0.0f;
renderer.renderAllFaces = true;
if ( te != null )
if( te != null )
{
ForgeDirection forward = te.getUp();
xOff = forward.offsetX * -(4.0f / 16.0f);
yOff = forward.offsetY * -(4.0f / 16.0f);
zOff = forward.offsetZ * -(4.0f / 16.0f);
xOff = forward.offsetX * -( 4.0f / 16.0f );
yOff = forward.offsetY * -( 4.0f / 16.0f );
zOff = forward.offsetZ * -( 4.0f / 16.0f );
}
renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
super.renderInWorld( block, world, x, y, z, renderer );
int r = (x + y + z) % 2;
if ( r == 0 )
int r = ( x + y + z ) % 2;
if( r == 0 )
{
renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
super.renderInWorld( block, world, x, y, z, renderer );
@@ -160,48 +162,48 @@ public class RenderQuartzTorch extends BaseBlockRender
renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
renderer.renderStandardBlock( blk, x, y, z );
if ( te != null )
if( te != null )
{
ForgeDirection forward = te.getUp();
switch (forward)
switch( forward )
{
case EAST:
renderer.setRenderBounds( 0, bottom + yOff, bottom + zOff, Point2 + xOff, top + yOff, top + zOff );
renderer.renderStandardBlock( blk, x, y, z );
break;
case WEST:
renderer.setRenderBounds( Point13 + xOff, bottom + yOff, bottom + zOff, 1.0, top + yOff, top + zOff );
renderer.renderStandardBlock( blk, x, y, z );
break;
case NORTH:
renderer.setRenderBounds( bottom + xOff, bottom + yOff, Point13 + zOff, top + xOff, top + yOff, 1.0 );
renderer.renderStandardBlock( blk, x, y, z );
break;
case SOUTH:
renderer.setRenderBounds( bottom + xOff, bottom + yOff, 0, top + xOff, top + yOff, Point2 + zOff );
renderer.renderStandardBlock( blk, x, y, z );
break;
case UP:
renderer.setRenderBounds( Point2, 0, Point2, Point3, bottom + yOff, Point3 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point2, 0, Point12, Point3, bottom + yOff, Point13 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point12, 0, Point2, Point13, bottom + yOff, Point3 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point12, 0, Point12, Point13, bottom + yOff, Point13 );
renderer.renderStandardBlock( blk, x, y, z );
break;
case DOWN:
renderer.setRenderBounds( Point2, top + yOff, Point2, Point3, 1.0, Point3 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point2, top + yOff, Point12, Point3, 1.0, Point13 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point12, top + yOff, Point2, Point13, 1.0, Point3 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point12, top + yOff, Point12, Point13, 1.0, Point13 );
renderer.renderStandardBlock( blk, x, y, z );
break;
default:
case EAST:
renderer.setRenderBounds( 0, bottom + yOff, bottom + zOff, Point2 + xOff, top + yOff, top + zOff );
renderer.renderStandardBlock( blk, x, y, z );
break;
case WEST:
renderer.setRenderBounds( Point13 + xOff, bottom + yOff, bottom + zOff, 1.0, top + yOff, top + zOff );
renderer.renderStandardBlock( blk, x, y, z );
break;
case NORTH:
renderer.setRenderBounds( bottom + xOff, bottom + yOff, Point13 + zOff, top + xOff, top + yOff, 1.0 );
renderer.renderStandardBlock( blk, x, y, z );
break;
case SOUTH:
renderer.setRenderBounds( bottom + xOff, bottom + yOff, 0, top + xOff, top + yOff, Point2 + zOff );
renderer.renderStandardBlock( blk, x, y, z );
break;
case UP:
renderer.setRenderBounds( Point2, 0, Point2, Point3, bottom + yOff, Point3 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point2, 0, Point12, Point3, bottom + yOff, Point13 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point12, 0, Point2, Point13, bottom + yOff, Point3 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point12, 0, Point12, Point13, bottom + yOff, Point13 );
renderer.renderStandardBlock( blk, x, y, z );
break;
case DOWN:
renderer.setRenderBounds( Point2, top + yOff, Point2, Point3, 1.0, Point3 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point2, top + yOff, Point12, Point3, 1.0, Point13 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point12, top + yOff, Point2, Point13, 1.0, Point3 );
renderer.renderStandardBlock( blk, x, y, z );
renderer.setRenderBounds( Point12, top + yOff, Point12, Point13, 1.0, Point13 );
renderer.renderStandardBlock( blk, x, y, z );
break;
default:
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
@@ -26,22 +27,24 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
public class RenderTinyTNT extends BaseBlockRender
{
public RenderTinyTNT() {
public RenderTinyTNT()
{
super( false, 0 );
}
@Override
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
super.renderInventory( block, is, renderer, type, obj );
}
@Override
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
renderer.renderAllFaces = true;
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
@@ -49,5 +52,4 @@ public class RenderTinyTNT extends BaseBlockRender
renderer.renderAllFaces = false;
return out;
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
@@ -31,30 +32,32 @@ import appeng.client.render.BusRenderer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
public class RendererCableBus extends BaseBlockRender
{
public RendererCableBus() {
public RendererCableBus()
{
super( true, 30 );
}
@Override
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
// nothing.
}
@Override
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
AEBaseTile t = block.getTileEntity( world, x, y, z );
if ( t instanceof TileCableBus )
if( t instanceof TileCableBus )
{
BusRenderer.INSTANCE.renderer.renderAllFaces = true;
BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
BusRenderer.INSTANCE.renderer.overrideBlockTexture = renderer.overrideBlockTexture;
((TileCableBus) t).cb.renderStatic( x, y, z );
( (TileCableBus) t ).cb.renderStatic( x, y, z );
BusRenderer.INSTANCE.renderer.renderAllFaces = false;
}
@@ -62,13 +65,12 @@ public class RendererCableBus extends BaseBlockRender
}
@Override
public void renderTile(AEBaseBlock block, AEBaseTile t, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
public void renderTile( AEBaseBlock block, AEBaseTile t, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
if ( t instanceof TileCableBus )
if( t instanceof TileCableBus )
{
BusRenderer.INSTANCE.renderer.overrideBlockTexture = null;
((TileCableBus) t).cb.renderDynamic( x, y, z );
( (TileCableBus) t ).cb.renderDynamic( x, y, z );
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.client.renderer.RenderBlocks;
@@ -34,29 +35,30 @@ import appeng.client.render.BaseBlockRender;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.misc.TileSecurity;
public class RendererSecurity extends BaseBlockRender
{
public RendererSecurity() {
public RendererSecurity()
{
super( false, 0 );
}
@Override
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
{
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ),
renderer );
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
renderer.overrideBlockTexture = null;
super.renderInventory( block, is, renderer, type, obj );
}
@Override
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
TileSecurity sp = imb.getTileEntity( world, x, y, z );
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
@@ -68,7 +70,7 @@ public class RendererSecurity extends BaseBlockRender
boolean result = renderer.renderStandardBlock( imb, x, y, z );
int b = world.getLightBrightnessForSkyBlocks( x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0 );
if ( sp.isActive() )
if( sp.isActive() )
{
b = 15 << 20 | 15 << 4;
}
@@ -80,7 +82,7 @@ public class RendererSecurity extends BaseBlockRender
Tessellator.instance.setColorOpaque_I( sp.getColor().whiteVariant );
IIcon ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Light.getIcon() : ExtraBlockTextures.MEChest.getIcon();
this.renderFace( x, y, z, imb, ico, renderer, up );
if ( sp.isActive() )
if( sp.isActive() )
{
Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Medium.getIcon() : ExtraBlockTextures.MEChest.getIcon();
@@ -34,8 +34,8 @@ public class AssemblerFX extends EntityFX
final IAEItemStack item;
final EntityFloatingItem fi;
float time = 0;
final float speed;
float time = 0;
public AssemblerFX( World w, double x, double y, double z, double r, double g, double b, float speed, IAEItemStack is )
{
@@ -47,7 +47,7 @@ public class AssemblerFX extends EntityFX
this.speed = speed;
this.fi = new EntityFloatingItem( this, w, x, y, z, is.getItemStack() );
w.spawnEntityInWorld( this.fi );
this.particleMaxAge = ( int ) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
this.noClip = true;
}
@@ -63,11 +63,11 @@ public class AssemblerFX extends EntityFX
{
super.onUpdate();
if ( this.isDead )
if( this.isDead )
this.fi.setDead();
else
{
float lifeSpan = ( float ) this.particleAge / ( float ) this.particleMaxAge;
float lifeSpan = (float) this.particleAge / (float) this.particleMaxAge;
this.fi.setProgress( lifeSpan );
}
}
@@ -76,13 +76,12 @@ public class AssemblerFX extends EntityFX
public void renderParticle( Tessellator tess, float l, float rX, float rY, float rZ, float rYZ, float rXY )
{
this.time += l;
if ( this.time > 4.0 )
if( this.time > 4.0 )
{
this.time -= 4.0;
// if ( CommonHelper.proxy.shouldAddParticles( r ) )
for ( int x = 0; x < ( int ) Math.ceil( this.speed / 5 ); x++ )
for( int x = 0; x < (int) Math.ceil( this.speed / 5 ); x++ )
CommonHelper.proxy.spawnEffect( EffectType.Crafting, this.worldObj, this.posX, this.posY, this.posZ, null );
}
}
}
@@ -29,7 +29,6 @@ public class ChargedOreFX extends EntityReddustFX
public ChargedOreFX( World w, double x, double y, double z, float r, float g, float b )
{
super( w, x, y, z, 0.21f, 0.61f, 1.0f );
}
@Override
@@ -38,9 +37,8 @@ public class ChargedOreFX extends EntityReddustFX
int j1 = super.getBrightnessForRender( par1 );
j1 = Math.max( j1 >> 20, j1 >> 4 );
j1 += 3;
if ( j1 > 15 )
if( j1 > 15 )
j1 = 15;
return j1 << 20 | j1 << 4;
}
}
@@ -43,12 +43,6 @@ public class CraftingFx extends EntityBreakingFX
private final int startBlkY;
private final int startBlkZ;
@Override
public int getFXLayer()
{
return 1;
}
public CraftingFx( World par1World, double par2, double par4, double par6, Item par8Item )
{
super( par1World, par2, par4, par6, par8Item );
@@ -68,6 +62,47 @@ public class CraftingFx extends EntityBreakingFX
this.noClip = true;
}
@Override
public int getFXLayer()
{
return 1;
}
@Override
public void renderParticle( Tessellator par1Tessellator, float partialTick, float x, float y, float z, float rx, float rz )
{
if( partialTick < 0 || partialTick > 1 )
return;
float f6 = this.particleTextureIndex.getMinU();
float f7 = this.particleTextureIndex.getMaxU();
float f8 = this.particleTextureIndex.getMinV();
float f9 = this.particleTextureIndex.getMaxV();
float scale = 0.1F * this.particleScale;
float offX = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * partialTick );
float offY = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTick );
float offZ = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTick );
float f14 = 1.0F;
int blkX = MathHelper.floor_double( offX );
int blkY = MathHelper.floor_double( offY );
int blkZ = MathHelper.floor_double( offZ );
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
offX -= interpPosX;
offY -= interpPosY;
offZ -= interpPosZ;
// AELog.info( "" + partialTick );
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( offX - x * scale - rx * scale, offY - y * scale, offZ - z * scale - rz * scale, f7, f9 );
par1Tessellator.addVertexWithUV( offX - x * scale + rx * scale, offY + y * scale, offZ - z * scale + rz * scale, f7, f8 );
par1Tessellator.addVertexWithUV( offX + x * scale + rx * scale, offY + y * scale, offZ + z * scale + rz * scale, f6, f8 );
par1Tessellator.addVertexWithUV( offX + x * scale - rx * scale, offY - y * scale, offZ + z * scale - rz * scale, f6, f9 );
}
}
public void fromItem( ForgeDirection d )
{
this.posX += 0.2 * d.offsetX;
@@ -83,44 +118,4 @@ public class CraftingFx extends EntityBreakingFX
this.particleScale *= 0.51f;
this.particleAlpha *= 0.51f;
}
@Override
public void renderParticle( Tessellator par1Tessellator, float partialTick, float x, float y, float z, float rx, float rz )
{
if ( partialTick < 0 || partialTick > 1 )
return;
float f6 = this.particleTextureIndex.getMinU();
float f7 = this.particleTextureIndex.getMaxU();
float f8 = this.particleTextureIndex.getMinV();
float f9 = this.particleTextureIndex.getMaxV();
float scale = 0.1F * this.particleScale;
float offX = ( float ) ( this.prevPosX + ( this.posX - this.prevPosX ) * partialTick );
float offY = ( float ) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTick );
float offZ = ( float ) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTick );
float f14 = 1.0F;
int blkX = MathHelper.floor_double( offX );
int blkY = MathHelper.floor_double( offY );
int blkZ = MathHelper.floor_double( offZ );
if ( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
offX -= interpPosX;
offY -= interpPosY;
offZ -= interpPosZ;
// AELog.info( "" + partialTick );
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( offX - x * scale - rx * scale, offY - y * scale, offZ - z * scale - rz * scale,
f7, f9 );
par1Tessellator.addVertexWithUV( offX - x * scale + rx * scale, offY + y * scale, offZ - z * scale + rz * scale,
f7, f8 );
par1Tessellator.addVertexWithUV( offX + x * scale + rx * scale, offY + y * scale, offZ + z * scale + rz * scale,
f6, f8 );
par1Tessellator.addVertexWithUV( offX + x * scale - rx * scale, offY - y * scale, offZ + z * scale - rz * scale,
f6, f9 );
}
}
}
@@ -43,12 +43,6 @@ public class EnergyFx extends EntityBreakingFX
private final int startBlkY;
private final int startBlkZ;
@Override
public int getFXLayer()
{
return 1;
}
public EnergyFx( World par1World, double par2, double par4, double par6, Item par8Item )
{
super( par1World, par2, par4, par6, par8Item );
@@ -67,6 +61,40 @@ public class EnergyFx extends EntityBreakingFX
this.noClip = true;
}
@Override
public int getFXLayer()
{
return 1;
}
@Override
public void renderParticle( Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7 )
{
float f6 = this.particleTextureIndex.getMinU();
float f7 = this.particleTextureIndex.getMaxU();
float f8 = this.particleTextureIndex.getMinV();
float f9 = this.particleTextureIndex.getMaxV();
float f10 = 0.1F * this.particleScale;
float f11 = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
float f12 = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
float f14 = 1.0F;
int blkX = MathHelper.floor_double( this.posX );
int blkY = MathHelper.floor_double( this.posY );
int blkZ = MathHelper.floor_double( this.posZ );
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9 );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9 );
}
}
public void fromItem( ForgeDirection d )
{
this.posX += 0.2 * d.offsetX;
@@ -82,37 +110,4 @@ public class EnergyFx extends EntityBreakingFX
this.particleScale *= 0.89f;
this.particleAlpha *= 0.89f;
}
@Override
public void renderParticle( Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7 )
{
float f6 = this.particleTextureIndex.getMinU();
float f7 = this.particleTextureIndex.getMaxU();
float f8 = this.particleTextureIndex.getMinV();
float f9 = this.particleTextureIndex.getMaxV();
float f10 = 0.1F * this.particleScale;
float f11 = ( float ) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
float f12 = ( float ) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
float f13 = ( float ) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
float f14 = 1.0F;
int blkX = MathHelper.floor_double( this.posX );
int blkY = MathHelper.floor_double( this.posY );
int blkZ = MathHelper.floor_double( this.posZ );
if ( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10,
f7, f9 );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10,
f7, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10,
f6, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10,
f6, f9 );
}
}
}
@@ -53,13 +53,11 @@ public class LightningArcFX extends LightningFX
double lastDirectionZ = this.rz * i;
double len = Math.sqrt( lastDirectionX * lastDirectionX + lastDirectionY * lastDirectionY + lastDirectionZ * lastDirectionZ );
for ( int s = 0; s < this.steps; s++ )
for( int s = 0; s < this.steps; s++ )
{
this.Steps[s][0] = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
this.Steps[s][1] = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
this.Steps[s][2] = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
}
}
}
@@ -32,9 +32,19 @@ import net.minecraft.world.World;
public class LightningFX extends EntityFX
{
final int steps = this.getSteps();
private static final Random RANDOM_GENERATOR = new Random();
final int steps = this.getSteps();
final double[][] Steps;
final double[] I = new double[3];
final double[] K = new double[3];
float currentPoint = 0;
boolean hasData = false;
public LightningFX( World w, double x, double y, double z, double r, double g, double b )
{
this( w, x, y, z, r, g, b, 6 );
this.regen();
}
protected LightningFX( World w, double x, double y, double z, double r, double g, double b, int maxAge )
{
@@ -47,19 +57,24 @@ public class LightningFX extends EntityFX
this.noClip = true;
}
protected void regen()
{
double lastDirectionX = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
double lastDirectionY = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
double lastDirectionZ = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
for( int s = 0; s < this.steps; s++ )
{
this.Steps[s][0] = lastDirectionX = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.Steps[s][1] = lastDirectionY = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.Steps[s][2] = lastDirectionZ = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
}
}
private int getSteps()
{
return 5;
}
public LightningFX( World w, double x, double y, double z, double r, double g, double b )
{
this( w, x, y, z, r, g, b, 6 );
this.regen();
}
float currentPoint = 0;
@Override
public int getBrightnessForRender( float par1 )
{
@@ -67,25 +82,12 @@ public class LightningFX extends EntityFX
return j1 << 20 | j1 << 4;
}
protected void regen()
{
double lastDirectionX = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
double lastDirectionY = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
double lastDirectionZ = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
for ( int s = 0; s < this.steps; s++ )
{
this.Steps[s][0] = lastDirectionX = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.Steps[s][1] = lastDirectionY = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.Steps[s][2] = lastDirectionZ = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
}
}
@Override
public void renderParticle( Tessellator tess, float l, float rX, float rY, float rZ, float rYZ, float rXY )
{
float j = 1.0f;
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.95f, this.particleBlue * j, this.particleAlpha );
if ( this.particleAge == 3 )
if( this.particleAge == 3 )
{
this.regen();
}
@@ -108,12 +110,12 @@ public class LightningFX extends EntityFX
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
double offX = -rZ;
double offY = MathHelper.cos( ( float ) ( Math.PI / 2.0f + p.rotationPitch * 0.017453292F ) );
double offY = MathHelper.cos( (float) ( Math.PI / 2.0f + p.rotationPitch * 0.017453292F ) );
double offZ = rX;
for ( int layer = 0; layer < 2; layer++ )
for( int layer = 0; layer < 2; layer++ )
{
if ( layer == 0 )
if( layer == 0 )
{
scale = 0.04;
offX *= 0.001;
@@ -130,7 +132,7 @@ public class LightningFX extends EntityFX
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.65f, this.particleBlue * j * 0.85f, this.particleAlpha );
}
for ( int cycle = 0; cycle < 3; cycle++ )
for( int cycle = 0; cycle < 3; cycle++ )
{
this.clear();
@@ -138,7 +140,7 @@ public class LightningFX extends EntityFX
double y = ( this.prevPosY + ( this.posY - this.prevPosY ) * l - interpPosY ) - offY;
double z = ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * l - interpPosZ ) - offZ;
for ( int s = 0; s < this.steps; s++ )
for( int s = 0; s < this.steps; s++ )
{
double xN = x + this.Steps[s][0];
double yN = y + this.Steps[s][1];
@@ -148,26 +150,26 @@ public class LightningFX extends EntityFX
double yD = yN - y;
double zD = zN - z;
if ( cycle == 0 )
if( cycle == 0 )
{
ox = ( yD * 0 ) - ( 1 * zD );
oy = ( zD * 0 ) - ( 0 * xD );
oz = ( xD * 1 ) - ( 0 * yD );
}
if ( cycle == 1 )
if( cycle == 1 )
{
ox = ( yD * 1 ) - ( 0 * zD );
oy = ( zD * 0 ) - ( 1 * xD );
oz = ( xD * 0 ) - ( 0 * yD );
}
if ( cycle == 2 )
if( cycle == 2 )
{
ox = ( yD * 0 ) - ( 0 * zD );
oy = ( zD * 1 ) - ( 0 * xD );
oz = ( xD * 0 ) - ( 1 * yD );
}
double ss = Math.sqrt( ox * ox + oy * oy + oz * oz ) / ( ( ( ( double ) this.steps - ( double ) s ) / this.steps ) * scale );
double ss = Math.sqrt( ox * ox + oy * oy + oz * oz ) / ( ( ( (double) this.steps - (double) s ) / this.steps ) * scale );
ox /= ss;
oy /= ss;
oz /= ss;
@@ -194,13 +196,14 @@ public class LightningFX extends EntityFX
*/
}
boolean hasData = false;
final double[] I = new double[3];
final double[] K = new double[3];
private void clear()
{
this.hasData = false;
}
private void draw( Tessellator tess, double[] a, double[] b, double f6, double f8 )
{
if ( this.hasData )
if( this.hasData )
{
tess.addVertexWithUV( a[0], a[1], a[2], f6, f8 );
tess.addVertexWithUV( this.I[0], this.I[1], this.I[2], f6, f8 );
@@ -208,15 +211,10 @@ public class LightningFX extends EntityFX
tess.addVertexWithUV( b[0], b[1], b[2], f6, f8 );
}
this.hasData = true;
for ( int x = 0; x < 3; x++ )
for( int x = 0; x < 3; x++ )
{
this.I[x] = a[x];
this.K[x] = b[x];
}
}
private void clear()
{
this.hasData = false;
}
}
@@ -78,20 +78,15 @@ public class MatterCannonFX extends EntityBreakingFX
float f9 = this.particleTextureIndex.getMaxV();
float f10 = 0.05F * this.particleScale;
float f11 = ( float ) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
float f12 = ( float ) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
float f13 = ( float ) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
float f11 = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
float f12 = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
float f14 = 1.0F;
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10,
f7, f9 );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10,
f7, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10,
f6, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10,
f6, f9 );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9 );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9 );
}
}
@@ -46,7 +46,7 @@ public class VibrantFX extends EntityFX
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.particleMaxAge = ( int ) ( 20.0D / ( Math.random() * 0.8D + 0.1D ) );
this.particleMaxAge = (int) ( 20.0D / ( Math.random() * 0.8D + 0.1D ) );
this.noClip = true;
}
@@ -68,7 +68,7 @@ public class VibrantFX extends EntityFX
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.particleScale *= 0.95;
if ( this.particleMaxAge <= 0 || this.particleScale < 0.1 )
if( this.particleMaxAge <= 0 || this.particleScale < 0.1 )
{
this.setDead();
}
@@ -18,6 +18,7 @@
package appeng.client.render.items;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@@ -29,6 +30,7 @@ import net.minecraftforge.client.IItemRenderer;
import appeng.items.misc.ItemEncodedPattern;
public class ItemEncodedPatternRenderer implements IItemRenderer
{
@@ -36,14 +38,14 @@ public class ItemEncodedPatternRenderer implements IItemRenderer
boolean recursive;
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
public boolean handleRenderType( ItemStack item, ItemRenderType type )
{
boolean isShiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT );
if ( !this.recursive && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
if( !this.recursive && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
{
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
if ( iep.getOutput( item ) != null )
if( iep.getOutput( item ) != null )
return true;
}
@@ -51,13 +53,13 @@ public class ItemEncodedPatternRenderer implements IItemRenderer
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
{
return false;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
{
this.recursive = true;
@@ -31,26 +31,27 @@ 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)
public boolean handleRenderType( ItemStack item, ItemRenderType type )
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
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)
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
{
IIcon par2Icon = item.getIconIndex();
if ( item.getItemDamage() >= 20 )
if( item.getItemDamage() >= 20 )
par2Icon = ExtraItemTextures.ItemPaintBallShimmer.getIcon();
float f4 = par2Icon.getMinU();
@@ -68,19 +69,19 @@ public class PaintBallRender implements IItemRenderer
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 r = ( colorValue >> 16 ) & 0xff;
int g = ( colorValue >> 8 ) & 0xff;
int b = ( colorValue ) & 0xff;
int full = (int) (255 * 0.3);
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 );
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 )
if( type == ItemRenderType.INVENTORY )
{
GL11.glScalef( 16F, 16F, 10F );
GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
@@ -97,7 +98,7 @@ public class PaintBallRender implements IItemRenderer
}
else
{
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
else
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );

Some files were not shown because too many files have changed in this diff Show More