QuartzFixture and (semi-borked) LightningFX

This commit is contained in:
Sebastian Hartte
2020-06-01 16:59:11 +02:00
parent 260b2d1c92
commit 2a1ba12516
37 changed files with 270 additions and 233 deletions
+5
View File
@@ -126,6 +126,8 @@ sourceSets {
include 'appeng/util/LookDirection.java'
include 'appeng/decorative/solid/BlockQuartzLamp.java'
include 'appeng/client/render/effects/VibrantFX.java'
include 'appeng/client/render/effects/LightningFX.java'
include 'appeng/block/misc/BlockQuartzFixture.java'
include 'appeng/core/sync/AppEngPacket.java'
include 'appeng/core/sync/network/INetworkInfo.java'
@@ -159,6 +161,9 @@ sourceSets {
test {
compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output
java {
exclude '**/*'
}
}
}
@@ -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
@@ -156,7 +156,7 @@ public class FacadeBuilder
{
double offset = thinFacades ? THIN_THICKNESS : THICK_THICKNESS;
AEAxisAlignedBB tmpBB = null;
for( Direction face : Direction.VALUES )
for( Direction face : Direction.values() )
{
// Only faces that aren't on our axis
if( face.getAxis() != side.getAxis() )
@@ -373,7 +373,7 @@ public class FacadeBuilder
private static List<BakedQuad> gatherQuads( IBakedModel model, BlockState state, long rand )
{
List<BakedQuad> modelQuads = new ArrayList<>();
for( Direction face : Direction.VALUES )
for( Direction face : Direction.values() )
{
modelQuads.addAll( model.getQuads( state, face, rand ) );
}
@@ -21,18 +21,31 @@ package appeng.client.render.effects;
import java.util.Random;
import appeng.core.AppEng;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particles.BasicParticleType;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class LightningFX extends Particle
@OnlyIn( Dist.CLIENT )
public class LightningFX extends SpriteTexturedParticle
{
public static final BasicParticleType TYPE = new BasicParticleType(false);
static {
TYPE.setRegistryName(AppEng.MOD_ID, "lightning_fx");
}
private static final Random RANDOM_GENERATOR = new Random();
private static final int STEPS = 5;
@@ -43,13 +56,13 @@ public class LightningFX extends Particle
private final double[] verticesWithUV = new double[3];
private boolean hasData = false;
public LightningFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b )
private LightningFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b )
{
this( w, x, y, z, r, g, b, 6 );
this.regen();
}
protected LightningFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b, final int maxAge )
private LightningFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b, final int maxAge )
{
super( w, x, y, z, r, g, b );
this.precomputedSteps = new double[LightningFX.STEPS][3];
@@ -80,7 +93,7 @@ public class LightningFX extends Particle
@Override
public IParticleRenderType getRenderType() {
// TODO: FIXME
return IParticleRenderType.NO_RENDER;
return IParticleRenderType.PARTICLE_SHEET_OPAQUE;
}
@Override
@@ -103,8 +116,13 @@ public class LightningFX extends Particle
}
@Override
public void renderParticle( final BufferBuilder tess, final Entity p_180434_2_, final float l, final float rX, final float rY, final float rZ, final float rYZ, final float rXY )
{
public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) {
Vec3d vec3d = renderInfo.getProjectedView();
float centerX = (float)(MathHelper.lerp(partialTicks, this.prevPosX, this.posX) - vec3d.getX());
float centerY = (float)(MathHelper.lerp(partialTicks, this.prevPosY, this.posY) - vec3d.getY());
float centerZ = (float)(MathHelper.lerp(partialTicks, this.prevPosZ, this.posZ) - vec3d.getZ());
final float j = 1.0f;
float red = this.particleRed * j * 0.9f;
float green = this.particleGreen * j * 0.95f;
@@ -115,13 +133,9 @@ public class LightningFX extends Particle
{
this.regen();
}
double f6 = this.particleTextureIndexX / 16.0;
final double f7 = f6 + 0.0324375F;
double f8 = this.particleTextureIndexY / 16.0;
final double f9 = f8 + 0.0324375F;
f6 = f7;
f8 = f9;
float u = this.getMinU() + (this.getMaxU() - this.getMinU()) / 2;
float v = this.getMinV() + (this.getMaxV() - this.getMinV()) / 2;
double scale = 0.02;// 0.02F * this.particleScale;
@@ -133,27 +147,27 @@ public class LightningFX extends Particle
double oz = 0;
final PlayerEntity p = Minecraft.getInstance().player;
double offX = -rZ;
double offY = MathHelper.cos( (float) ( Math.PI / 2.0f + p.rotationPitch * 0.017453292F ) );
double offZ = rX;
// FIXME: Billboard rotation is not applied to the particle yet,
// FIXME The old version apparently did this by hand using rX,rZ -> replicate using the quaternion
for( int layer = 0; layer < 2; layer++ )
{
if( layer == 0 )
{
scale = 0.04;
offX *= 0.001;
offY *= 0.001;
offZ *= 0.001;
// FIXME offX *= 0.001;
// FIXME offY *= 0.001;
// FIXME offZ *= 0.001;
red = this.particleRed * j * 0.4f;
green = this.particleGreen * j * 0.25f;
blue = this.particleBlue * j * 0.45f;
}
else
{
offX = 0;
offY = 0;
offZ = 0;
// FIXME offX = 0;
// FIXME offY = 0;
// FIXME offZ = 0;
scale = 0.02;
red = this.particleRed * j * 0.9f;
green = this.particleGreen * j * 0.65f;
@@ -164,9 +178,10 @@ public class LightningFX extends Particle
{
this.clear();
double x = ( this.prevPosX + ( this.getPosX() - this.prevPosX ) * l - interpPosX ) - offX;
double y = ( this.prevPosY + ( this.getPosY() - this.prevPosY ) * l - interpPosY ) - offY;
double z = ( this.prevPosZ + ( this.getPosZ() - this.prevPosZ ) * l - interpPosZ ) - offZ;
// FIXME removed interpPos here, check if this is correct
double x = centerX; // FIXME - offX;
double y = centerY; // FIXME - offY;
double z = centerZ; // FIXME - offZ;
for( int s = 0; s < LightningFX.STEPS; s++ )
{
@@ -211,7 +226,7 @@ public class LightningFX extends Particle
b[1] = y;
b[2] = z;
this.draw( red, green, blue, tess, a, b, f6, f8 );
this.draw( red, green, blue, buffer, a, b, u, v );
x = xN;
y = yN;
@@ -219,10 +234,6 @@ public class LightningFX extends Particle
}
}
}
/*
* GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); GL11.glDisable( GL11.GL_CULL_FACE ); tess.draw();
* GL11.glPopAttrib(); tess.startDrawingQuads();
*/
}
private void clear()
@@ -230,22 +241,22 @@ public class LightningFX extends Particle
this.hasData = false;
}
private void draw( float red, float green, float blue, final BufferBuilder tess, final double[] a, final double[] b, final double f6, final double f8 )
private void draw( float red, float green, float blue, final IVertexBuilder tess, final double[] a, final double[] b, final float u, final float v )
{
if( this.hasData )
{
tess.pos( a[0], a[1], a[2] ).tex( f6, f8 ).color( red, green, blue, this.particleAlpha ).lightmap( BRIGHTNESS, BRIGHTNESS ).endVertex();
tess.pos( a[0], a[1], a[2] ).tex( u, v ).color( red, green, blue, this.particleAlpha ).lightmap( BRIGHTNESS, BRIGHTNESS ).endVertex();
tess.pos( this.vertices[0], this.vertices[1], this.vertices[2] )
.tex( f6, f8 )
.tex( u, v )
.color( red, green, blue, this.particleAlpha )
.lightmap( BRIGHTNESS, BRIGHTNESS )
.endVertex();
tess.pos( this.verticesWithUV[0], this.verticesWithUV[1], this.verticesWithUV[2] )
.tex( f6, f8 )
.tex( u, v )
.color( red, green, blue, this.particleAlpha )
.lightmap( BRIGHTNESS, BRIGHTNESS )
.endVertex();
tess.pos( b[0], b[1], b[2] ).tex( f6, f8 ).color( red, green, blue, this.particleAlpha ).lightmap( BRIGHTNESS, BRIGHTNESS ).endVertex();
tess.pos( b[0], b[1], b[2] ).tex( u, v ).color( red, green, blue, this.particleAlpha ).lightmap( BRIGHTNESS, BRIGHTNESS ).endVertex();
}
this.hasData = true;
for( int x = 0; x < 3; x++ )
@@ -259,4 +270,20 @@ public class LightningFX extends Particle
{
return this.precomputedSteps;
}
@OnlyIn(Dist.CLIENT)
public static class Factory implements IParticleFactory<BasicParticleType> {
private final IAnimatedSprite spriteSet;
public Factory(IAnimatedSprite spriteSet) {
this.spriteSet = spriteSet;
}
public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
LightningFX lightningFX = new LightningFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed);
lightningFX.selectSpriteRandomly(this.spriteSet);
return lightningFX;
}
}
}
@@ -65,7 +65,7 @@ public class SkyCompassTESR extends FastTESR<TileSkyCompass>
BlockState state = world.getBlockState( pos );
if( state.getPropertyKeys().contains( Properties.StaticProperty ) )
{
state = state.withProperty( Properties.StaticProperty, false );
state = state.with( Properties.StaticProperty, false );
}
if( state instanceof IExtendedBlockState )
@@ -73,7 +73,7 @@ public class SkyCompassTESR extends FastTESR<TileSkyCompass>
IExtendedBlockState exState = (IExtendedBlockState) state.getBlock().getExtendedState( state, world, pos );
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState( exState.getClean() );
exState = exState.withProperty( BlockSkyCompass.ROTATION, getRotation( te ) );
exState = exState.with( BlockSkyCompass.ROTATION, getRotation( te ) );
// Flip forward/up for rendering, the base model is facing up without any rotation
Direction forward = exState.getValue( AEBaseTileBlock.FORWARD );
@@ -84,8 +84,8 @@ public class SkyCompassTESR extends FastTESR<TileSkyCompass>
{
up = Direction.NORTH;
}
exState = exState.withProperty( AEBaseTileBlock.FORWARD, up )
.withProperty( AEBaseTileBlock.UP, forward );
exState = exState.with( AEBaseTileBlock.FORWARD, up )
.with( AEBaseTileBlock.UP, forward );
buffer.setTranslation( x - pos.getX(), y - pos.getY(), z - pos.getZ() );
@@ -25,6 +25,7 @@ import appeng.bootstrap.components.IEntityRegistrationComponent;
import appeng.bootstrap.components.IItemRegistrationComponent;
import appeng.bootstrap.components.IModelRegistrationComponent;
import appeng.client.render.effects.ChargedOreFX;
import appeng.client.render.effects.LightningFX;
import appeng.client.render.effects.VibrantFX;
import appeng.client.render.model.GlassModelLoader;
import appeng.core.stats.AeStats;
@@ -267,11 +268,13 @@ final class Registration
final IForgeRegistry<ParticleType<?>> registry = event.getRegistry();
registry.register(ChargedOreFX.TYPE);
registry.register(VibrantFX.TYPE);
registry.register(LightningFX.TYPE);
}
public void registerParticleFactories(ParticleFactoryRegisterEvent event) {
Minecraft.getInstance().particles.registerFactory(ChargedOreFX.TYPE, ChargedOreFX.Factory::new);
Minecraft.getInstance().particles.registerFactory(VibrantFX.TYPE, VibrantFX.Factory::new);
Minecraft.getInstance().particles.registerFactory(LightningFX.TYPE, LightningFX.Factory::new);
}
//
@@ -22,6 +22,7 @@ package appeng.core.api.definitions;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.ITileDefinition;
import appeng.block.misc.BlockQuartzFixture;
import appeng.block.spatial.BlockMatrixFrame;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.FeatureFactory;
@@ -163,10 +164,16 @@ public final class ApiBlocks implements IBlocks
})
.build();
// this.quartzFixture = registry.block( "quartz_fixture", BlockQuartzFixture::new )
// .features( AEFeature.DECORATIVE_LIGHTS )
// .useCustomItemModel()
// .build();
this.quartzFixture = registry.block( "quartz_fixture", BlockQuartzFixture::new )
.features( AEFeature.DECORATIVE_LIGHTS )
.rendering(new BlockRenderingCustomizer() {
@Override
@OnlyIn(Dist.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.renderType(RenderType.getCutout());
}
})
.build();
// this.fluixBlock = registry.features( AEFeature.FLUIX ).block( "fluix_block", BlockFluix::new ).build();
//
@@ -77,7 +77,7 @@ public class PacketPartPlacement extends AppEngPacket
final PlayerEntityMP sender = (PlayerEntityMP) player;
AppEng.proxy.updateRenderMode( sender );
PartPlacement.setEyeHeight( this.eyeHeight );
PartPlacement.place( sender.getHeldItem( this.hand ), new BlockPos( this.x, this.y, this.z ), Direction.VALUES[this.face], sender, this.hand,
PartPlacement.place( sender.getHeldItem( this.hand ), new BlockPos( this.x, this.y, this.z ), Direction.values()[this.face], sender, this.hand,
sender.world,
PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
AppEng.proxy.updateRenderMode( null );
@@ -90,7 +90,7 @@ public class ToolReplicatorCard extends AEBaseItem
if( te instanceof IGridHost )
{
final IGridHost gh = (IGridHost) te;
final Direction sideOff = Direction.VALUES[src_side];
final Direction sideOff = Direction.values()[src_side];
final Direction currentSideOff = side;
final IGridNode n = gh.getGridNode( AEPartLocation.fromFacing( sideOff ) );
if( n != null )
@@ -33,10 +33,10 @@ public abstract class CommonSlabBlock extends SlabBlock
if( !this.isDouble() )
{
BlockState = BlockState.withProperty( HALF, BlockSlab.EnumBlockHalf.BOTTOM );
BlockState = BlockState.with( HALF, BlockSlab.EnumBlockHalf.BOTTOM );
}
this.setDefaultState( BlockState.withProperty( VARIANT, Variant.DEFAULT ) );
this.setDefaultState( BlockState.with( VARIANT, Variant.DEFAULT ) );
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
this.useNeighborBrightness = true;
}
@@ -47,11 +47,11 @@ public abstract class CommonSlabBlock extends SlabBlock
@Override
public BlockState getStateFromMeta( int meta )
{
BlockState BlockState = this.getDefaultState().withProperty( VARIANT, Variant.DEFAULT );
BlockState BlockState = this.getDefaultState().with( VARIANT, Variant.DEFAULT );
if( !this.isDouble() )
{
BlockState = BlockState.withProperty( HALF, ( meta & 8 ) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP );
BlockState = BlockState.with( HALF, ( meta & 8 ) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP );
}
return BlockState;
@@ -360,12 +360,12 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return false;
}
return w.setBlockState( pos, state.withProperty( BlockColored.COLOR, newColor.dye ) );
return w.setBlockState( pos, state.with( BlockColored.COLOR, newColor.dye ) );
}
if( blk == Blocks.GLASS )
{
return w.setBlockState( pos, Blocks.STAINED_GLASS.getDefaultState().withProperty( BlockStainedGlass.COLOR, newColor.dye ) );
return w.setBlockState( pos, Blocks.STAINED_GLASS.getDefaultState().with( BlockStainedGlass.COLOR, newColor.dye ) );
}
if( blk == Blocks.STAINED_GLASS )
@@ -377,12 +377,12 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return false;
}
return w.setBlockState( pos, state.withProperty( BlockStainedGlass.COLOR, newColor.dye ) );
return w.setBlockState( pos, state.with( BlockStainedGlass.COLOR, newColor.dye ) );
}
if( blk == Blocks.GLASS_PANE )
{
return w.setBlockState( pos, Blocks.STAINED_GLASS_PANE.getDefaultState().withProperty( BlockStainedGlassPane.COLOR, newColor.dye ) );
return w.setBlockState( pos, Blocks.STAINED_GLASS_PANE.getDefaultState().with( BlockStainedGlassPane.COLOR, newColor.dye ) );
}
if( blk == Blocks.STAINED_GLASS_PANE )
@@ -394,12 +394,12 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return false;
}
return w.setBlockState( pos, state.withProperty( BlockStainedGlassPane.COLOR, newColor.dye ) );
return w.setBlockState( pos, state.with( BlockStainedGlassPane.COLOR, newColor.dye ) );
}
if( blk == Blocks.HARDENED_CLAY )
{
return w.setBlockState( pos, Blocks.STAINED_HARDENED_CLAY.getDefaultState().withProperty( BlockColored.COLOR, newColor.dye ) );
return w.setBlockState( pos, Blocks.STAINED_HARDENED_CLAY.getDefaultState().with( BlockColored.COLOR, newColor.dye ) );
}
if( blk instanceof BlockCableBus )
@@ -165,7 +165,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
// The tile might try to update while being destroyed
if( current.getBlock() instanceof BlockCraftingUnit )
{
final BlockState newState = current.withProperty( BlockCraftingUnit.POWERED, power ).withProperty( BlockCraftingUnit.FORMED, formed );
final BlockState newState = current.with( BlockCraftingUnit.POWERED, power ).with( BlockCraftingUnit.FORMED, formed );
if( current != newState )
{
@@ -536,7 +536,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
if( this.pushDirection == AEPartLocation.INTERNAL )
{
for( final Direction d : Direction.VALUES )
for( final Direction d : Direction.values() )
{
output = this.pushTo( output, d );
}
@@ -161,7 +161,7 @@ public class TilePaint extends AEBaseTile
return;
}
for( final Direction side : Direction.VALUES )
for( final Direction side : Direction.values() )
{
if( !this.isSideValid( side ) )
{
@@ -128,7 +128,7 @@ public class TileController extends AENetworkPowerTile
if( this.checkController( this.pos ) && this.world.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState )
{
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) );
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).with( BlockController.CONTROLLER_STATE, metaState ) );
}
}
@@ -94,7 +94,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
if( this.currentMeta != storageLevel )
{
this.currentMeta = (byte) storageLevel;
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, storageLevel ) );
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).with( BlockEnergyCell.ENERGY_STORAGE, storageLevel ) );
}
}
@@ -0,0 +1,5 @@
{
"textures": [
"minecraft:generic_0"
]
}