1.15 port
This commit is contained in:
@@ -28,17 +28,17 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
@@ -63,7 +63,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
{
|
||||
super( Material.CIRCUITS );
|
||||
|
||||
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) );
|
||||
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, Direction.UP ).withProperty( ODD, false ) );
|
||||
this.setLightLevel( 0.9375F );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
@@ -74,7 +74,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
* Sets the "ODD" property of the block state according to the placement of the block.
|
||||
*/
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
|
||||
public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
|
||||
{
|
||||
boolean oddPlacement = ( ( pos.getX() + pos.getY() + pos.getZ() ) % 2 ) != 0;
|
||||
|
||||
@@ -83,15 +83,15 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState( final IBlockState state )
|
||||
public int getMetaFromState( final BlockState state )
|
||||
{
|
||||
return state.getValue( FACING ).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta( final int meta )
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
EnumFacing facing = EnumFacing.values()[meta];
|
||||
Direction facing = Direction.values()[meta];
|
||||
return this.getDefaultState().withProperty( FACING, facing );
|
||||
}
|
||||
|
||||
@@ -102,12 +102,12 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
|
||||
public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up )
|
||||
{
|
||||
return this.canPlaceAt( w, pos, up.getOpposite() );
|
||||
}
|
||||
|
||||
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
|
||||
private boolean canPlaceAt( final World w, final BlockPos pos, final Direction dir )
|
||||
{
|
||||
final BlockPos test = pos.offset( dir );
|
||||
return w.isSideSolid( test, dir.getOpposite(), false );
|
||||
@@ -116,7 +116,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity e, final boolean isVisual )
|
||||
{
|
||||
final EnumFacing up = this.getOrientable( w, pos ).getUp();
|
||||
final Direction up = this.getOrientable( w, pos ).getUp();
|
||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||
@@ -134,8 +134,8 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
@@ -147,7 +147,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
return;
|
||||
}
|
||||
|
||||
final EnumFacing up = this.getOrientable( w, pos ).getUp();
|
||||
final Direction up = this.getOrientable( w, pos ).getUp();
|
||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||
@@ -157,15 +157,15 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
{
|
||||
final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D );
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||
public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||
{
|
||||
final EnumFacing up = this.getOrientable( world, pos ).getUp();
|
||||
final Direction up = this.getOrientable( world, pos ).getUp();
|
||||
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
|
||||
{
|
||||
this.dropTorch( world, pos );
|
||||
@@ -174,7 +174,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
|
||||
private void dropTorch( final World w, final BlockPos pos )
|
||||
{
|
||||
final IBlockState prev = w.getBlockState( pos );
|
||||
final BlockState prev = w.getBlockState( pos );
|
||||
w.destroyBlock( pos, true );
|
||||
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
@Override
|
||||
public boolean canPlaceBlockAt( final World w, final BlockPos pos )
|
||||
{
|
||||
for( final EnumFacing dir : EnumFacing.VALUES )
|
||||
for( final Direction dir : Direction.VALUES )
|
||||
{
|
||||
if( this.canPlaceAt( w, pos, dir ) )
|
||||
{
|
||||
@@ -199,7 +199,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
||||
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
return new MetaRotation( w, pos, FACING );
|
||||
}
|
||||
@@ -211,13 +211,13 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( IBlockState state )
|
||||
public boolean isFullCube( BlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
|
||||
Reference in New Issue
Block a user