New facade system (#3702)

Completely new system to render facades.

It will now support many more cases compared to the old system.
For example connected textures are now possible, as well as multilayer models and so on.
This commit is contained in:
covers1624
2018-09-02 19:29:37 +09:30
committed by yueh
parent ed8baf8c15
commit 7ba2893635
31 changed files with 2965 additions and 599 deletions
@@ -1291,79 +1291,10 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( blockState != null && textureItem != null )
{
final EnumSet<EnumFacing> openFaces = this.calculateFaceOpenFaces( side );
return new FacadeRenderState( blockState, openFaces, textureItem );
return new FacadeRenderState( blockState, !facade.getBlockState().isOpaqueCube() );
}
}
return null;
}
private EnumSet<EnumFacing> calculateFaceOpenFaces( EnumFacing side )
{
final EnumSet<EnumFacing> out = EnumSet.of( side, side.getOpposite() );
final IFacadePart facade = this.getFacade( side.ordinal() );
final IBlockAccess blockAccess = this.getTile().getWorld();
final BlockPos pos = this.getTile().getPos();
for( final EnumFacing it : EnumFacing.values() )
{
if( !out.contains( it ) && this.hasAlphaDiff( blockAccess.getTileEntity( pos.offset( it ) ), side, facade ) )
{
out.add( it );
}
}
if( out.contains( EnumFacing.UP ) && ( side.getFrontOffsetX() != 0 || side.getFrontOffsetZ() != 0 ) )
{
final IFacadePart fp = this.getFacade( EnumFacing.UP.ordinal() );
if( fp != null && ( fp.isTransparent() == facade.isTransparent() ) )
{
out.remove( EnumFacing.UP );
}
}
if( out.contains( EnumFacing.DOWN ) && ( side.getFrontOffsetX() != 0 || side.getFrontOffsetZ() != 0 ) )
{
final IFacadePart fp = this.getFacade( EnumFacing.DOWN.ordinal() );
if( fp != null && ( fp.isTransparent() == facade.isTransparent() ) )
{
out.remove( EnumFacing.DOWN );
}
}
if( out.contains( EnumFacing.SOUTH ) && ( side.getFrontOffsetX() != 0 ) )
{
final IFacadePart fp = this.getFacade( EnumFacing.SOUTH.ordinal() );
if( fp != null && ( fp.isTransparent() == facade.isTransparent() ) )
{
out.remove( EnumFacing.SOUTH );
}
}
if( out.contains( EnumFacing.NORTH ) && ( side.getFrontOffsetX() != 0 ) )
{
final IFacadePart fp = this.getFacade( EnumFacing.NORTH.ordinal() );
if( fp != null && ( fp.isTransparent() == facade.isTransparent() ) )
{
out.remove( EnumFacing.NORTH );
}
}
return out;
}
private boolean hasAlphaDiff( final TileEntity tileEntity, final EnumFacing side, final IFacadePart facade )
{
if( tileEntity instanceof IPartHost )
{
final IPartHost ph = (IPartHost) tileEntity;
final IFacadePart fp = ph.getFacadeContainer().getFacade( AEPartLocation.fromFacing( side ) );
return fp == null || ( fp.isTransparent() != facade.isTransparent() );
}
return true;
}
}