Slight fixes

This commit is contained in:
Sebastian Hartte
2020-06-04 20:25:19 +02:00
parent c402390282
commit 2139b810d0
4 changed files with 23 additions and 134 deletions
@@ -28,8 +28,8 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
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;
@@ -47,9 +47,6 @@ import java.util.Random;
public class BlockLightDetector extends AEBaseTileBlock<TileLightDetector> implements IOrientableBlock
{
// Cannot use the vanilla FACING property here because it excludes facing DOWN
public static final DirectionProperty FACING = DirectionProperty.create( "facing" );
// Used to alternate between two variants of the fixture on adjacent blocks
public static final BooleanProperty ODD = BooleanProperty.create( "odd" );
@@ -57,13 +54,13 @@ public class BlockLightDetector extends AEBaseTileBlock<TileLightDetector> imple
{
super( Properties.create(Material.MISCELLANEOUS).notSolid() );
this.setDefaultState( this.getDefaultState().with( FACING, Direction.UP ).with( ODD, false ) );
this.setDefaultState( this.getDefaultState().with(BlockStateProperties.FACING, Direction.UP ).with( ODD, false ) );
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(FACING);
builder.add(BlockStateProperties.FACING);
builder.add(ODD);
}
@@ -112,6 +109,8 @@ public class BlockLightDetector extends AEBaseTileBlock<TileLightDetector> imple
@Override
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
// FIXME: We should / rather MUST use state here because at startup, this gets called without a world
final Direction up = this.getOrientable( w, pos ).getUp();
final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getYOffset();
@@ -157,7 +156,7 @@ public class BlockLightDetector extends AEBaseTileBlock<TileLightDetector> imple
@Override
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
{
return new MetaRotation( w, pos, FACING );
return new MetaRotation( w, pos, BlockStateProperties.FACING );
}
}
@@ -324,14 +324,16 @@ public final class ApiBlocks implements IBlocks
.tileEntity( registry.tileEntity("security_station", TileSecurityStation.class, TileSecurityStation::new).build() )
.rendering( new SecurityStationRendering() )
.build();
TileEntityDefinition quantumRingTile = registry.tileEntity("quantum_ring", TileQuantumBridge.class, TileQuantumBridge::new).build();
this.quantumRing = registry.block( "quantum_ring", BlockQuantumRing::new )
.features( AEFeature.QUANTUM_NETWORK_BRIDGE )
.tileEntity( registry.tileEntity( "quantum_ring", TileQuantumBridge.class, TileQuantumBridge::new ).build() )
.tileEntity( quantumRingTile )
.rendering( new QuantumBridgeRendering() )
.build();
this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new )
.features( AEFeature.QUANTUM_NETWORK_BRIDGE )
.tileEntity( registry.tileEntity( "quantum_ring", TileQuantumBridge.class, TileQuantumBridge::new ).build() )
.tileEntity( quantumRingTile )
.rendering( new QuantumBridgeRendering() )
.build();
this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new )
+13 -16
View File
@@ -66,29 +66,26 @@ public class MetaRotation implements IOrientable
{
final BlockState state = this.w.getBlockState( this.pos );
if( this.facingProp != null )
if( this.facingProp != null && state.has(this.facingProp) )
{
return state.get( this.facingProp );
}
// TODO 1.10.2-R - Temp
Axis a = state.get( BlockQuartzPillar.AXIS );
if( a == null )
{
a = Axis.Y;
if (state.has(BlockQuartzPillar.AXIS)) {
Axis a = state.get(BlockQuartzPillar.AXIS);
switch (a) {
case X:
return Direction.EAST;
case Z:
return Direction.SOUTH;
default:
case Y:
return Direction.UP;
}
}
switch( a )
{
case X:
return Direction.EAST;
case Z:
return Direction.SOUTH;
default:
case Y:
return Direction.UP;
}
return Direction.UP;
}
@Override