Fixes #2448: Facades items and blocks now use the same algorithm to determine the block texture.

Facades will now use the correct side to determine the texture to use, and will fall back to general quads.
Fixed crafting of facades on the server by removing the check for model simplicity.
This commit is contained in:
Sebastian Hartte
2016-10-09 21:59:56 +02:00
parent 5de15d5b2c
commit 55d66be929
5 changed files with 63 additions and 41 deletions
@@ -26,9 +26,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.BlockStainedGlass;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -136,33 +133,14 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
}
private static boolean hasSimpleModel( Block b, IBlockState blockState )
private static boolean hasSimpleModel( IBlockState blockState )
{
if( b.getRenderType( blockState ) != EnumBlockRenderType.MODEL )
if( blockState.getRenderType() != EnumBlockRenderType.MODEL )
{
return false;
}
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState( blockState );
for( EnumFacing facing : EnumFacing.values() )
{
List<BakedQuad> quads = model.getQuads( blockState, facing, 0 );
if( quads.size() != 1 )
{
return false;
}
BakedQuad q = quads.get( 0 );
if( q.getFace() != facing )
{
return false;
}
// TODO We could also check that the quad is fully encompassing the side
}
return true;
return blockState.isFullCube();
}
public ItemStack createFacadeForItem( final ItemStack l, final boolean returnItem )
@@ -197,7 +175,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return null;
}
final boolean defaultValue = ( b.isFullyOpaque( blockState ) && hasSimpleModel( b, blockState ) && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
final boolean defaultValue = ( b.isFullyOpaque( blockState ) && hasSimpleModel( blockState ) && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
if( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
{
if( returnItem )