QuartzFixture and (semi-borked) LightningFX
This commit is contained in:
@@ -90,7 +90,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
// }
|
||||
//
|
||||
// IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
// return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
||||
// return extState.with( FORWARD, tile.getForward() ).with( UP, tile.getUp() );
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
@@ -76,9 +76,9 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
|
||||
}
|
||||
|
||||
return super.getExtendedState( state, world, pos )
|
||||
.withProperty( COLOR, color )
|
||||
.withProperty( FORWARD, forward )
|
||||
.withProperty( UP, up );
|
||||
.with( COLOR, color )
|
||||
.with( FORWARD, forward )
|
||||
.with( UP, up );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.BooleanProperty;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
@@ -49,8 +49,8 @@ import appeng.util.Platform;
|
||||
|
||||
public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
{
|
||||
public static final PropertyBool FORMED = PropertyBool.create( "formed" );
|
||||
public static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||
public static final BooleanProperty FORMED = BooleanProperty.create( "formed" );
|
||||
public static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
|
||||
public static final UnlistedProperty<CraftingCubeState> STATE = new UnlistedProperty<>( "state", CraftingCubeState.class );
|
||||
|
||||
public final CraftingUnitType type;
|
||||
@@ -84,7 +84,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
|
||||
return extState.withProperty( STATE, new CraftingCubeState( connections ) );
|
||||
return extState.with( STATE, new CraftingCubeState( connections ) );
|
||||
}
|
||||
|
||||
private boolean isConnected( IBlockReader world, BlockPos pos, Direction side )
|
||||
@@ -102,7 +102,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
@Override
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
return this.getDefaultState().withProperty( POWERED, ( meta & 1 ) == 1 ).withProperty( FORMED, ( meta & 2 ) == 2 );
|
||||
return this.getDefaultState().with( POWERED, ( meta & 1 ) == 1 ).with( FORMED, ( meta & 2 ) == 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.block.crafting;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.BooleanProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
@@ -43,7 +43,7 @@ import appeng.util.Platform;
|
||||
public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
public static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||
public static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
|
||||
|
||||
public BlockMolecularAssembler()
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
powered = te.isPowered();
|
||||
}
|
||||
|
||||
return super.getActualState( state, worldIn, pos ).withProperty( POWERED, powered );
|
||||
return super.getActualState( state, worldIn, pos ).with( POWERED, powered );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -115,7 +115,7 @@ public class BlockCrank extends AEBaseTileBlock
|
||||
|
||||
private Direction findCrankable( final World world, final BlockPos pos )
|
||||
{
|
||||
for( final Direction dir : Direction.VALUES )
|
||||
for( final Direction dir : Direction.values() )
|
||||
{
|
||||
if( this.isCrankable( world, pos, dir ) )
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.BooleanProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -46,7 +46,7 @@ import appeng.util.Platform;
|
||||
public class BlockInterface extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
private static final PropertyBool OMNIDIRECTIONAL = PropertyBool.create( "omnidirectional" );
|
||||
private static final BooleanProperty OMNIDIRECTIONAL = BooleanProperty.create( "omnidirectional" );
|
||||
|
||||
public BlockInterface()
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public class BlockInterface extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
.withProperty( OMNIDIRECTIONAL, omniDirectional );
|
||||
.with( OMNIDIRECTIONAL, omniDirectional );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,8 +26,8 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
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.properties.BooleanProperty;
|
||||
import net.minecraft.block.properties.DirectionProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
@@ -52,16 +52,16 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
{
|
||||
|
||||
// Cannot use the vanilla FACING property here because it excludes facing DOWN
|
||||
public static final PropertyDirection FACING = PropertyDirection.create( "facing" );
|
||||
public static final DirectionProperty FACING = DirectionProperty.create( "facing" );
|
||||
|
||||
// Used to alternate between two variants of the fixture on adjacent blocks
|
||||
public static final PropertyBool ODD = PropertyBool.create( "odd" );
|
||||
public static final BooleanProperty ODD = BooleanProperty.create( "odd" );
|
||||
|
||||
public BlockLightDetector()
|
||||
{
|
||||
super( Material.CIRCUITS );
|
||||
super( Material.MISCELLANEOUS );
|
||||
|
||||
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, Direction.UP ).withProperty( ODD, false ) );
|
||||
this.setDefaultState( this.blockState.getBaseState().with( FACING, Direction.UP ).with( ODD, false ) );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
@@ -77,7 +77,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
Direction facing = Direction.values()[meta];
|
||||
return this.getDefaultState().withProperty( FACING, facing );
|
||||
return this.getDefaultState().with( FACING, facing );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,7 +167,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
@Override
|
||||
public boolean isValidPosition(BlockState state, IWorldReader w, BlockPos pos)
|
||||
{
|
||||
for( final Direction dir : Direction.VALUES )
|
||||
for( final Direction dir : Direction.values() )
|
||||
{
|
||||
if( this.canPlaceAt( w, pos, dir ) )
|
||||
{
|
||||
|
||||
@@ -19,119 +19,129 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, ICustomCollision
|
||||
public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock
|
||||
{
|
||||
|
||||
// Cache VoxelShapes for each facing
|
||||
private static final Map<Direction, VoxelShape> SHAPES;
|
||||
|
||||
static {
|
||||
SHAPES = new EnumMap<>(Direction.class);
|
||||
|
||||
for (Direction facing : Direction.values()) {
|
||||
final double xOff = -0.3 * facing.getXOffset();
|
||||
final double yOff = -0.3 * facing.getYOffset();
|
||||
final double zOff = -0.3 * facing.getZOffset();
|
||||
VoxelShape shape = VoxelShapes.create(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
|
||||
SHAPES.put(facing, shape);
|
||||
}
|
||||
}
|
||||
|
||||
// Cannot use the vanilla FACING property here because it excludes facing DOWN
|
||||
public static final PropertyDirection FACING = PropertyDirection.create( "facing" );
|
||||
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
||||
|
||||
// Used to alternate between two variants of the fixture on adjacent blocks
|
||||
public static final PropertyBool ODD = PropertyBool.create( "odd" );
|
||||
public static final BooleanProperty ODD = BooleanProperty.create( "odd" );
|
||||
|
||||
public BlockQuartzFixture()
|
||||
{
|
||||
super( Material.CIRCUITS );
|
||||
super(Block.Properties.create(Material.MISCELLANEOUS).doesNotBlockMovement().hardnessAndResistance(0, 0).lightValue(14).sound(SoundType.GLASS));
|
||||
|
||||
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, Direction.UP ).withProperty( ODD, false ) );
|
||||
this.setLightLevel( 0.9375F );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setDefaultState( getDefaultState().with( FACING, Direction.UP ).with( ODD, false ) );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the "ODD" property of the block state according to the placement of the block.
|
||||
*/
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
|
||||
{
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
builder.add(FACING, ODD);
|
||||
}
|
||||
|
||||
// For reference, see WallTorchBlock
|
||||
@Nullable
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
BlockState blockstate = super.getStateForPlacement(context);
|
||||
BlockPos pos = context.getPos();
|
||||
|
||||
// Set the even/odd property
|
||||
boolean oddPlacement = ( ( pos.getX() + pos.getY() + pos.getZ() ) % 2 ) != 0;
|
||||
blockstate = blockstate.with( ODD, oddPlacement );
|
||||
|
||||
return super.getActualState( state, worldIn, pos )
|
||||
.withProperty( ODD, oddPlacement );
|
||||
IWorldReader iworldreader = context.getWorld();
|
||||
Direction[] adirection = context.getNearestLookingDirections();
|
||||
|
||||
for(Direction direction : adirection) {
|
||||
if (canPlaceAt(iworldreader, pos, direction)) {
|
||||
return blockstate.with(FACING, direction.getOpposite());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Break the fixture if the block it is attached to is changed so that it could no longer be placed
|
||||
@Override
|
||||
public int getMetaFromState( final BlockState state )
|
||||
{
|
||||
return state.getValue( FACING ).ordinal();
|
||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn, BlockPos pos, BlockPos facingPos) {
|
||||
Direction fixtureFacing = state.get(FACING);
|
||||
if (facing.getOpposite() == fixtureFacing && !canPlaceAt(worldIn, pos, facing)) {
|
||||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
Direction facing = Direction.values()[meta];
|
||||
return this.getDefaultState().withProperty( FACING, facing );
|
||||
}
|
||||
// FIXME @Override
|
||||
// FIXME public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up )
|
||||
// FIXME {
|
||||
// FIXME return this.canPlaceAt( w, pos, up.getOpposite() );
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { FACING, ODD };
|
||||
}
|
||||
|
||||
@Override
|
||||
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 Direction dir )
|
||||
private boolean canPlaceAt( final IWorldReader w, final BlockPos pos, final Direction dir )
|
||||
{
|
||||
final BlockPos test = pos.offset( dir );
|
||||
return w.isSideSolid( test, dir.getOpposite(), false );
|
||||
BlockState blockstate = w.getBlockState(test);
|
||||
return blockstate.isSolidSide(w, test, dir.getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity e, final boolean isVisual )
|
||||
{
|
||||
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();
|
||||
return Collections.singletonList( new AxisAlignedBB( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, final Entity e )
|
||||
{/*
|
||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
|
||||
* getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + (double) y + 0.15,
|
||||
* zOff
|
||||
* + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
||||
*/
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
Direction facing = state.get(FACING);
|
||||
return SHAPES.get(facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,30 +159,29 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
}
|
||||
|
||||
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();
|
||||
final double xOff = -0.3 * up.getXOffset();
|
||||
final double yOff = -0.3 * up.getYOffset();
|
||||
final double zOff = -0.3 * up.getZOffset();
|
||||
for( int bolts = 0; bolts < 3; bolts++ )
|
||||
{
|
||||
if( AppEng.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
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.getInstance().effectRenderer.addEffect( fx );
|
||||
w.addParticle(LightningFX.TYPE, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||
{
|
||||
final Direction up = this.getOrientable( world, pos ).getUp();
|
||||
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
|
||||
{
|
||||
this.dropTorch( world, pos );
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Replaced by the postPlaceupdate stuff above
|
||||
// @Override
|
||||
// public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||
// {
|
||||
// final Direction up = this.getOrientable( world, pos ).getUp();
|
||||
// if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
|
||||
// {
|
||||
// this.dropTorch( world, pos );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
private void dropTorch( final World w, final BlockPos pos )
|
||||
{
|
||||
final BlockState prev = w.getBlockState( pos );
|
||||
@@ -183,7 +192,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
@Override
|
||||
public boolean isValidPosition(BlockState state, IWorldReader w, BlockPos pos)
|
||||
{
|
||||
for( final Direction dir : Direction.VALUES )
|
||||
for( final Direction dir : Direction.values() )
|
||||
{
|
||||
if( this.canPlaceAt( w, pos, dir ) )
|
||||
{
|
||||
@@ -193,12 +202,6 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMetadata()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
@@ -211,17 +214,4 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( BlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Random;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.BooleanProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -46,13 +46,13 @@ import appeng.util.Platform;
|
||||
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOrientableBlock
|
||||
{
|
||||
|
||||
private static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||
private static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
|
||||
|
||||
public BlockQuartzGrowthAccelerator()
|
||||
{
|
||||
super( Material.ROCK );
|
||||
this.setSoundType( SoundType.METAL );
|
||||
this.setDefaultState( this.getDefaultState().withProperty( POWERED, false ) );
|
||||
this.setDefaultState( this.getDefaultState().with( POWERED, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,7 +62,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
boolean powered = te != null && te.isPowered();
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
.withProperty( POWERED, powered );
|
||||
.with( POWERED, powered );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.BooleanProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -45,13 +45,13 @@ import appeng.util.Platform;
|
||||
public class BlockSecurityStation extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
private static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||
private static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
|
||||
|
||||
public BlockSecurityStation()
|
||||
{
|
||||
super( Material.IRON );
|
||||
|
||||
this.setDefaultState( this.getDefaultState().withProperty( POWERED, false ) );
|
||||
this.setDefaultState( this.getDefaultState().with( POWERED, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,7 +77,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
.withProperty( POWERED, powered );
|
||||
.with( POWERED, powered );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
|
||||
public BlockSkyCompass()
|
||||
{
|
||||
super( Material.CIRCUITS );
|
||||
super( Material.MISCELLANEOUS );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
@@ -99,7 +99,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
@Override
|
||||
public boolean isValidPosition(BlockState state, IWorldReader w, BlockPos pos)
|
||||
{
|
||||
for( final Direction dir : Direction.VALUES )
|
||||
for( final Direction dir : Direction.values() )
|
||||
{
|
||||
if( this.canPlaceAt( w, pos, dir ) )
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.BooleanProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -51,13 +51,13 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
// Indicates that the vibration chamber is currently working
|
||||
private static final PropertyBool ACTIVE = PropertyBool.create( "active" );
|
||||
private static final BooleanProperty ACTIVE = BooleanProperty.create( "active" );
|
||||
|
||||
public BlockVibrationChamber()
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setHardness( 4.2F );
|
||||
this.setDefaultState( this.getDefaultState().withProperty( ACTIVE, false ) );
|
||||
this.setDefaultState( this.getDefaultState().with( ACTIVE, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +67,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
boolean active = te != null && te.isOn;
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
.withProperty( ACTIVE, active );
|
||||
.with( ACTIVE, active );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -128,7 +128,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
||||
CableBusRenderState renderState = this.cb( world, pos ).getRenderState();
|
||||
renderState.setWorld( world );
|
||||
renderState.setPos( pos );
|
||||
return ( (IExtendedBlockState) state ).withProperty( RENDER_STATE_PROPERTY, renderState );
|
||||
return ( (IExtendedBlockState) state ).with( RENDER_STATE_PROPERTY, renderState );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,8 +76,8 @@ public class BlockController extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
this.setHardness( 6 );
|
||||
this.setDefaultState( this.getDefaultState()
|
||||
.withProperty( CONTROLLER_STATE, ControllerBlockState.offline )
|
||||
.withProperty( CONTROLLER_TYPE, ControllerRenderType.block ) );
|
||||
.with( CONTROLLER_STATE, ControllerBlockState.offline )
|
||||
.with( CONTROLLER_TYPE, ControllerRenderType.block ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,7 +144,7 @@ public class BlockController extends AEBaseTileBlock
|
||||
}
|
||||
}
|
||||
|
||||
return state.withProperty( CONTROLLER_TYPE, type );
|
||||
return state.with( CONTROLLER_TYPE, type );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,7 +163,7 @@ public class BlockController extends AEBaseTileBlock
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
ControllerBlockState state = ControllerBlockState.values()[meta];
|
||||
return this.getDefaultState().withProperty( CONTROLLER_STATE, state );
|
||||
return this.getDefaultState().with( CONTROLLER_STATE, state );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class BlockEnergyCell extends AEBaseTileBlock
|
||||
@Override
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
return this.getDefaultState().withProperty( ENERGY_STORAGE, Math.min( 7, Math.max( 0, meta ) ) );
|
||||
return this.getDefaultState().with( ENERGY_STORAGE, Math.min( 7, Math.max( 0, meta ) ) );
|
||||
}
|
||||
|
||||
public BlockEnergyCell()
|
||||
|
||||
@@ -69,7 +69,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setDefaultState( this.getDefaultState().withProperty( STATE, State.OFF ) );
|
||||
this.setDefaultState( this.getDefaultState().with( STATE, State.OFF ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,7 +97,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
return super.getActualState( state, worldIn, pos )
|
||||
.withProperty( STATE, teState );
|
||||
.with( STATE, teState );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -83,7 +83,7 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
splotches = te.getDots();
|
||||
}
|
||||
|
||||
return extState.withProperty( SPLOTCHES, new PaintSplotches( splotches ) );
|
||||
return extState.with( SPLOTCHES, new PaintSplotches( splotches ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.block.qnb;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.BooleanProperty;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
@@ -42,7 +42,7 @@ import appeng.tile.qnb.TileQuantumBridge;
|
||||
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
public static final PropertyBool FORMED = PropertyBool.create( "formed" );
|
||||
public static final BooleanProperty FORMED = BooleanProperty.create( "formed" );
|
||||
|
||||
public static final QnbFormedStateProperty FORMED_STATE = new QnbFormedStateProperty();
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
this.boundingBox = new AxisAlignedBB( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setDefaultState( this.getDefaultState().withProperty( FORMED, false ) );
|
||||
this.setDefaultState( this.getDefaultState().with( FORMED, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,7 +77,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
if( bridge != null )
|
||||
{
|
||||
QnbFormedState formedState = new QnbFormedState( bridge.getAdjacentQuantumBridges(), bridge.isCorner(), bridge.isPowered() );
|
||||
extState = extState.withProperty( FORMED_STATE, formedState );
|
||||
extState = extState.with( FORMED_STATE, formedState );
|
||||
}
|
||||
|
||||
return extState;
|
||||
@@ -89,7 +89,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
TileQuantumBridge bridge = this.getTileEntity( worldIn, pos );
|
||||
if( bridge != null )
|
||||
{
|
||||
state = state.withProperty( FORMED, bridge.isFormed() );
|
||||
state = state.with( FORMED, bridge.isFormed() );
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock
|
||||
{
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
|
||||
return extState.withProperty( STATE, this.getDisplayState( world, pos ) );
|
||||
return extState.with( STATE, this.getDisplayState( world, pos ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,7 +51,7 @@ public class BlockChest extends AEBaseTileBlock
|
||||
public BlockChest()
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setDefaultState( this.getDefaultState().withProperty( SLOT_STATE, DriveSlotState.EMPTY ) );
|
||||
this.setDefaultState( this.getDefaultState().with( SLOT_STATE, DriveSlotState.EMPTY ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +87,7 @@ public class BlockChest extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
return super.getActualState( state, worldIn, pos )
|
||||
.withProperty( SLOT_STATE, slotState );
|
||||
.with( SLOT_STATE, slotState );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
{
|
||||
TileDrive te = this.getTileEntity( world, pos );
|
||||
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
|
||||
return extState.withProperty( SLOTS_STATE, te == null ? DriveSlotsState.createEmpty( 10 ) : DriveSlotsState.fromChestOrDrive( te ) );
|
||||
return extState.with( SLOTS_STATE, te == null ? DriveSlotsState.createEmpty( 10 ) : DriveSlotsState.fromChestOrDrive( te ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user