use of WayofTime.bloodmagic.core.data.Binding in project BloodMagic by WayofTime.
the class ItemSigilToggleable method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (stack.getItem() instanceof ISigil.Holding)
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
Binding binding = getBinding(stack);
if (// Make sure Sigils are bound before handling. Also ignores while toggling state
binding == null || player.isSneaking())
return EnumActionResult.PASS;
return (NetworkHelper.getSoulNetwork(binding).syphonAndDamage(player, getLpUsed()) && onSigilUse(player.getHeldItem(hand), player, world, pos, side, hitX, hitY, hitZ)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
}
use of WayofTime.bloodmagic.core.data.Binding in project BloodMagic by WayofTime.
the class ItemSigilDivination method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (stack.getItem() instanceof ISigil.Holding)
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote) {
super.onItemRightClick(world, player, hand);
Binding binding = getBinding(stack);
if (binding != null) {
int currentEssence = NetworkHelper.getSoulNetwork(binding).getCurrentEssence();
List<ITextComponent> toSend = Lists.newArrayList();
if (!binding.getOwnerId().equals(player.getGameProfile().getId()))
toSend.add(new TextComponentTranslation(tooltipBase + "otherNetwork", binding.getOwnerName()));
toSend.add(new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence));
ChatUtil.sendNoSpam(player, toSend.toArray(new ITextComponent[toSend.size()]));
}
}
return super.onItemRightClick(world, player, hand);
}
use of WayofTime.bloodmagic.core.data.Binding in project BloodMagic by WayofTime.
the class ItemSigilToggleableBase method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
if (!stack.hasTagCompound())
return;
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic." + (getActivated(stack) ? "activated" : "deactivated")));
Binding binding = getBinding(stack);
if (binding != null)
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.currentOwner", binding.getOwnerName()));
}
Aggregations