|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package mmm.deco;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import mmm.Mmm;
|
|
|
|
@ -31,71 +32,81 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
|
|
public class DBlockTable extends Block implements I_URecipeRegistrar {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class DBlockTable
|
|
|
|
|
extends Block
|
|
|
|
|
implements I_URecipeRegistrar
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public final static String ID = "deco_table_";
|
|
|
|
|
public final static String NAME = Mmm.PREFIX + ID;
|
|
|
|
|
public final static String NAME = Mmm.PREFIX + DBlockTable.ID;
|
|
|
|
|
|
|
|
|
|
public static enum E_WoodType {
|
|
|
|
|
OAK("oak", BlockPlanks.EnumType.OAK), //
|
|
|
|
|
BIRCH("birch", BlockPlanks.EnumType.BIRCH), //
|
|
|
|
|
SPRUCE("spruce", BlockPlanks.EnumType.SPRUCE), //
|
|
|
|
|
JUNGLE("jungle", BlockPlanks.EnumType.JUNGLE), //
|
|
|
|
|
DARK_OAK("dark_oak", BlockPlanks.EnumType.DARK_OAK), //
|
|
|
|
|
ACACIA("acacia", BlockPlanks.EnumType.ACACIA);
|
|
|
|
|
OAK( "oak" , BlockPlanks.EnumType.OAK ) , //
|
|
|
|
|
BIRCH( "birch" , BlockPlanks.EnumType.BIRCH ) , //
|
|
|
|
|
SPRUCE( "spruce" , BlockPlanks.EnumType.SPRUCE ) , //
|
|
|
|
|
JUNGLE( "jungle" , BlockPlanks.EnumType.JUNGLE ) , //
|
|
|
|
|
DARK_OAK( "dark_oak" , BlockPlanks.EnumType.DARK_OAK ) , //
|
|
|
|
|
ACACIA( "acacia" , BlockPlanks.EnumType.ACACIA );
|
|
|
|
|
|
|
|
|
|
public final String suffix;
|
|
|
|
|
public final int metaData;
|
|
|
|
|
public final MapColor mapColor;
|
|
|
|
|
public final Block block;
|
|
|
|
|
|
|
|
|
|
private E_WoodType(String suffix, BlockPlanks.EnumType planks) {
|
|
|
|
|
|
|
|
|
|
private E_WoodType( final String suffix , final BlockPlanks.EnumType planks )
|
|
|
|
|
{
|
|
|
|
|
this.suffix = suffix;
|
|
|
|
|
this.metaData = planks.getMetadata();
|
|
|
|
|
this.mapColor = planks.getMapColor();
|
|
|
|
|
this.metaData = planks.getMetadata( );
|
|
|
|
|
this.mapColor = planks.getMapColor( );
|
|
|
|
|
this.block = Blocks.PLANKS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected static final AxisAlignedBB COLLISION_TOP = UMaths.makeBlockAABB(0, 12, 0, 16, 16, 16);
|
|
|
|
|
protected static final AxisAlignedBB COLLISION_TOP = UMaths.makeBlockAABB( 0 , 12 , 0 , 16 , 16 , 16 );
|
|
|
|
|
protected static final AxisAlignedBB COLLISION_LEGS[] = { //
|
|
|
|
|
UMaths.makeBlockAABB(1, 0, 1, 3, 12, 3), //
|
|
|
|
|
UMaths.makeBlockAABB(13, 0, 1, 15, 12, 3), //
|
|
|
|
|
UMaths.makeBlockAABB(13, 0, 13, 15, 12, 15), //
|
|
|
|
|
UMaths.makeBlockAABB(1, 0, 13, 3, 12, 15), //
|
|
|
|
|
UMaths.makeBlockAABB( 1 , 0 , 1 , 3 , 12 , 3 ) , //
|
|
|
|
|
UMaths.makeBlockAABB( 13 , 0 , 1 , 15 , 12 , 3 ) , //
|
|
|
|
|
UMaths.makeBlockAABB( 13 , 0 , 13 , 15 , 12 , 15 ) , //
|
|
|
|
|
UMaths.makeBlockAABB( 1 , 0 , 13 , 3 , 12 , 15 ), //
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static final PropertyBool NORTH = PropertyBool.create("north");
|
|
|
|
|
public static final PropertyBool EAST = PropertyBool.create("east");
|
|
|
|
|
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
|
|
|
|
public static final PropertyBool WEST = PropertyBool.create("west");
|
|
|
|
|
public static final PropertyBool NW = PropertyBool.create("nw");
|
|
|
|
|
public static final PropertyBool NE = PropertyBool.create("ne");
|
|
|
|
|
public static final PropertyBool SW = PropertyBool.create("sw");
|
|
|
|
|
public static final PropertyBool SE = PropertyBool.create("se");
|
|
|
|
|
public static final PropertyBool NORTH = PropertyBool.create( "north" );
|
|
|
|
|
public static final PropertyBool EAST = PropertyBool.create( "east" );
|
|
|
|
|
public static final PropertyBool SOUTH = PropertyBool.create( "south" );
|
|
|
|
|
public static final PropertyBool WEST = PropertyBool.create( "west" );
|
|
|
|
|
public static final PropertyBool NW = PropertyBool.create( "nw" );
|
|
|
|
|
public static final PropertyBool NE = PropertyBool.create( "ne" );
|
|
|
|
|
public static final PropertyBool SW = PropertyBool.create( "sw" );
|
|
|
|
|
public static final PropertyBool SE = PropertyBool.create( "se" );
|
|
|
|
|
private static final PropertyBool[] DIRECTIONS = { //
|
|
|
|
|
NORTH, NE, EAST, SE, SOUTH, SW, WEST, NW//
|
|
|
|
|
DBlockTable.NORTH , DBlockTable.NE , DBlockTable.EAST , DBlockTable.SE , DBlockTable.SOUTH ,
|
|
|
|
|
DBlockTable.SW , DBlockTable.WEST , DBlockTable.NW//
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public final E_WoodType type;
|
|
|
|
|
|
|
|
|
|
public DBlockTable(E_WoodType type) {
|
|
|
|
|
super(Material.WOOD, type.mapColor);
|
|
|
|
|
|
|
|
|
|
public DBlockTable( final E_WoodType type )
|
|
|
|
|
{
|
|
|
|
|
super( Material.WOOD , type.mapColor );
|
|
|
|
|
this.type = type;
|
|
|
|
|
|
|
|
|
|
this.setDefaultState(this.blockState.getBaseState()//
|
|
|
|
|
.withProperty(NORTH, Boolean.valueOf(false))//
|
|
|
|
|
.withProperty(EAST, Boolean.valueOf(false))//
|
|
|
|
|
.withProperty(SOUTH, Boolean.valueOf(false))//
|
|
|
|
|
.withProperty(WEST, Boolean.valueOf(false))//
|
|
|
|
|
.withProperty(NW, Boolean.valueOf(false))//
|
|
|
|
|
.withProperty(NE, Boolean.valueOf(false))//
|
|
|
|
|
.withProperty(SW, Boolean.valueOf(false))//
|
|
|
|
|
.withProperty(SE, Boolean.valueOf(false)));
|
|
|
|
|
this.setDefaultState( this.blockState.getBaseState( )//
|
|
|
|
|
.withProperty( DBlockTable.NORTH , Boolean.valueOf( false ) )//
|
|
|
|
|
.withProperty( DBlockTable.EAST , Boolean.valueOf( false ) )//
|
|
|
|
|
.withProperty( DBlockTable.SOUTH , Boolean.valueOf( false ) )//
|
|
|
|
|
.withProperty( DBlockTable.WEST , Boolean.valueOf( false ) )//
|
|
|
|
|
.withProperty( DBlockTable.NW , Boolean.valueOf( false ) )//
|
|
|
|
|
.withProperty( DBlockTable.NE , Boolean.valueOf( false ) )//
|
|
|
|
|
.withProperty( DBlockTable.SW , Boolean.valueOf( false ) )//
|
|
|
|
|
.withProperty( DBlockTable.SE , Boolean.valueOf( false ) ) );
|
|
|
|
|
|
|
|
|
|
this.setCreativeTab(CreativeTabs.DECORATIONS);
|
|
|
|
|
this.setRegistryName(ID + type.suffix);
|
|
|
|
|
this.setUnlocalizedName(NAME + type.suffix);
|
|
|
|
|
this.setCreativeTab( CreativeTabs.DECORATIONS );
|
|
|
|
|
this.setRegistryName( DBlockTable.ID + type.suffix );
|
|
|
|
|
this.setUnlocalizedName( DBlockTable.NAME + type.suffix );
|
|
|
|
|
|
|
|
|
|
this.lightOpacity = 0;
|
|
|
|
|
this.translucent = false;
|
|
|
|
@ -105,155 +116,183 @@ public class DBlockTable extends Block implements I_URecipeRegistrar {
|
|
|
|
|
this.blockSoundType = SoundType.LADDER;
|
|
|
|
|
this.enableStats = false;
|
|
|
|
|
|
|
|
|
|
this.setHarvestLevel("axe", 0);
|
|
|
|
|
this.setHarvestLevel( "axe" , 0 );
|
|
|
|
|
|
|
|
|
|
URegistration.addBlock(this);
|
|
|
|
|
URegistration.addBlock( this );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void registerRecipe() {
|
|
|
|
|
GameRegistry.addShapedRecipe(new ItemStack(this), //
|
|
|
|
|
"BBB", //
|
|
|
|
|
"S S", //
|
|
|
|
|
'B', new ItemStack(this.type.block, 1, this.type.metaData), //
|
|
|
|
|
'S', Items.STICK //
|
|
|
|
|
public void registerRecipe( )
|
|
|
|
|
{
|
|
|
|
|
GameRegistry.addShapedRecipe( new ItemStack( this ) , //
|
|
|
|
|
"BBB" , //
|
|
|
|
|
"S S" , //
|
|
|
|
|
'B' , new ItemStack( this.type.block , 1 , this.type.metaData ) , //
|
|
|
|
|
'S' , Items.STICK //
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isOpaqueCube(IBlockState state) {
|
|
|
|
|
public boolean isOpaqueCube( final IBlockState state )
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isFullCube(IBlockState state) {
|
|
|
|
|
public boolean isFullCube( final IBlockState state )
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
|
|
|
|
return worldIn.getBlockState(pos).getBlock() == this;
|
|
|
|
|
|
|
|
|
|
public boolean canConnectTo( final IBlockAccess worldIn , final BlockPos pos )
|
|
|
|
|
{
|
|
|
|
|
return worldIn.getBlockState( pos ).getBlock( ) == this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected BlockStateContainer createBlockState() {
|
|
|
|
|
return new BlockStateContainer(this, new IProperty[] { NORTH, EAST, WEST, SOUTH, NE, NW, SE, SW });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getMetaFromState(IBlockState state) {
|
|
|
|
|
protected BlockStateContainer createBlockState( )
|
|
|
|
|
{
|
|
|
|
|
return new BlockStateContainer( this , new IProperty[] {
|
|
|
|
|
DBlockTable.NORTH , DBlockTable.EAST , DBlockTable.WEST , DBlockTable.SOUTH , DBlockTable.NE ,
|
|
|
|
|
DBlockTable.NW , DBlockTable.SE , DBlockTable.SW
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getMetaFromState( final IBlockState state )
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
|
|
|
|
BlockPos n = pos.north();
|
|
|
|
|
BlockPos s = pos.south();
|
|
|
|
|
BlockPos w = pos.west();
|
|
|
|
|
BlockPos e = pos.east();
|
|
|
|
|
return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, n)))//
|
|
|
|
|
.withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, e)))//
|
|
|
|
|
.withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, s)))//
|
|
|
|
|
.withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, w)))//
|
|
|
|
|
.withProperty(NW, Boolean.valueOf(this.canConnectTo(worldIn, n.west())))//
|
|
|
|
|
.withProperty(NE, Boolean.valueOf(this.canConnectTo(worldIn, n.east())))//
|
|
|
|
|
.withProperty(SW, Boolean.valueOf(this.canConnectTo(worldIn, s.west())))//
|
|
|
|
|
.withProperty(SE, Boolean.valueOf(this.canConnectTo(worldIn, s.east())))//
|
|
|
|
|
public IBlockState getActualState( final IBlockState state , final IBlockAccess worldIn , final BlockPos pos )
|
|
|
|
|
{
|
|
|
|
|
final BlockPos n = pos.north( );
|
|
|
|
|
final BlockPos s = pos.south( );
|
|
|
|
|
final BlockPos w = pos.west( );
|
|
|
|
|
final BlockPos e = pos.east( );
|
|
|
|
|
return state.withProperty( DBlockTable.NORTH , Boolean.valueOf( this.canConnectTo( worldIn , n ) ) )//
|
|
|
|
|
.withProperty( DBlockTable.EAST , Boolean.valueOf( this.canConnectTo( worldIn , e ) ) )//
|
|
|
|
|
.withProperty( DBlockTable.SOUTH , Boolean.valueOf( this.canConnectTo( worldIn , s ) ) )//
|
|
|
|
|
.withProperty( DBlockTable.WEST , Boolean.valueOf( this.canConnectTo( worldIn , w ) ) )//
|
|
|
|
|
.withProperty( DBlockTable.NW , Boolean.valueOf( this.canConnectTo( worldIn , n.west( ) ) ) )//
|
|
|
|
|
.withProperty( DBlockTable.NE , Boolean.valueOf( this.canConnectTo( worldIn , n.east( ) ) ) )//
|
|
|
|
|
.withProperty( DBlockTable.SW , Boolean.valueOf( this.canConnectTo( worldIn , s.west( ) ) ) )//
|
|
|
|
|
.withProperty( DBlockTable.SE , Boolean.valueOf( this.canConnectTo( worldIn , s.east( ) ) ) )//
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
|
|
|
switch (rot) {
|
|
|
|
|
case CLOCKWISE_180:
|
|
|
|
|
return state.withProperty(NORTH, state.getValue(SOUTH))//
|
|
|
|
|
.withProperty(EAST, state.getValue(WEST))//
|
|
|
|
|
.withProperty(SOUTH, state.getValue(NORTH))//
|
|
|
|
|
.withProperty(WEST, state.getValue(EAST))//
|
|
|
|
|
.withProperty(NW, state.getValue(SE))//
|
|
|
|
|
.withProperty(NE, state.getValue(SW))//
|
|
|
|
|
.withProperty(SE, state.getValue(NW))//
|
|
|
|
|
.withProperty(SW, state.getValue(NE))//
|
|
|
|
|
;
|
|
|
|
|
case COUNTERCLOCKWISE_90:
|
|
|
|
|
return state.withProperty(NORTH, state.getValue(EAST))//
|
|
|
|
|
.withProperty(EAST, state.getValue(SOUTH))//
|
|
|
|
|
.withProperty(SOUTH, state.getValue(WEST))//
|
|
|
|
|
.withProperty(WEST, state.getValue(NORTH))//
|
|
|
|
|
.withProperty(NW, state.getValue(NE))//
|
|
|
|
|
.withProperty(NE, state.getValue(SE))//
|
|
|
|
|
.withProperty(SE, state.getValue(SW))//
|
|
|
|
|
.withProperty(SW, state.getValue(NW))//
|
|
|
|
|
;
|
|
|
|
|
case CLOCKWISE_90:
|
|
|
|
|
return state.withProperty(NORTH, state.getValue(WEST))//
|
|
|
|
|
.withProperty(EAST, state.getValue(NORTH))//
|
|
|
|
|
.withProperty(SOUTH, state.getValue(EAST))//
|
|
|
|
|
.withProperty(WEST, state.getValue(SOUTH))//
|
|
|
|
|
.withProperty(NW, state.getValue(SW))//
|
|
|
|
|
.withProperty(NE, state.getValue(NW))//
|
|
|
|
|
.withProperty(SE, state.getValue(NE))//
|
|
|
|
|
.withProperty(SW, state.getValue(SE))//
|
|
|
|
|
;
|
|
|
|
|
default:
|
|
|
|
|
return state;
|
|
|
|
|
public IBlockState withRotation( final IBlockState state , final Rotation rot )
|
|
|
|
|
{
|
|
|
|
|
switch ( rot ) {
|
|
|
|
|
case CLOCKWISE_180:
|
|
|
|
|
return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.SOUTH ) )//
|
|
|
|
|
.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.WEST ) )//
|
|
|
|
|
.withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.NORTH ) )//
|
|
|
|
|
.withProperty( DBlockTable.WEST , state.getValue( DBlockTable.EAST ) )//
|
|
|
|
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.SE ) )//
|
|
|
|
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.SW ) )//
|
|
|
|
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.NW ) )//
|
|
|
|
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.NE ) )//
|
|
|
|
|
;
|
|
|
|
|
case COUNTERCLOCKWISE_90:
|
|
|
|
|
return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.EAST ) )//
|
|
|
|
|
.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.SOUTH ) )//
|
|
|
|
|
.withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.WEST ) )//
|
|
|
|
|
.withProperty( DBlockTable.WEST , state.getValue( DBlockTable.NORTH ) )//
|
|
|
|
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.NE ) )//
|
|
|
|
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.SE ) )//
|
|
|
|
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.SW ) )//
|
|
|
|
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.NW ) )//
|
|
|
|
|
;
|
|
|
|
|
case CLOCKWISE_90:
|
|
|
|
|
return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.WEST ) )//
|
|
|
|
|
.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.NORTH ) )//
|
|
|
|
|
.withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.EAST ) )//
|
|
|
|
|
.withProperty( DBlockTable.WEST , state.getValue( DBlockTable.SOUTH ) )//
|
|
|
|
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.SW ) )//
|
|
|
|
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.NW ) )//
|
|
|
|
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.NE ) )//
|
|
|
|
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.SE ) )//
|
|
|
|
|
;
|
|
|
|
|
default:
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
|
|
|
|
switch (mirrorIn) {
|
|
|
|
|
case LEFT_RIGHT:
|
|
|
|
|
return state.withProperty(NORTH, state.getValue(SOUTH))//
|
|
|
|
|
.withProperty(SOUTH, state.getValue(NORTH))//
|
|
|
|
|
.withProperty(NW, state.getValue(SW))//
|
|
|
|
|
.withProperty(NE, state.getValue(SE))//
|
|
|
|
|
.withProperty(SW, state.getValue(NW))//
|
|
|
|
|
.withProperty(SE, state.getValue(NE))//
|
|
|
|
|
;
|
|
|
|
|
case FRONT_BACK:
|
|
|
|
|
return state.withProperty(EAST, state.getValue(WEST))//
|
|
|
|
|
.withProperty(WEST, state.getValue(EAST))//
|
|
|
|
|
.withProperty(NW, state.getValue(NE))//
|
|
|
|
|
.withProperty(NE, state.getValue(NW))//
|
|
|
|
|
.withProperty(SW, state.getValue(SE))//
|
|
|
|
|
.withProperty(SE, state.getValue(SW))//
|
|
|
|
|
;
|
|
|
|
|
default:
|
|
|
|
|
return state;
|
|
|
|
|
public IBlockState withMirror( final IBlockState state , final Mirror mirrorIn )
|
|
|
|
|
{
|
|
|
|
|
switch ( mirrorIn ) {
|
|
|
|
|
case LEFT_RIGHT:
|
|
|
|
|
return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.SOUTH ) )//
|
|
|
|
|
.withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.NORTH ) )//
|
|
|
|
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.SW ) )//
|
|
|
|
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.SE ) )//
|
|
|
|
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.NW ) )//
|
|
|
|
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.NE ) )//
|
|
|
|
|
;
|
|
|
|
|
case FRONT_BACK:
|
|
|
|
|
return state.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.WEST ) )//
|
|
|
|
|
.withProperty( DBlockTable.WEST , state.getValue( DBlockTable.EAST ) )//
|
|
|
|
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.NE ) )//
|
|
|
|
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.NW ) )//
|
|
|
|
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.SE ) )//
|
|
|
|
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.SW ) )//
|
|
|
|
|
;
|
|
|
|
|
default:
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
|
|
|
IBlockState actual = this.getActualState(state, source, pos);
|
|
|
|
|
for (int i = 0, dir = 0; i < 4; i++, dir += 2) {
|
|
|
|
|
boolean c0 = actual.getValue(DIRECTIONS[dir]);
|
|
|
|
|
boolean c1 = actual.getValue(DIRECTIONS[(dir + 6) % 8]);
|
|
|
|
|
boolean c10 = actual.getValue(DIRECTIONS[(dir + 7) % 8]);
|
|
|
|
|
if (!(c0 || c1) || (c0 && c1 && !c10)) {
|
|
|
|
|
return FULL_BLOCK_AABB;
|
|
|
|
|
public AxisAlignedBB getBoundingBox( final IBlockState state , final IBlockAccess source , final BlockPos pos )
|
|
|
|
|
{
|
|
|
|
|
final IBlockState actual = this.getActualState( state , source , pos );
|
|
|
|
|
for ( int i = 0 , dir = 0 ; i < 4 ; i++ , dir += 2 ) {
|
|
|
|
|
final boolean c0 = actual.getValue( DBlockTable.DIRECTIONS[ dir ] );
|
|
|
|
|
final boolean c1 = actual.getValue( DBlockTable.DIRECTIONS[ ( dir + 6 ) % 8 ] );
|
|
|
|
|
final boolean c10 = actual.getValue( DBlockTable.DIRECTIONS[ ( dir + 7 ) % 8 ] );
|
|
|
|
|
if ( ! ( c0 || c1 ) || c0 && c1 && !c10 ) {
|
|
|
|
|
return Block.FULL_BLOCK_AABB;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return COLLISION_TOP;
|
|
|
|
|
return DBlockTable.COLLISION_TOP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB container,
|
|
|
|
|
List<AxisAlignedBB> output, Entity entity) {
|
|
|
|
|
IBlockState actual = this.getActualState(state, worldIn, pos);
|
|
|
|
|
addCollisionBoxToList(pos, container, output, COLLISION_TOP);
|
|
|
|
|
for (int i = 0, dir = 0; i < 4; i++, dir += 2) {
|
|
|
|
|
boolean c0 = actual.getValue(DIRECTIONS[dir]);
|
|
|
|
|
boolean c1 = actual.getValue(DIRECTIONS[(dir + 6) % 8]);
|
|
|
|
|
boolean c10 = actual.getValue(DIRECTIONS[(dir + 7) % 8]);
|
|
|
|
|
if (!(c0 || c1) || (c0 && c1 && !c10)) {
|
|
|
|
|
addCollisionBoxToList(pos, container, output, COLLISION_LEGS[i]);
|
|
|
|
|
public void addCollisionBoxToList( final IBlockState state , final World worldIn , final BlockPos pos ,
|
|
|
|
|
final AxisAlignedBB container , final List< AxisAlignedBB > output , final Entity entity )
|
|
|
|
|
{
|
|
|
|
|
final IBlockState actual = this.getActualState( state , worldIn , pos );
|
|
|
|
|
Block.addCollisionBoxToList( pos , container , output , DBlockTable.COLLISION_TOP );
|
|
|
|
|
for ( int i = 0 , dir = 0 ; i < 4 ; i++ , dir += 2 ) {
|
|
|
|
|
final boolean c0 = actual.getValue( DBlockTable.DIRECTIONS[ dir ] );
|
|
|
|
|
final boolean c1 = actual.getValue( DBlockTable.DIRECTIONS[ ( dir + 6 ) % 8 ] );
|
|
|
|
|
final boolean c10 = actual.getValue( DBlockTable.DIRECTIONS[ ( dir + 7 ) % 8 ] );
|
|
|
|
|
if ( ! ( c0 || c1 ) || c0 && c1 && !c10 ) {
|
|
|
|
|
Block.addCollisionBoxToList( pos , container , output , DBlockTable.COLLISION_LEGS[ i ] );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public BlockRenderLayer getBlockLayer() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@SideOnly( Side.CLIENT )
|
|
|
|
|
public BlockRenderLayer getBlockLayer( )
|
|
|
|
|
{
|
|
|
|
|
return BlockRenderLayer.CUTOUT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|