Most of the 1.8 Port.
This commit is contained in:
@@ -25,17 +25,12 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockSkyCompass;
|
||||
@@ -63,58 +58,50 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getIcon( int direction, int metadata )
|
||||
public boolean isValidOrientation( World w, BlockPos pos, EnumFacing forward, EnumFacing up )
|
||||
{
|
||||
return Blocks.iron_block.getIcon( direction, metadata );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons( IIconRegister iconRegistry )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidOrientation( World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up )
|
||||
{
|
||||
TileSkyCompass sc = this.getTileEntity( w, x, y, z );
|
||||
TileSkyCompass sc = this.getTileEntity( w, pos );
|
||||
if( sc != null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return this.canPlaceAt( w, x, y, z, forward.getOpposite() );
|
||||
return this.canPlaceAt( w, pos, forward.getOpposite() );
|
||||
}
|
||||
|
||||
private boolean canPlaceAt( World w, int x, int y, int z, ForgeDirection dir )
|
||||
private boolean canPlaceAt( World w, BlockPos pos, EnumFacing dir )
|
||||
{
|
||||
return w.isSideSolid( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false );
|
||||
return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange( World w, int x, int y, int z, Block id )
|
||||
public void onNeighborBlockChange(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
IBlockState state,
|
||||
Block neighborBlock )
|
||||
{
|
||||
TileSkyCompass sc = this.getTileEntity( w, x, y, z );
|
||||
ForgeDirection up = sc.getForward();
|
||||
if( !this.canPlaceAt( w, x, y, z, up.getOpposite() ) )
|
||||
TileSkyCompass sc = this.getTileEntity( w, pos );
|
||||
EnumFacing up = sc.getForward();
|
||||
if( !this.canPlaceAt( w, pos, up.getOpposite() ) )
|
||||
{
|
||||
this.dropTorch( w, x, y, z );
|
||||
this.dropTorch( w, pos );
|
||||
}
|
||||
}
|
||||
|
||||
private void dropTorch( World w, int x, int y, int z )
|
||||
private void dropTorch( World w, BlockPos pos )
|
||||
{
|
||||
w.func_147480_a( x, y, z, true );
|
||||
// w.destroyBlock( x, y, z, true );
|
||||
w.markBlockForUpdate( x, y, z );
|
||||
w.destroyBlock( pos, true );
|
||||
w.markBlockForUpdate( pos );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt( World w, int x, int y, int z )
|
||||
public boolean canPlaceBlockAt(
|
||||
World w,
|
||||
BlockPos pos )
|
||||
{
|
||||
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( EnumFacing dir : EnumFacing.VALUES )
|
||||
{
|
||||
if( this.canPlaceAt( w, x, y, z, dir ) )
|
||||
if( this.canPlaceAt( w, pos, dir ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -123,12 +110,16 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
Entity thePlayer,
|
||||
boolean b )
|
||||
{
|
||||
TileSkyCompass tile = this.getTileEntity( w, x, y, z );
|
||||
TileSkyCompass tile = this.getTileEntity( w, pos );
|
||||
if( tile != null )
|
||||
{
|
||||
ForgeDirection forward = tile.getForward();
|
||||
EnumFacing forward = tile.getForward();
|
||||
|
||||
double minX = 0;
|
||||
double minY = 0;
|
||||
@@ -179,14 +170,19 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
break;
|
||||
}
|
||||
|
||||
return Collections.singletonList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
return Collections.singletonList( AxisAlignedBB.fromBounds( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
}
|
||||
return Collections.singletonList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
return Collections.singletonList( AxisAlignedBB.fromBounds( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e )
|
||||
public void addCollidingBlockToList(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
AxisAlignedBB bb,
|
||||
List<AxisAlignedBB> out,
|
||||
Entity e )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user