use of mcjty.lib.api.smartwrench.SmartWrenchMode in project RFTools by McJty.
the class PowerCellBlock method wrenchSneakSelect.
@Override
protected boolean wrenchSneakSelect(World world, BlockPos pos, EntityPlayer player) {
if (!world.isRemote) {
SmartWrenchMode currentMode = SmartWrenchItem.getCurrentMode(player.getHeldItem(EnumHand.MAIN_HAND));
if (currentMode == SmartWrenchMode.MODE_SELECT) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof PowerCellTileEntity) {
PowerCellTileEntity powerCellTileEntity = (PowerCellTileEntity) te;
PowerCellTileEntity.dumpNetwork(player, powerCellTileEntity);
}
}
}
return true;
}
use of mcjty.lib.api.smartwrench.SmartWrenchMode in project RFTools by McJty.
the class SmartWrenchItem method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (!world.isRemote) {
SmartWrenchMode mode = getCurrentMode(stack);
if (mode == SmartWrenchMode.MODE_WRENCH) {
mode = SmartWrenchMode.MODE_SELECT;
} else {
mode = SmartWrenchMode.MODE_WRENCH;
}
NBTTagCompound tagCompound = stack.getTagCompound();
if (tagCompound == null) {
tagCompound = new NBTTagCompound();
stack.setTagCompound(tagCompound);
}
tagCompound.setString("mode", mode.getCode());
Logging.message(player, TextFormatting.YELLOW + "Smart wrench is now in " + mode.getName() + " mode.");
}
return super.onItemRightClick(world, player, hand);
}
Aggregations