2014-01-27 05:00:36 +01:00
|
|
|
package appeng.client.render.blocks;
|
|
|
|
|
|
|
|
import java.util.EnumSet;
|
|
|
|
|
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
|
|
import net.minecraft.client.renderer.Tessellator;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraft.util.IIcon;
|
2014-01-27 05:00:36 +01:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2014-03-02 09:35:11 +01:00
|
|
|
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
2014-01-27 05:00:36 +01:00
|
|
|
import appeng.block.AEBaseBlock;
|
|
|
|
import appeng.client.render.BaseBlockRender;
|
|
|
|
import appeng.client.texture.ExtraTextures;
|
|
|
|
import appeng.tile.misc.TileSecurity;
|
|
|
|
|
|
|
|
public class RendererSecurity extends BaseBlockRender
|
|
|
|
{
|
|
|
|
|
|
|
|
public RendererSecurity() {
|
|
|
|
super( false, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-03-02 09:35:11 +01:00
|
|
|
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
2014-01-27 05:00:36 +01:00
|
|
|
{
|
|
|
|
renderer.overrideBlockTexture = ExtraTextures.getMissing();
|
2014-03-01 04:45:30 +01:00
|
|
|
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
2014-01-27 05:00:36 +01:00
|
|
|
|
|
|
|
renderer.overrideBlockTexture = ExtraTextures.MEChest.getIcon();
|
2014-03-01 04:45:30 +01:00
|
|
|
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, 0xffffff, renderer );
|
2014-01-27 05:00:36 +01:00
|
|
|
|
|
|
|
renderer.overrideBlockTexture = null;
|
2014-03-02 09:35:11 +01:00
|
|
|
super.renderInventory( block, is, renderer, type );
|
2014-01-27 05:00:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
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 );
|
|
|
|
|
|
|
|
ForgeDirection up = sp.getUp();
|
|
|
|
|
|
|
|
preRenderInWorld( imb, world, x, y, z, renderer );
|
|
|
|
|
|
|
|
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() )
|
|
|
|
{
|
|
|
|
b = 15 << 20 | 15 << 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
Tessellator.instance.setBrightness( b );
|
|
|
|
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
|
|
|
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
IIcon ico = sp.isActive() ? ExtraTextures.BlockMESecurityOn.getIcon() : ExtraTextures.MEChest.getIcon();
|
2014-01-27 05:00:36 +01:00
|
|
|
renderFace( x, y, z, imb, ico, renderer, up );
|
|
|
|
|
|
|
|
renderer.overrideBlockTexture = null;
|
|
|
|
postRenderInWorld( renderer );
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|