Reduces visibility of internal fields/methods
Reduces the visibility of all fields to private and create setters/getters when necessary. Exceptions are fields with GuiSync as these need to be public. Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
@@ -75,24 +75,25 @@ import com.google.common.base.Optional;
|
||||
|
||||
public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
{
|
||||
public static final PropertyEnum AXIS_ORIENTATION = PropertyEnum.create("axis", EnumFacing.Axis.class);
|
||||
|
||||
public static final PropertyEnum AXIS_ORIENTATION = PropertyEnum.create( "axis", EnumFacing.Axis.class );
|
||||
|
||||
private final String featureFullName;
|
||||
protected final Optional<String> featureSubName;
|
||||
protected boolean isOpaque = true;
|
||||
protected boolean isFullSize = true;
|
||||
protected boolean hasSubtypes = false;
|
||||
protected boolean isInventory = false;
|
||||
private final Optional<String> featureSubName;
|
||||
private boolean isOpaque = true;
|
||||
private boolean isFullSize = true;
|
||||
private boolean hasSubtypes = false;
|
||||
private boolean isInventory = false;
|
||||
private IFeatureHandler handler;
|
||||
@SideOnly( Side.CLIENT )
|
||||
BlockRenderInfo renderInfo;
|
||||
|
||||
private BlockRenderInfo renderInfo;
|
||||
private String textureName;
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
{
|
||||
return this.isOpaque && this.isFullSize;
|
||||
return this.isOpaque() && this.isFullSize();
|
||||
}
|
||||
|
||||
|
||||
protected AEBaseBlock( final Material mat )
|
||||
{
|
||||
this( mat, Optional.<String>absent() );
|
||||
@@ -135,11 +136,11 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
|
||||
public static final UnlistedBlockPos AE_BLOCK_POS = new UnlistedBlockPos();
|
||||
public static final UnlistedBlockAccess AE_BLOCK_ACCESS = new UnlistedBlockAccess();
|
||||
|
||||
|
||||
@Override
|
||||
protected final BlockState createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { AE_BLOCK_POS, AE_BLOCK_ACCESS} );
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { AE_BLOCK_POS, AE_BLOCK_ACCESS } );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,14 +149,14 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
final IBlockAccess world,
|
||||
final BlockPos pos )
|
||||
{
|
||||
return ((IExtendedBlockState)super.getExtendedState( state, world, pos ) ).withProperty( AE_BLOCK_POS, pos ).withProperty( AE_BLOCK_ACCESS, world );
|
||||
return ( (IExtendedBlockState) super.getExtendedState( state, world, pos ) ).withProperty( AE_BLOCK_POS, pos ).withProperty( AE_BLOCK_ACCESS, world );
|
||||
}
|
||||
|
||||
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[0];
|
||||
}
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public BlockRenderInfo getRendererInstance()
|
||||
{
|
||||
@@ -167,7 +168,8 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
try
|
||||
{
|
||||
final Class<? extends BaseBlockRender> re = this.getRenderer();
|
||||
if ( re == null ) return null; // use 1.8 models.
|
||||
if( re == null )
|
||||
return null; // use 1.8 models.
|
||||
final BaseBlockRender renderer = re.newInstance();
|
||||
this.renderInfo = new BlockRenderInfo( renderer );
|
||||
|
||||
@@ -182,7 +184,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
throw new IllegalStateException( "Failed to create a new instance of " + this.getRenderer() + " because of permissions.", e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(
|
||||
final IBlockAccess worldIn,
|
||||
@@ -200,7 +202,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
|
||||
protected void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
final AEBlockFeatureHandler featureHandler = new AEBlockFeatureHandler( f, this, this.featureSubName );
|
||||
final AEBlockFeatureHandler featureHandler = new AEBlockFeatureHandler( f, this, this.getFeatureSubName() );
|
||||
this.setHandler( featureHandler );
|
||||
}
|
||||
|
||||
@@ -225,14 +227,14 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
{
|
||||
return this.isOpaque;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube()
|
||||
{
|
||||
return this.isFullSize && this.isOpaque;
|
||||
return this.isFullSize() && this.isOpaque();
|
||||
}
|
||||
|
||||
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
|
||||
|
||||
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
|
||||
{
|
||||
if( this instanceof ICustomCollision )
|
||||
{
|
||||
@@ -244,12 +246,12 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IAESprite getIcon( final IBlockAccess w, final BlockPos pos, final EnumFacing side )
|
||||
{
|
||||
final IBlockState state =w.getBlockState( pos );
|
||||
final IBlockState state = w.getBlockState( pos );
|
||||
final IOrientable ori = this.getOrientable( w, pos );
|
||||
|
||||
if ( ori == null )
|
||||
return this.getIcon( side,state );
|
||||
|
||||
|
||||
if( ori == null )
|
||||
return this.getIcon( side, state );
|
||||
|
||||
return this.getIcon( this.mapRotation( ori, side ), state );
|
||||
}
|
||||
|
||||
@@ -288,7 +290,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
super.addCollisionBoxesToList( w, pos, state, bb, out, e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public AxisAlignedBB getSelectedBoundingBox(
|
||||
@@ -313,15 +315,15 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
{
|
||||
this.setBlockBounds( (float) bb.minX, (float) bb.minY, (float) bb.minZ, (float) bb.maxX, (float) bb.maxY, (float) bb.maxZ );
|
||||
|
||||
final MovingObjectPosition r = super.collisionRayTrace( w, pos, ld.a, ld.b );
|
||||
final MovingObjectPosition r = super.collisionRayTrace( w, pos, ld.getA(), ld.getB() );
|
||||
|
||||
this.setBlockBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
if( r != null )
|
||||
{
|
||||
final double xLen = ( ld.a.xCoord - r.hitVec.xCoord );
|
||||
final double yLen = ( ld.a.yCoord - r.hitVec.yCoord );
|
||||
final double zLen = ( ld.a.zCoord - r.hitVec.zCoord );
|
||||
final double xLen = ( ld.getA().xCoord - r.hitVec.xCoord );
|
||||
final double yLen = ( ld.getA().yCoord - r.hitVec.yCoord );
|
||||
final double zLen = ( ld.getA().zCoord - r.hitVec.zCoord );
|
||||
|
||||
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
|
||||
|
||||
@@ -344,12 +346,12 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
|
||||
for( final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, false ) )
|
||||
{
|
||||
if ( b == null )
|
||||
if( b == null )
|
||||
{
|
||||
b = bx;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
final double minX = Math.min( b.minX, bx.minX );
|
||||
final double minY = Math.min( b.minY, bx.minY );
|
||||
final double minZ = Math.min( b.minZ, bx.minZ );
|
||||
@@ -360,10 +362,10 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
b = AxisAlignedBB.fromBounds( minX, minY, minZ, maxX, maxY, maxZ );
|
||||
}
|
||||
|
||||
if ( b == null )
|
||||
if( b == null )
|
||||
b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
|
||||
else
|
||||
b = AxisAlignedBB.fromBounds( 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 = AxisAlignedBB.fromBounds( 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;
|
||||
}
|
||||
@@ -374,7 +376,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
@Override
|
||||
public final boolean isOpaqueCube()
|
||||
{
|
||||
return this.isOpaque;
|
||||
return this.isOpaque();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -432,7 +434,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@SuppressWarnings( "unchecked" )
|
||||
@@ -446,7 +448,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
{
|
||||
return this.isInventory;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(
|
||||
final World worldIn,
|
||||
@@ -454,13 +456,13 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(
|
||||
final IBlockAccess world,
|
||||
final BlockPos pos )
|
||||
{
|
||||
return this.isFullSize;
|
||||
return this.isFullSize();
|
||||
}
|
||||
|
||||
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
||||
@@ -563,7 +565,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
}
|
||||
|
||||
public EnumFacing mapRotation(
|
||||
final IOrientable ori,
|
||||
final IOrientable ori,
|
||||
final EnumFacing dir )
|
||||
{
|
||||
// case DOWN: return bottomIcon;
|
||||
@@ -593,8 +595,8 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
west = dx;
|
||||
}
|
||||
}
|
||||
|
||||
if ( west == null )
|
||||
|
||||
if( west == null )
|
||||
return dir;
|
||||
|
||||
if( dir == forward )
|
||||
@@ -664,7 +666,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
final IResource res = Minecraft.getMinecraft().getResourceManager().getResource( resLoc );
|
||||
if( res != null )
|
||||
{
|
||||
return new FlippableIcon( new BaseIcon( ir.registerSprite( new ResourceLocation(AppEng.MOD_ID, "blocks/" + name ) ) ) );
|
||||
return new FlippableIcon( new BaseIcon( ir.registerSprite( new ResourceLocation( AppEng.MOD_ID, "blocks/" + name ) ) ) );
|
||||
}
|
||||
}
|
||||
catch( final Throwable e )
|
||||
@@ -673,19 +675,40 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
}
|
||||
}
|
||||
|
||||
final ResourceLocation resLoc = new ResourceLocation(AppEng.MOD_ID, "blocks/" + name );
|
||||
return new FlippableIcon(new BaseIcon( ir.registerSprite( resLoc ) ) );
|
||||
final ResourceLocation resLoc = new ResourceLocation( AppEng.MOD_ID, "blocks/" + name );
|
||||
return new FlippableIcon( new BaseIcon( ir.registerSprite( resLoc ) ) );
|
||||
}
|
||||
|
||||
String textureName;
|
||||
|
||||
public void setBlockTextureName( final String texture )
|
||||
{
|
||||
this.textureName = texture;
|
||||
}
|
||||
|
||||
|
||||
private String getTextureName()
|
||||
{
|
||||
return this.textureName;
|
||||
}
|
||||
|
||||
public boolean isFullSize()
|
||||
{
|
||||
return isFullSize;
|
||||
}
|
||||
|
||||
public boolean setFullSize( boolean isFullSize )
|
||||
{
|
||||
this.isFullSize = isFullSize;
|
||||
return isFullSize;
|
||||
}
|
||||
|
||||
public boolean setOpaque( boolean isOpaque )
|
||||
{
|
||||
this.isOpaque = isOpaque;
|
||||
return isOpaque;
|
||||
}
|
||||
|
||||
public Optional<String> getFeatureSubName()
|
||||
{
|
||||
return featureSubName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.block;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
|
||||
public class AEBaseSlabBlock extends BlockSlab implements IAEFeature
|
||||
{
|
||||
private final IFeatureHandler features;
|
||||
private final AEBaseBlock block;
|
||||
private final int meta;
|
||||
private AEBaseSlabBlock slabs;
|
||||
private AEBaseSlabBlock doubleSlabs;
|
||||
private final String name;
|
||||
|
||||
public AEBaseSlabBlock( final AEBaseBlock block, final int meta, final EnumSet<AEFeature> features, final boolean isDoubleSlab, final String name )
|
||||
{
|
||||
super( isDoubleSlab, block.getMaterial() );
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
this.name = name;
|
||||
this.setBlockName( "appliedenergistics2." + name );
|
||||
this.setHardness( block.getBlockHardness( null, 0, 0, 0 ) );
|
||||
this.setResistance( block.getExplosionResistance( null ) * 5.0F / 3.0F );
|
||||
this.setStepSound( block.stepSound );
|
||||
this.useNeighborBrightness = true;
|
||||
if( !this.field_150004_a )
|
||||
{
|
||||
this.doubleSlabs = new AEBaseSlabBlock( block, meta, features, true, name + ".double" ).setSlabs( this );
|
||||
}
|
||||
this.features = !this.field_150004_a ? new SlabBlockFeatureHandler( features, this ) : null;
|
||||
}
|
||||
|
||||
private AEBaseSlabBlock setSlabs( final AEBaseSlabBlock slabs )
|
||||
{
|
||||
this.slabs = slabs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AEBaseSlabBlock slabs()
|
||||
{
|
||||
return this.slabs;
|
||||
}
|
||||
|
||||
public AEBaseSlabBlock doubleSlabs()
|
||||
{
|
||||
return this.doubleSlabs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
{
|
||||
return this.features;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// Override to do stuff
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAESprite getIcon( final int dir, final int meta )
|
||||
{
|
||||
return this.block.getIcon( dir, this.meta );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String func_150002_b( final int p_150002_1_ )
|
||||
{
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons( final IIconRegister reg )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped( final int meta, final Random rand, final int fortune )
|
||||
{
|
||||
return this.field_150004_a ? Item.getItemFromBlock( this.slabs ) : Item.getItemFromBlock( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock( final MovingObjectPosition target, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
AEBaseSlabBlock block = (AEBaseSlabBlock) world.getBlock( x, y, z );
|
||||
|
||||
if( block == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if( block.field_150004_a )
|
||||
{
|
||||
block = this.slabs;
|
||||
}
|
||||
|
||||
final int meta = world.getBlockMetadata( x, y, z ) & 7;
|
||||
return new ItemStack( block, 1, meta );
|
||||
}
|
||||
|
||||
public String name()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
@Override
|
||||
protected void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
final AETileBlockFeatureHandler featureHandler = new AETileBlockFeatureHandler( f, this, this.featureSubName );
|
||||
final AETileBlockFeatureHandler featureHandler = new AETileBlockFeatureHandler( f, this, this.getFeatureSubName() );
|
||||
this.setHandler( featureHandler );
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
ReflectionHelper.setPrivateValue( Block.class, this, b, "isTileProvider" );
|
||||
}
|
||||
|
||||
public boolean hasBlockTileEntity()
|
||||
private boolean hasBlockTileEntity()
|
||||
{
|
||||
return this.tileEntityType != null;
|
||||
}
|
||||
|
||||
@@ -48,16 +48,17 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
super( Material.iron );
|
||||
|
||||
this.setTileEntity( TileMolecularAssembler.class );
|
||||
this.isOpaque = false;
|
||||
this.setOpaque( false );
|
||||
this.lightOpacity = 1;
|
||||
this.setFeature( EnumSet.of( AEFeature.MolecularAssembler ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer( final net.minecraft.util.EnumWorldBlockLayer layer) {
|
||||
return layer == EnumWorldBlockLayer.CUTOUT_MIPPED;
|
||||
public boolean canRenderInLayer( final net.minecraft.util.EnumWorldBlockLayer layer )
|
||||
{
|
||||
return layer == EnumWorldBlockLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public Class<? extends BaseBlockRender> getRenderer()
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BlockCrank extends AEBaseTileBlock
|
||||
this.setTileEntity( TileCrank.class );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setHarvestLevel( "axe", 0 );
|
||||
this.isFullSize = this.isOpaque = false;
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.GrindStone ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
|
||||
this.setTileEntity( TileCharger.class );
|
||||
this.setLightOpacity( 2 );
|
||||
this.isFullSize = this.isOpaque = false;
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BlockInscriber extends AEBaseTileBlock
|
||||
|
||||
this.setTileEntity( TileInscriber.class );
|
||||
this.setLightOpacity( 2 );
|
||||
this.isFullSize = this.isOpaque = false;
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.Inscriber ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
super( Material.circuits );
|
||||
|
||||
this.setLightOpacity( 0 );
|
||||
this.isFullSize = false;
|
||||
this.isOpaque = false;
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
|
||||
this.setTileEntity( TileLightDetector.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.LightDetector ) );
|
||||
|
||||
@@ -54,8 +54,8 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
|
||||
this.setTileEntity( TilePaint.class );
|
||||
this.setLightOpacity( 0 );
|
||||
this.isFullSize = false;
|
||||
this.isOpaque = false;
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock
|
||||
|
||||
final TileQuartzGrowthAccelerator cga = this.getTileEntity( w, pos );
|
||||
|
||||
if( cga != null && cga.hasPower && CommonHelper.proxy.shouldAddParticles( r ) )
|
||||
if( cga != null && cga.isPowered() && CommonHelper.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
final double d0 = r.nextFloat() - 0.5F;
|
||||
final double d1 = r.nextFloat() - 0.5F;
|
||||
@@ -93,46 +93,41 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock
|
||||
|
||||
double dz = 0;
|
||||
double dx = 0;
|
||||
BlockPos pt = null;
|
||||
|
||||
switch( r.nextInt( 4 ) )
|
||||
{
|
||||
case 0:
|
||||
dx = 0.6;
|
||||
dz = d1;
|
||||
final BlockPos pt = new BlockPos( x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ() );
|
||||
if( !w.getBlockState(pt).getBlock().isAir( w, pt) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
pt = new BlockPos( x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ() );
|
||||
|
||||
break;
|
||||
case 1:
|
||||
dx = d1;
|
||||
dz += 0.6;
|
||||
pt = new BlockPos( x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ() );
|
||||
if( !w.getBlockState(pt).getBlock().isAir( w, pt) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
pt = new BlockPos( x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ() );
|
||||
|
||||
break;
|
||||
case 2:
|
||||
dx = d1;
|
||||
dz = -0.6;
|
||||
pt = new BlockPos( x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ() );
|
||||
if( !w.getBlockState(pt).getBlock().isAir( w, pt) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
pt = new BlockPos( x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ() );
|
||||
|
||||
break;
|
||||
case 3:
|
||||
dx = -0.6;
|
||||
dz = d1;
|
||||
pt = new BlockPos( x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ() );
|
||||
if( !w.getBlockState(pt).getBlock().isAir( w, pt) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
pt = new BlockPos( x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if( !w.getBlockState( pt ).getBlock().isAir( w, pt ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rx += dx * west.getFrontOffsetX();
|
||||
ry += dx * west.getFrontOffsetY();
|
||||
rz += dx * west.getFrontOffsetZ();
|
||||
|
||||
@@ -60,8 +60,8 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeLights ) );
|
||||
this.setLightLevel( 0.9375F );
|
||||
this.setLightOpacity( 0 );
|
||||
this.isFullSize = false;
|
||||
this.isOpaque = false;
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
super( Material.iron );
|
||||
this.setTileEntity( TileSkyCompass.class );
|
||||
this.isOpaque = this.isFullSize = false;
|
||||
this.setOpaque( this.setFullSize( false ) );
|
||||
this.lightOpacity = 0;
|
||||
this.setFeature( EnumSet.of( AEFeature.MeteoriteCompass ) );
|
||||
}
|
||||
|
||||
@@ -58,12 +58,12 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
super( Material.tnt );
|
||||
this.setLightOpacity( 1 );
|
||||
this.setBlockBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
this.isFullSize = this.isOpaque = false;
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setStepSound( soundTypeGrass );
|
||||
this.setHardness( 0F );
|
||||
this.setFeature( EnumSet.of( AEFeature.TinyTNT ) );
|
||||
|
||||
EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.TINY_TNT, AppEng.instance(), 16, 4, true );
|
||||
EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,6 +57,7 @@ import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AECableBusFeatureHandler;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
@@ -70,22 +71,27 @@ import appeng.util.Platform;
|
||||
|
||||
// TODO: MFR INTEGRATION
|
||||
//@Interface( iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = IntegrationType.MFR )
|
||||
public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnection
|
||||
public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnection
|
||||
{
|
||||
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
public static Class<? extends TileEntity> noTesrTile;
|
||||
public static Class<? extends TileEntity> tesrTile;
|
||||
private static Class<? extends TileEntity> noTesrTile;
|
||||
private static Class<? extends TileEntity> tesrTile;
|
||||
|
||||
/**
|
||||
* Immibis MB Support.
|
||||
*
|
||||
* It will look for a field named ImmibisMicroblocks_TransformableBlockMarker or
|
||||
* ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc can be ignored.
|
||||
*/
|
||||
boolean ImmibisMicroblocks_TransformableBlockMarker = true;
|
||||
@Reflected
|
||||
private static final boolean ImmibisMicroblocks_TransformableBlockMarker = true;
|
||||
|
||||
public BlockCableBus()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
this.setLightOpacity( 0 );
|
||||
this.isFullSize = this.isOpaque = false;
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
|
||||
// this will actually be overwritten later through setupTile and the combined layers
|
||||
this.setTileEntity( TileCableBus.class );
|
||||
@@ -153,7 +159,7 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio
|
||||
final IBlockState state,
|
||||
final EnumFacing side )
|
||||
{
|
||||
return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: IS OPPOSITE!?
|
||||
return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: IS OPPOSITE!?
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -218,9 +224,9 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio
|
||||
final BlockPos pos,
|
||||
EnumFacing side )
|
||||
{
|
||||
if ( side == null )
|
||||
if( side == null )
|
||||
side = EnumFacing.UP;
|
||||
|
||||
|
||||
return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
|
||||
}
|
||||
|
||||
@@ -268,41 +274,37 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio
|
||||
|
||||
// TODO HIT EFFECTS
|
||||
/*
|
||||
for( AEPartLocation side : AEPartLocation.values() )
|
||||
{
|
||||
IPart p = host.getPart( side );
|
||||
TextureAtlasSprite ico = this.getIcon( p );
|
||||
|
||||
if( ico == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
byte b0 = (byte) ( Platform.getRandomInt() % 2 == 0 ? 1 : 0 );
|
||||
|
||||
for( int i1 = 0; i1 < b0; ++i1 )
|
||||
{
|
||||
for( int j1 = 0; j1 < b0; ++j1 )
|
||||
{
|
||||
for( int k1 = 0; k1 < b0; ++k1 )
|
||||
{
|
||||
double d0 = target.blockX + ( i1 + 0.5D ) / b0;
|
||||
double d1 = target.blockY + ( j1 + 0.5D ) / b0;
|
||||
double d2 = target.blockZ + ( k1 + 0.5D ) / b0;
|
||||
|
||||
double dd0 = target.hitVec.xCoord;
|
||||
double dd1 = target.hitVec.yCoord;
|
||||
double dd2 = target.hitVec.zCoord;
|
||||
EntityDiggingFX fx = ( new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 - target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) ).applyColourMultiplier( target.blockX, target.blockY, target.blockZ );
|
||||
|
||||
fx.setParticleIcon( ico );
|
||||
|
||||
effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
* for( AEPartLocation side : AEPartLocation.values() )
|
||||
* {
|
||||
* IPart p = host.getPart( side );
|
||||
* TextureAtlasSprite ico = this.getIcon( p );
|
||||
* if( ico == null )
|
||||
* {
|
||||
* continue;
|
||||
* }
|
||||
* byte b0 = (byte) ( Platform.getRandomInt() % 2 == 0 ? 1 : 0 );
|
||||
* for( int i1 = 0; i1 < b0; ++i1 )
|
||||
* {
|
||||
* for( int j1 = 0; j1 < b0; ++j1 )
|
||||
* {
|
||||
* for( int k1 = 0; k1 < b0; ++k1 )
|
||||
* {
|
||||
* double d0 = target.blockX + ( i1 + 0.5D ) / b0;
|
||||
* double d1 = target.blockY + ( j1 + 0.5D ) / b0;
|
||||
* double d2 = target.blockZ + ( k1 + 0.5D ) / b0;
|
||||
* double dd0 = target.hitVec.xCoord;
|
||||
* double dd1 = target.hitVec.yCoord;
|
||||
* double dd2 = target.hitVec.zCoord;
|
||||
* EntityDiggingFX fx = ( new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 -
|
||||
* target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) ).applyColourMultiplier( target.blockX,
|
||||
* target.blockY, target.blockZ );
|
||||
* fx.setParticleIcon( ico );
|
||||
* effectRenderer.addEffect( fx );
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -321,37 +323,33 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio
|
||||
|
||||
// TODO DESTROY EFFECTS
|
||||
/*
|
||||
for( AEPartLocation side : AEPartLocation.values() )
|
||||
{
|
||||
IPart p = host.getPart( side );
|
||||
TextureAtlasSprite ico = this.getIcon( p );
|
||||
|
||||
if( ico == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
byte b0 = 3;
|
||||
|
||||
for( int i1 = 0; i1 < b0; ++i1 )
|
||||
{
|
||||
for( int j1 = 0; j1 < b0; ++j1 )
|
||||
{
|
||||
for( int k1 = 0; k1 < b0; ++k1 )
|
||||
{
|
||||
double d0 = x + ( i1 + 0.5D ) / b0;
|
||||
double d1 = y + ( j1 + 0.5D ) / b0;
|
||||
double d2 = z + ( k1 + 0.5D ) / b0;
|
||||
EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z - 0.5D, this, meta ) ).applyColourMultiplier( x, y, z );
|
||||
|
||||
fx.setParticleIcon( ico );
|
||||
|
||||
effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
* for( AEPartLocation side : AEPartLocation.values() )
|
||||
* {
|
||||
* IPart p = host.getPart( side );
|
||||
* TextureAtlasSprite ico = this.getIcon( p );
|
||||
* if( ico == null )
|
||||
* {
|
||||
* continue;
|
||||
* }
|
||||
* byte b0 = 3;
|
||||
* for( int i1 = 0; i1 < b0; ++i1 )
|
||||
* {
|
||||
* for( int j1 = 0; j1 < b0; ++j1 )
|
||||
* {
|
||||
* for( int k1 = 0; k1 < b0; ++k1 )
|
||||
* {
|
||||
* double d0 = x + ( i1 + 0.5D ) / b0;
|
||||
* double d1 = y + ( j1 + 0.5D ) / b0;
|
||||
* double d2 = z + ( k1 + 0.5D ) / b0;
|
||||
* EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z -
|
||||
* 0.5D, this, meta ) ).applyColourMultiplier( x, y, z );
|
||||
* fx.setParticleIcon( ico );
|
||||
* effectRenderer.addEffect( fx );
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -377,7 +375,7 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio
|
||||
|
||||
if( te instanceof TileCableBus )
|
||||
{
|
||||
out = ( (TileCableBus) te ).cb;
|
||||
out = ( (TileCableBus) te ).getCableBus();
|
||||
}
|
||||
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
|
||||
{
|
||||
@@ -425,10 +423,11 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.cb( world, pos ).recolourBlock( side, AEColor.values()[ color.ordinal() ], who );
|
||||
return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who );
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{}
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -460,7 +459,7 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio
|
||||
@Override
|
||||
protected void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, this.featureSubName );
|
||||
final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, this.getFeatureSubName() );
|
||||
this.setHandler( featureHandler );
|
||||
}
|
||||
|
||||
@@ -476,17 +475,28 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio
|
||||
CommonHelper.proxy.bindTileEntitySpecialRenderer( tesrTile, this );
|
||||
}
|
||||
}
|
||||
|
||||
// TODO MFR Integration
|
||||
// @Override
|
||||
// @Method( iname = IntegrationType.MFR )
|
||||
// public RedNetConnectionType getConnectionType( World world, int x, int y, int z, ForgeDirection side )
|
||||
// {
|
||||
// return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ? RedNetConnectionType.CableSingle : RedNetConnectionType.None;
|
||||
// }
|
||||
//
|
||||
// public void setRenderColor( int color )
|
||||
// {
|
||||
// this.myColorMultiplier = color;
|
||||
// }
|
||||
|
||||
public static Class<? extends TileEntity> getTesrTile()
|
||||
{
|
||||
return tesrTile;
|
||||
}
|
||||
|
||||
public static Class<? extends TileEntity> getNoTesrTile()
|
||||
{
|
||||
return noTesrTile;
|
||||
}
|
||||
|
||||
// TODO MFR Integration
|
||||
// @Override
|
||||
// @Method( iname = IntegrationType.MFR )
|
||||
// public RedNetConnectionType getConnectionType( World world, int x, int y, int z, ForgeDirection side )
|
||||
// {
|
||||
// return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ?
|
||||
// RedNetConnectionType.CableSingle : RedNetConnectionType.None;
|
||||
// }
|
||||
//
|
||||
// public void setRenderColor( int color )
|
||||
// {
|
||||
// this.myColorMultiplier = color;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
this.setTileEntity( TileWireless.class );
|
||||
this.setLightOpacity( 0 );
|
||||
this.isFullSize = false;
|
||||
this.isOpaque = false;
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
final float shave = 2.0f / 16.0f;
|
||||
this.setBlockBounds( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
|
||||
this.setLightOpacity( 0 );
|
||||
this.isFullSize = this.isOpaque = false;
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision
|
||||
this.setResistance( 6000000.0F );
|
||||
this.setBlockUnbreakable();
|
||||
this.setLightOpacity( 0 );
|
||||
this.isOpaque = false;
|
||||
this.setOpaque( false );
|
||||
this.setFeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
super( Material.rock, Optional.of( type.name() ) );
|
||||
this.setTileEntity( TileSkyChest.class );
|
||||
this.isOpaque = this.isFullSize = false;
|
||||
this.setOpaque( this.setFullSize( false ) );
|
||||
this.lightOpacity = 0;
|
||||
this.hasSubtypes = true;
|
||||
this.setHardness( 50 );
|
||||
|
||||
Reference in New Issue
Block a user