Add Stained Glass facades.

The Item Bus Renderer can now deal with Alpha Pass.
This commit is contained in:
AlgorithmX2 2014-05-04 15:46:38 -05:00
parent 788dbb8610
commit 4d5a6ce301
3 changed files with 35 additions and 6 deletions

View file

@ -10,10 +10,13 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import appeng.api.parts.IAlphaPassItem;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import appeng.client.ClientHelper;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.facade.IFacadeItem;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
@ -63,11 +66,24 @@ public class BusRenderer implements IItemRenderer
GL11.glPushMatrix();
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
GL11.glEnable( GL11.GL_ALPHA_TEST );
GL11.glEnable( GL11.GL_DEPTH_TEST );
GL11.glEnable( GL11.GL_TEXTURE_2D );
GL11.glEnable( GL11.GL_LIGHTING );
GL11.glDisable( GL11.GL_BLEND );
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 );
GL11.glDisable( GL11.GL_ALPHA_TEST );
GL11.glEnable( GL11.GL_BLEND );
}
else
{
GL11.glAlphaFunc( GL11.GL_GREATER, 0.4f );
GL11.glEnable( GL11.GL_ALPHA_TEST );
GL11.glDisable( GL11.GL_BLEND );
}
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
{
@ -79,7 +95,6 @@ public class BusRenderer implements IItemRenderer
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 )

View file

@ -50,7 +50,9 @@ public enum AEFeature
Logging("Misc"), IntegrationLogging("Misc", false), CustomRecipes("Crafting", false), WebsiteRecipes("Misc", false),
enableFacadeCrafting("Crafting"), inWorldSingularity("Crafting"), inWorldFluix("Crafting"), inWorldPurification("Crafting"), UpdateLogging("Misc", false);
enableFacadeCrafting("Crafting"), inWorldSingularity("Crafting"), inWorldFluix("Crafting"), inWorldPurification("Crafting"), UpdateLogging("Misc", false),
AlphaPass("Rendering");
String Category;
boolean visible = true;

View file

@ -6,6 +6,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.BlockStainedGlass;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@ -17,6 +18,7 @@ import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.parts.IAlphaPassItem;
import appeng.block.solids.OreQuartz;
import appeng.client.render.BusRenderer;
import appeng.core.FacadeConfig;
@ -28,7 +30,7 @@ import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemFacade extends AEBaseItem implements IFacadeItem
public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassItem
{
public ItemFacade() {
@ -141,7 +143,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem
int metadata = l.getItem().getMetadata( l.getItemDamage() );
boolean hasTile = b.hasTileEntity( metadata );
boolean enableGlass = b instanceof BlockGlass;
boolean enableGlass = b instanceof BlockGlass || b instanceof BlockStainedGlass;
boolean disableOre = b instanceof OreQuartz;
boolean defaultValue = (b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre) || enableGlass;
@ -207,4 +209,14 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem
return super.getItemStackDisplayName( is );
}
@Override
public boolean useAlphaPass(ItemStack is)
{
ItemStack out = getTextureItem( is );
Block blk = Block.getBlockFromItem( out.getItem() );
if ( blk != null && blk.canRenderInPass( 1 ) )
return true;
return false;
}
}