Compiles again.

This commit is contained in:
Sebastian Hartte
2020-06-04 19:58:58 +02:00
parent 237463dd94
commit c402390282
89 changed files with 1353 additions and 1772 deletions
@@ -37,12 +37,12 @@ import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
public class BlockCellWorkbench extends AEBaseTileBlock
public class BlockCellWorkbench extends AEBaseTileBlock<TileCellWorkbench>
{
public BlockCellWorkbench()
{
super( Material.IRON );
super( Properties.create(Material.IRON) );
}
@Override
@@ -58,7 +58,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock
{
if( Platform.isServer() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CELL_WORKBENCH );
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_CELL_WORKBENCH );
}
return ActionResultType.SUCCESS;
}
@@ -19,24 +19,27 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
import javax.annotation.Nullable;
import appeng.core.Api;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockRayTraceResult;
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 org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
@@ -47,31 +50,32 @@ import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.AEApi;
import appeng.api.util.AEAxisAlignedBB;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.effects.LightningFX;
import appeng.client.render.renderable.ItemRenderable;
import appeng.client.render.tesr.ModularTESR;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileCharger;
import appeng.util.Platform;
public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
public class BlockCharger extends AEBaseTileBlock<TileCharger>
{
public BlockCharger()
{
super( Material.IRON );
super( Properties.create(Material.IRON) );
this.setLightOpacity( 2 );
this.setFullSize( this.setOpaque( false ) );
}
@Override
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
return 2; // FIXME Double check this (esp. value range)
}
@Override
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
{
@@ -121,9 +125,9 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
{
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 );
// FIXME final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos
// FIXME .getZ(), 0.0D, 0.0D, 0.0D );
// FIXME Minecraft.getInstance().effectRenderer.addEffect( fx );
}
}
}
@@ -131,8 +135,8 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
final TileCharger tile = this.getTileEntity( w, pos );
if( tile != null )
{
@@ -141,17 +145,17 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
final Direction forward = tile.getForward();
final AEAxisAlignedBB bb = new AEAxisAlignedBB( twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels );
if( up.getFrontOffsetX() != 0 )
if( up.getXOffset() != 0 )
{
bb.minX = 0;
bb.maxX = 1;
}
if( up.getFrontOffsetY() != 0 )
if( up.getYOffset() != 0 )
{
bb.minY = 0;
bb.maxY = 1;
}
if( up.getFrontOffsetZ() != 0 )
if( up.getZOffset() != 0 )
{
bb.minZ = 0;
bb.maxZ = 1;
@@ -181,21 +185,20 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
break;
}
return Collections.singletonList( bb.getBoundingBox() );
return VoxelShapes.create(bb.getBoundingBox());
}
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
return VoxelShapes.create( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return VoxelShapes.create( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
}
@OnlyIn( Dist.CLIENT )
public static TileEntityRenderer<TileCharger> createTesr()
public static Function<TileEntityRendererDispatcher, TileEntityRenderer<TileCharger>> createTesr()
{
return new ModularTESR<>( new ItemRenderable<>( BlockCharger::getRenderedItem ) );
return dispatcher -> new ModularTESR<>( dispatcher, new ItemRenderable<>( BlockCharger::getRenderedItem ) );
}
@OnlyIn( Dist.CLIENT )
@@ -37,12 +37,12 @@ import appeng.tile.misc.TileCondenser;
import appeng.util.Platform;
public class BlockCondenser extends AEBaseTileBlock
public class BlockCondenser extends AEBaseTileBlock<TileCondenser>
{
public BlockCondenser()
{
super( Material.IRON );
super( Properties.create(Material.IRON) );
}
@Override
@@ -58,7 +58,7 @@ public class BlockCondenser extends AEBaseTileBlock
final TileCondenser tc = this.getTileEntity( w, pos );
if( tc != null && !player.isCrouching() )
{
Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CONDENSER );
// FIXME Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CONDENSER );
return ActionResultType.SUCCESS;
}
}
@@ -19,59 +19,55 @@
package appeng.block.misc;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.BooleanProperty;
import appeng.api.util.IOrientable;
import appeng.block.AEBaseTileBlock;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;
import appeng.block.AEBaseTileBlock;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
import javax.annotation.Nullable;
public class BlockInterface extends AEBaseTileBlock
public class BlockInterface extends AEBaseTileBlock<TileInterface>
{
private static final BooleanProperty OMNIDIRECTIONAL = BooleanProperty.create( "omnidirectional" );
public BlockInterface()
{
super( Material.IRON );
super( Properties.create(Material.IRON) );
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { OMNIDIRECTIONAL };
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(OMNIDIRECTIONAL);
}
@Override
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
{
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
// Determine whether the interface is omni-directional or not
TileInterface te = this.getTileEntity( world, pos );
TileInterface te = this.getTileEntity(world, pos);
boolean omniDirectional = true; // The default
if( te != null )
{
if (te != null) {
omniDirectional = te.isOmniDirectional();
}
return super.getActualState( state, world, pos )
.with( OMNIDIRECTIONAL, omniDirectional );
return super.updatePostPlacement(state, facing, facingState, world, pos, facingPos)
.with(OMNIDIRECTIONAL, omniDirectional);
}
@Override
@@ -87,7 +83,7 @@ public class BlockInterface extends AEBaseTileBlock
{
if( Platform.isServer() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INTERFACE );
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INTERFACE );
}
return ActionResultType.SUCCESS;
}
@@ -19,37 +19,32 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.MetaRotation;
import appeng.tile.misc.TileLightDetector;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.properties.DirectionProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.block.material.Material;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
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 appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
import appeng.tile.misc.TileLightDetector;
import java.util.Random;
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision
public class BlockLightDetector extends AEBaseTileBlock<TileLightDetector> implements IOrientableBlock
{
// Cannot use the vanilla FACING property here because it excludes facing DOWN
@@ -60,48 +55,33 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
public BlockLightDetector()
{
super( Material.MISCELLANEOUS );
super( Properties.create(Material.MISCELLANEOUS).notSolid() );
this.setDefaultState( this.blockState.getBaseState().with( FACING, Direction.UP ).with( ODD, false ) );
this.setLightOpacity( 0 );
this.setFullSize( false );
this.setOpaque( false );
this.setDefaultState( this.getDefaultState().with( FACING, Direction.UP ).with( ODD, false ) );
}
@Override
public int getMetaFromState( final BlockState state )
{
return state.get( FACING ).ordinal();
}
@Override
public BlockState getStateFromMeta( final int meta )
{
Direction facing = Direction.values()[meta];
return this.getDefaultState().with( FACING, facing );
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { FACING, ODD };
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(FACING);
builder.add(ODD);
}
@Override
public int getWeakPower( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
{
if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
if( w instanceof World && this.getTileEntity( w, pos ).isReady() )
{
return ( (World) w ).getLightFromNeighbors( pos ) - 6;
// FIXME: This is ... uhm... fishy
return ( (World) w ).getLight( pos ) - 6;
}
return 0;
}
@Override
public void onNeighborChange( final IBlockReader world, final BlockPos pos, final BlockPos neighbor )
{
super.onNeighborChange( world, pos, neighbor );
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) {
super.onNeighborChange( state, world, pos, neighbor );
final TileLightDetector tld = this.getTileEntity( world, pos );
if( tld != null )
@@ -130,24 +110,18 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
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 ) );
final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getZOffset();
return VoxelShapes.create( 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<AxisAlignedBB> 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 getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return VoxelShapes.empty();
}
@Override
@@ -180,25 +154,6 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
return false;
}
@Override
public boolean usesMetadata()
{
return false;
}
@Override
public boolean isFullCube( BlockState state )
{
return false;
}
@Override
@OnlyIn( Dist.CLIENT )
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
{
@@ -19,56 +19,53 @@
package appeng.block.misc;
import java.util.Random;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.effects.LightningFX;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.Random;
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOrientableBlock
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock<TileQuartzGrowthAccelerator> implements IOrientableBlock
{
private static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
public BlockQuartzGrowthAccelerator()
{
super( Material.ROCK );
this.setSoundType( SoundType.METAL );
super( Properties.create(Material.ROCK).sound(SoundType.METAL) );
this.setDefaultState( this.getDefaultState().with( POWERED, false ) );
}
@Override
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
{
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
// FIXME: This is not correct since placement updates dont occur when the TE updates
TileQuartzGrowthAccelerator te = this.getTileEntity( world, pos );
boolean powered = te != null && te.isPowered();
return super.getActualState( state, world, pos )
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
.with( POWERED, powered );
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { POWERED };
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(POWERED);
}
@OnlyIn( Dist.CLIENT )
@@ -95,9 +92,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
double ry = 0.5 + pos.getY();
double rz = 0.5 + pos.getZ();
rx += up.getFrontOffsetX() * d0;
ry += up.getFrontOffsetY() * d0;
rz += up.getFrontOffsetZ() * d0;
rx += up.getXOffset() * d0;
ry += up.getYOffset() * d0;
rz += up.getZOffset() * d0;
final int x = pos.getX();
final int y = pos.getY();
@@ -112,25 +109,25 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
case 0:
dx = 0.6;
dz = d1;
pt = new BlockPos( x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ() );
pt = new BlockPos( x + west.getXOffset(), y + west.getYOffset(), z + west.getZOffset() );
break;
case 1:
dx = d1;
dz += 0.6;
pt = new BlockPos( x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ() );
pt = new BlockPos( x + forward.getXOffset(), y + forward.getYOffset(), z + forward.getZOffset() );
break;
case 2:
dx = d1;
dz = -0.6;
pt = new BlockPos( x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ() );
pt = new BlockPos( x - forward.getXOffset(), y - forward.getYOffset(), z - forward.getZOffset() );
break;
case 3:
dx = -0.6;
dz = d1;
pt = new BlockPos( x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ() );
pt = new BlockPos( x - west.getXOffset(), y - west.getYOffset(), z - west.getZOffset() );
break;
}
@@ -140,23 +137,17 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
return;
}
rx += dx * west.getFrontOffsetX();
ry += dx * west.getFrontOffsetY();
rz += dx * west.getFrontOffsetZ();
rx += dx * west.getXOffset();
ry += dx * west.getYOffset();
rz += dx * west.getZOffset();
rx += dz * forward.getFrontOffsetX();
ry += dz * forward.getFrontOffsetY();
rz += dz * forward.getFrontOffsetZ();
rx += dz * forward.getXOffset();
ry += dz * forward.getYOffset();
rz += dz * forward.getZOffset();
final LightningFX fx = new LightningFX( w, rx, ry, rz, 0.0D, 0.0D, 0.0D );
Minecraft.getInstance().effectRenderer.addEffect( fx );
// FIXME final LightningFX fx = new LightningFX( w, rx, ry, rz, 0.0D, 0.0D, 0.0D );
// FIXME Minecraft.getInstance().effectRenderer.addEffect( fx );
}
}
@Override
public boolean usesMetadata()
{
return false;
}
}
@@ -21,18 +21,20 @@ package appeng.block.misc;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
@@ -42,33 +44,27 @@ import appeng.tile.misc.TileSecurityStation;
import appeng.util.Platform;
public class BlockSecurityStation extends AEBaseTileBlock
public class BlockSecurityStation extends AEBaseTileBlock<TileSecurityStation>
{
private static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
public BlockSecurityStation()
{
super( Material.IRON );
super( Properties.create(Material.IRON) );
this.setDefaultState( this.getDefaultState().with( POWERED, false ) );
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { POWERED };
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(POWERED);
}
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
{
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
// FIXME: Powered state needs to be handled differently
boolean powered = false;
TileSecurityStation te = this.getTileEntity( world, pos );
if( te != null )
@@ -76,7 +72,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
powered = te.isActive();
}
return super.getActualState( state, world, pos )
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
.with( POWERED, powered );
}
@@ -96,7 +92,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
return ActionResultType.SUCCESS;
}
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SECURITY );
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SECURITY );
return ActionResultType.SUCCESS;
}
return ActionResultType.PASS;
@@ -47,7 +47,6 @@ import net.minecraft.world.World;
import appeng.block.AEBaseBlock;
import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.ICustomCollision;
import net.minecraft.world.server.ServerWorld;
@@ -19,35 +19,32 @@
package appeng.block.misc;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.AEConfig;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileVibrationChamber;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.Random;
public final class BlockVibrationChamber extends AEBaseTileBlock
public final class BlockVibrationChamber extends AEBaseTileBlock<TileVibrationChamber>
{
// Indicates that the vibration chamber is currently working
@@ -55,25 +52,24 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
public BlockVibrationChamber()
{
super( Material.IRON );
this.setHardness( 4.2F );
super( Properties.create(Material.IRON).hardnessAndResistance(4.2F) );
this.setDefaultState( this.getDefaultState().with( ACTIVE, false ) );
}
@Override
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
{
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
// FIXME: This must be actively done from within the tile-entity and not passively
TileVibrationChamber te = this.getTileEntity( world, pos );
boolean active = te != null && te.isOn;
return super.getActualState( state, world, pos )
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
.with( ACTIVE, active );
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { ACTIVE };
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(ACTIVE);
}
@Override
@@ -81,7 +77,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
{
if( player.isCrouching() )
{
return false;
return ActionResultType.PASS;
}
if( Platform.isServer() )
@@ -89,7 +85,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
final TileVibrationChamber tc = this.getTileEntity( w, pos );
if( tc != null && !player.isCrouching() )
{
Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_VIBRATION_CHAMBER );
// FIXME Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_VIBRATION_CHAMBER );
return ActionResultType.SUCCESS;
}
}
@@ -111,34 +107,34 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
final TileVibrationChamber tc = (TileVibrationChamber) tile;
if( tc.isOn )
{
float f1 = pos.getX() + 0.5F;
float f2 = pos.getY() + 0.5F;
float f3 = pos.getZ() + 0.5F;
double f1 = pos.getX() + 0.5F;
double f2 = pos.getY() + 0.5F;
double f3 = pos.getZ() + 0.5F;
final Direction forward = tc.getForward();
final Direction up = tc.getUp();
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
f1 += forward.getFrontOffsetX() * 0.6;
f2 += forward.getFrontOffsetY() * 0.6;
f3 += forward.getFrontOffsetZ() * 0.6;
f1 += forward.getXOffset() * 0.6;
f2 += forward.getYOffset() * 0.6;
f3 += forward.getZOffset() * 0.6;
final float ox = r.nextFloat();
final float oy = r.nextFloat() * 0.2f;
final double ox = r.nextDouble();
final double oy = r.nextDouble() * 0.2f;
f1 += up.getFrontOffsetX() * ( -0.3 + oy );
f2 += up.getFrontOffsetY() * ( -0.3 + oy );
f3 += up.getFrontOffsetZ() * ( -0.3 + oy );
f1 += up.getXOffset() * ( -0.3 + oy );
f2 += up.getYOffset() * ( -0.3 + oy );
f3 += up.getZOffset() * ( -0.3 + oy );
f1 += west_x * ( 0.3 * ox - 0.15 );
f2 += west_y * ( 0.3 * ox - 0.15 );
f3 += west_z * ( 0.3 * ox - 0.15 );
w.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
w.spawnParticle( EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
w.addParticle(ParticleTypes.SMOKE, f1, f2, f3, 0.0D, 0.0D, 0.0D );
w.addParticle(ParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D );
}
}
}
@@ -19,6 +19,7 @@
package appeng.block.misc;
import net.minecraft.client.renderer.RenderType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -37,6 +38,7 @@ public class SecurityStationRendering extends BlockRenderingCustomizer
@OnlyIn( Dist.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.renderType(RenderType.getCutout());
rendering.blockColor( ColorableTileBlockColor.INSTANCE );
itemRendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
}