reformatted all src files (#141)
This commit is contained in:
@@ -19,8 +19,12 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
@@ -33,77 +37,60 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.Platform;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class BlockInterface extends AEBaseTileBlock
|
||||
{
|
||||
public class BlockInterface extends AEBaseTileBlock {
|
||||
|
||||
private static final PropertyBool OMNIDIRECTIONAL = PropertyBool.create( "omnidirectional" );
|
||||
private static final PropertyBool OMNIDIRECTIONAL = PropertyBool.create("omnidirectional");
|
||||
|
||||
public BlockInterface()
|
||||
{
|
||||
super( Material.IRON );
|
||||
}
|
||||
public BlockInterface() {
|
||||
super(Material.IRON);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { OMNIDIRECTIONAL };
|
||||
}
|
||||
@Override
|
||||
protected IProperty[] getAEStates() {
|
||||
return new IProperty[]{OMNIDIRECTIONAL};
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
// Determine whether the interface is omni-directional or not
|
||||
TileInterface te = this.getTileEntity( world, pos );
|
||||
boolean omniDirectional = true; // The default
|
||||
if( te != null )
|
||||
{
|
||||
omniDirectional = te.isOmniDirectional();
|
||||
}
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
// Determine whether the interface is omni-directional or not
|
||||
TileInterface te = this.getTileEntity(world, pos);
|
||||
boolean omniDirectional = true; // The default
|
||||
if (te != null) {
|
||||
omniDirectional = te.isOmniDirectional();
|
||||
}
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
.withProperty( OMNIDIRECTIONAL, omniDirectional );
|
||||
}
|
||||
return super.getActualState(state, world, pos)
|
||||
.withProperty(OMNIDIRECTIONAL, omniDirectional);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( p.isSneaking() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (p.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final TileInterface tg = this.getTileEntity( w, pos );
|
||||
if( tg != null )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INTERFACE );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final TileInterface tg = this.getTileEntity(w, pos);
|
||||
if (tg != null) {
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_INTERFACE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCustomRotation()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean hasCustomRotation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
|
||||
{
|
||||
if( rotatable instanceof TileInterface )
|
||||
{
|
||||
( (TileInterface) rotatable ).setSide( axis );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void customRotateBlock(final IOrientable rotatable, final EnumFacing axis) {
|
||||
if (rotatable instanceof TileInterface) {
|
||||
((TileInterface) rotatable).setSide(axis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user