Search in sources :

Example 1 with TileEntityEnergyCube

use of mekanism.common.tile.TileEntityEnergyCube in project Mekanism by mekanism.

the class BlockEnergyCube method getShape.

@Nonnull
@Override
@Deprecated
public VoxelShape getShape(@Nonnull BlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull ISelectionContext context) {
    TileEntityEnergyCube energyCube = WorldUtils.getTileEntity(TileEntityEnergyCube.class, world, pos, true);
    int index;
    if (energyCube == null) {
        // Default to facing north all enabled
        index = getIndex(1, 1, 1, 1, 1, 1, false, false);
    } else {
        ConfigInfo energyConfig = energyCube.configComponent.getConfig(TransmissionType.ENERGY);
        if (energyConfig == null) {
            // Default to facing north all enabled
            index = getIndex(1, 1, 1, 1, 1, 1, false, false);
        } else {
            Direction facing = Attribute.get(this, AttributeStateFacing.class).getDirection(state);
            index = getIndex(// top
            isSideEnabled(energyConfig, facing, Direction.UP), // bottom
            isSideEnabled(energyConfig, facing, Direction.DOWN), // front
            isSideEnabled(energyConfig, facing, Direction.SOUTH), // back
            isSideEnabled(energyConfig, facing, Direction.NORTH), // left
            isSideEnabled(energyConfig, facing, Direction.EAST), // right
            isSideEnabled(energyConfig, facing, Direction.WEST), facing == Direction.EAST || facing == Direction.WEST, facing == Direction.DOWN || facing == Direction.UP);
        }
    }
    return bounds[index];
}
Also used : TileEntityEnergyCube(mekanism.common.tile.TileEntityEnergyCube) ConfigInfo(mekanism.common.tile.component.config.ConfigInfo) Direction(net.minecraft.util.Direction) AttributeStateFacing(mekanism.common.block.attribute.AttributeStateFacing) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)1 AttributeStateFacing (mekanism.common.block.attribute.AttributeStateFacing)1 TileEntityEnergyCube (mekanism.common.tile.TileEntityEnergyCube)1 ConfigInfo (mekanism.common.tile.component.config.ConfigInfo)1 Direction (net.minecraft.util.Direction)1