use of net.geforcemods.securitycraft.api.Owner in project SecurityCraft by Geforce132.
the class ItemKeyPanel method onItemUse.
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote) {
if (BlockUtils.getBlock(worldIn, pos) == mod_SecurityCraft.frame) {
Owner owner = ((IOwnable) worldIn.getTileEntity(pos)).getOwner();
EnumFacing enumfacing = worldIn.getBlockState(pos).getValue(BlockKeypad.FACING);
worldIn.setBlockState(pos, mod_SecurityCraft.keypad.getDefaultState().withProperty(BlockKeypad.FACING, enumfacing).withProperty(BlockKeypad.POWERED, false));
((IOwnable) worldIn.getTileEntity(pos)).getOwner().set(owner.getUUID(), owner.getName());
stack.stackSize -= 1;
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.FAIL;
}
Aggregations