1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 22:53:22 +00:00

Fix peripheral direction not being set

We moved the direction call within the if block, but never actally
updated the condition! I'm on a roll of stupid bug fixes today, which
really isn't a good sign.
This commit is contained in:
SquidDev 2019-02-07 23:00:08 +00:00
parent f450c0156b
commit 86ad43c3ab

View File

@ -376,17 +376,9 @@ public final IBlockState getStateForPlacement( World world, BlockPos pos, EnumFa
{
case DiskDrive:
default:
{
IBlockState state = getDefaultState().withProperty( Properties.VARIANT, BlockPeripheralVariant.DiskDriveEmpty );
if( placedSide.getAxis() != EnumFacing.Axis.Y )
{
return state.withProperty( Properties.FACING, placedSide );
}
else
{
return state.withProperty( Properties.FACING, EnumFacing.NORTH );
}
}
return getDefaultState()
.withProperty( Properties.VARIANT, BlockPeripheralVariant.DiskDriveEmpty )
.withProperty( Properties.FACING, placedSide.getAxis() == EnumFacing.Axis.Y ? EnumFacing.NORTH : placedSide );
case WirelessModem:
{
EnumFacing dir = placedSide.getOpposite();
@ -410,21 +402,13 @@ else if( dir == EnumFacing.UP )
}
}
case Monitor:
{
return getDefaultState().withProperty( Properties.VARIANT, BlockPeripheralVariant.Monitor );
}
case Printer:
{
return getDefaultState().withProperty( Properties.VARIANT, BlockPeripheralVariant.PrinterEmpty );
}
case AdvancedMonitor:
{
return getDefaultState().withProperty( Properties.VARIANT, BlockPeripheralVariant.AdvancedMonitor );
}
case Speaker:
{
return getDefaultState().withProperty( Properties.VARIANT, BlockPeripheralVariant.Speaker );
}
}
}
@ -466,19 +450,15 @@ public void onBlockPlacedBy( World world, BlockPos pos, IBlockState state, Entit
case Speaker:
case DiskDrive:
case Printer:
{
EnumFacing dir = DirectionUtil.fromEntityRot( player );
if( stack.hasDisplayName() && tile instanceof TilePeripheralBase )
if( tile instanceof TilePeripheralBase )
{
TilePeripheralBase peripheral = (TilePeripheralBase) tile;
peripheral.setLabel( stack.getDisplayName() );
peripheral.setDirection( dir );
peripheral.setDirection( DirectionUtil.fromEntityRot( player ) );
if( stack.hasDisplayName() ) peripheral.setLabel( stack.getDisplayName() );
}
break;
}
case Monitor:
case AdvancedMonitor:
{
if( tile instanceof TileMonitor )
{
int direction = DirectionUtil.fromEntityRot( player ).getIndex();
@ -505,7 +485,6 @@ else if( player.rotationPitch < -66.5F )
}
}
break;
}
}
}