Fixes #2675: Set fullBlock correctly afterwards.
Reduces the visibility of some methods as these should be access through the public methods of Block or the overridden ones. Removes now useless getCheckedSubBlocks.
This commit is contained in:
parent
12dbd17320
commit
d377af9a69
6 changed files with 95 additions and 104 deletions
|
@ -65,12 +65,6 @@ public abstract class AEBaseBlock extends Block
|
||||||
|
|
||||||
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
|
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVisuallyOpaque()
|
|
||||||
{
|
|
||||||
return this.isOpaque() && this.isFullSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AEBaseBlock( final Material mat )
|
protected AEBaseBlock( final Material mat )
|
||||||
{
|
{
|
||||||
super( mat );
|
super( mat );
|
||||||
|
@ -96,13 +90,15 @@ public abstract class AEBaseBlock extends Block
|
||||||
this.setLightLevel( 0 );
|
this.setLightLevel( 0 );
|
||||||
this.setHardness( 2.2F );
|
this.setHardness( 2.2F );
|
||||||
this.setHarvestLevel( "pickaxe", 0 );
|
this.setHarvestLevel( "pickaxe", 0 );
|
||||||
|
|
||||||
|
// Workaround as vanilla sets it way too early.
|
||||||
|
this.fullBlock = this.isFullSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public final boolean isVisuallyOpaque()
|
||||||
{
|
{
|
||||||
String regName = getRegistryName() != null ? getRegistryName().getResourcePath() : "unregistered";
|
return this.isOpaque() && this.isFullSize();
|
||||||
return getClass().getSimpleName() + "[" + regName + "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,31 +107,12 @@ public abstract class AEBaseBlock extends Block
|
||||||
return new BlockStateContainer( this, this.getAEStates() );
|
return new BlockStateContainer( this, this.getAEStates() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IProperty[] getAEStates()
|
|
||||||
{
|
|
||||||
return new IProperty[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOpaque()
|
|
||||||
{
|
|
||||||
return this.isOpaque;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNormalCube( IBlockState state )
|
public final boolean isNormalCube( IBlockState state )
|
||||||
{
|
{
|
||||||
return this.isFullSize() && this.isOpaque();
|
return this.isFullSize() && this.isOpaque();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
|
|
||||||
{
|
|
||||||
if( this instanceof ICustomCollision )
|
|
||||||
{
|
|
||||||
return (ICustomCollision) this;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
|
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
|
||||||
{
|
{
|
||||||
|
@ -210,7 +187,8 @@ public abstract class AEBaseBlock extends Block
|
||||||
|
|
||||||
if( br != null )
|
if( br != null )
|
||||||
{
|
{
|
||||||
br = new AxisAlignedBB( br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos.getY(), br.maxZ + pos.getZ() );
|
br = new AxisAlignedBB( br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos
|
||||||
|
.getY(), br.maxZ + pos.getZ() );
|
||||||
return br;
|
return br;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,7 +219,8 @@ public abstract class AEBaseBlock extends Block
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos.getZ() );
|
b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
|
||||||
|
.getZ() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
|
@ -303,19 +282,6 @@ public abstract class AEBaseBlock extends Block
|
||||||
return super.collisionRayTrace( state, w, pos, a, b );
|
return super.collisionRayTrace( state, w, pos, a, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly( Side.CLIENT )
|
|
||||||
@SuppressWarnings( "unchecked" )
|
|
||||||
public final void getSubBlocks( final Item item, final CreativeTabs tabs, final List itemStacks )
|
|
||||||
{
|
|
||||||
this.getCheckedSubBlocks( item, tabs, itemStacks );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride( IBlockState state )
|
public boolean hasComparatorInputOverride( IBlockState state )
|
||||||
{
|
{
|
||||||
|
@ -329,21 +295,11 @@ public abstract class AEBaseBlock extends Block
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNormalCube( IBlockState state, final IBlockAccess world, final BlockPos pos )
|
public final boolean isNormalCube( IBlockState state, final IBlockAccess world, final BlockPos pos )
|
||||||
{
|
{
|
||||||
return this.isFullSize();
|
return this.isFullSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
|
||||||
{
|
|
||||||
if( this instanceof IOrientableBlock )
|
|
||||||
{
|
|
||||||
IOrientableBlock orientable = (IOrientableBlock) this;
|
|
||||||
return orientable.getOrientable( w, pos );
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean rotateBlock( final World w, final BlockPos pos, final EnumFacing axis )
|
public boolean rotateBlock( final World w, final BlockPos pos, final EnumFacing axis )
|
||||||
{
|
{
|
||||||
|
@ -378,50 +334,24 @@ public abstract class AEBaseBlock extends Block
|
||||||
return super.rotateBlock( w, pos, axis );
|
return super.rotateBlock( w, pos, axis );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasCustomRotation()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing[] getValidRotations( final World w, final BlockPos pos )
|
public EnumFacing[] getValidRotations( final World w, final BlockPos pos )
|
||||||
{
|
{
|
||||||
return new EnumFacing[0];
|
return new EnumFacing[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
|
||||||
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
|
||||||
{
|
|
||||||
super.getSubBlocks( item, tabs, itemStacks );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnlocalizedName( final ItemStack is )
|
|
||||||
{
|
|
||||||
return this.getUnlocalizedName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation( final ItemStack is, final EntityPlayer player, final List<String> lines, final boolean advancedItemTooltips )
|
public void addInformation( final ItemStack is, final EntityPlayer player, final List<String> lines, final boolean advancedItemTooltips )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSubtypes()
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
{
|
{
|
||||||
return this.hasSubtypes;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir )
|
public final EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir )
|
||||||
{
|
{
|
||||||
// case DOWN: return bottomIcon;
|
// case DOWN: return bottomIcon;
|
||||||
// case UP: return blockIcon;
|
// case UP: return blockIcon;
|
||||||
|
@ -486,36 +416,97 @@ public abstract class AEBaseBlock extends Block
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFullSize()
|
@Override
|
||||||
|
public String toString()
|
||||||
{
|
{
|
||||||
return this.isFullSize;
|
String regName = getRegistryName() != null ? getRegistryName().getResourcePath() : "unregistered";
|
||||||
|
return getClass().getSimpleName() + "[" + regName + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setFullSize( final boolean isFullSize )
|
protected String getUnlocalizedName( final ItemStack is )
|
||||||
{
|
{
|
||||||
this.isFullSize = isFullSize;
|
return this.getUnlocalizedName();
|
||||||
return isFullSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setOpaque( final boolean isOpaque )
|
protected boolean hasCustomRotation()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
||||||
|
{
|
||||||
|
if( this instanceof IOrientableBlock )
|
||||||
|
{
|
||||||
|
IOrientableBlock orientable = (IOrientableBlock) this;
|
||||||
|
return orientable.getOrientable( w, pos );
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
|
||||||
|
{
|
||||||
|
if( this instanceof ICustomCollision )
|
||||||
|
{
|
||||||
|
return (ICustomCollision) this;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IProperty[] getAEStates()
|
||||||
|
{
|
||||||
|
return new IProperty[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isOpaque()
|
||||||
|
{
|
||||||
|
return this.isOpaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean setOpaque( final boolean isOpaque )
|
||||||
{
|
{
|
||||||
this.isOpaque = isOpaque;
|
this.isOpaque = isOpaque;
|
||||||
return isOpaque;
|
return isOpaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInventory()
|
protected boolean hasSubtypes()
|
||||||
{
|
{
|
||||||
return this.isInventory;
|
return this.hasSubtypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInventory( final boolean isInventory )
|
protected void setHasSubtypes( final boolean hasSubtypes )
|
||||||
{
|
|
||||||
this.isInventory = isInventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasSubtypes( final boolean hasSubtypes )
|
|
||||||
{
|
{
|
||||||
this.hasSubtypes = hasSubtypes;
|
this.hasSubtypes = hasSubtypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isFullSize()
|
||||||
|
{
|
||||||
|
return this.isFullSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean setFullSize( final boolean isFullSize )
|
||||||
|
{
|
||||||
|
this.isFullSize = isFullSize;
|
||||||
|
return isFullSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isInventory()
|
||||||
|
{
|
||||||
|
return this.isInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setInventory( final boolean isInventory )
|
||||||
|
{
|
||||||
|
this.isInventory = isInventory;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
public void getSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
||||||
{
|
{
|
||||||
itemStacks.add( new ItemStack( this, 1, 0 ) );
|
itemStacks.add( new ItemStack( this, 1, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,7 +376,7 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
public void getSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,9 @@ public class BlockEnergyCell extends AEBaseTileBlock
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
public void getSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
||||||
{
|
{
|
||||||
super.getCheckedSubBlocks( item, tabs, itemStacks );
|
super.getSubBlocks( item, tabs, itemStacks );
|
||||||
|
|
||||||
final ItemStack charged = new ItemStack( this, 1 );
|
final ItemStack charged = new ItemStack( this, 1 );
|
||||||
final NBTTagCompound tag = Platform.openNbtData( charged );
|
final NBTTagCompound tag = Platform.openNbtData( charged );
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class BlockPaint extends AEBaseTileBlock
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
public void getSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
public void getSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue