Search in sources :

Example 1 with TileEntityInventoryRerouter

use of lumien.randomthings.tileentity.TileEntityInventoryRerouter in project Random-Things by lumien231.

the class BlockInventoryRerouter method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    TileEntity te = worldIn.getTileEntity(pos);
    IExtendedBlockState extendedState = (IExtendedBlockState) state;
    if (te instanceof TileEntityInventoryRerouter) {
        TileEntityInventoryRerouter rerouter = (TileEntityInventoryRerouter) te;
        Map<EnumFacing, EnumFacing> facingMap = rerouter.getFacingMap();
        return extendedState.withProperty(OVERRIDE_DATA, new HashMap<>(facingMap));
    }
    return super.getActualState(state, worldIn, pos);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) EnumFacing(net.minecraft.util.EnumFacing) TileEntityInventoryRerouter(lumien.randomthings.tileentity.TileEntityInventoryRerouter)

Example 2 with TileEntityInventoryRerouter

use of lumien.randomthings.tileentity.TileEntityInventoryRerouter in project Random-Things by lumien231.

the class BlockInventoryRerouter method onBlockActivated.

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    TileEntity te = worldIn.getTileEntity(pos);
    EnumFacing myFacing = state.getValue(FACING);
    if (facing != myFacing) {
        if (te instanceof TileEntityInventoryRerouter) {
            ((TileEntityInventoryRerouter) te).rotateFacing(facing);
        }
        return true;
    } else {
        return false;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EnumFacing(net.minecraft.util.EnumFacing) TileEntityInventoryRerouter(lumien.randomthings.tileentity.TileEntityInventoryRerouter)

Aggregations

TileEntityInventoryRerouter (lumien.randomthings.tileentity.TileEntityInventoryRerouter)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)1