public boolean instanceOf(IItemType type) { if (type.equals(IItemType.ItemFishingRod)) { return item instanceof ItemFishingRod; } else if (type.equals(IItemType.ItemPotion)) { return item instanceof ItemPotion; } else if (type.equals(IItemType.ItemFood)) { return item instanceof ItemFood; } else if (type.equals(IItemType.ItemSword)) { return item instanceof ItemSword; } else if (type.equals(IItemType.ItemTool)) { return item instanceof ItemTool; } else if (type.equals(IItemType.ItemNameTag)) { return item instanceof ItemNameTag; } else if (type.equals(IItemType.ItemBlock)) { return item instanceof ItemBlock; } else if (type.equals(IItemType.ItemHoe)) { return item instanceof ItemHoe; } return false; }
public boolean isEquipmentValid() { ItemStack equip = this.getStackInSlot(toolSlot); if (equip.isEmpty()) { return false; } if (equip.getItem() instanceof ItemFishingRod) { return true; } String itemsClass = equip.getItem().getClass().getName(); //TODO: why was i being dum. i should use resourcelocations: "modid:itemid" String aquaBase = "com.teammetallurgy.aquaculture.items."; if (itemsClass.equals(aquaBase + "ItemAquacultureWoodenFishingRod") || itemsClass.equals(aquaBase + "ItemAquacultureFishingRod") || itemsClass.equals(aquaBase + "ItemAdminAquacultureFishingRod") || itemsClass.equals(aquaBase + "ItemAdminFishingRod")) { return true; } return false; }
public static void preInit() { for (final Object o : IceAndShadow2.getPreRegistrationHandlers()) { IaSRegistry.doAdd(o); } setPrimarilyTransfusionTarget(ItemArmor.class); setPrimarilyTransfusionTarget(ItemTool.class); setPrimarilyTransfusionTarget(ItemSword.class); setPrimarilyTransfusionTarget(ItemHoe.class); setPrimarilyTransfusionTarget(ItemShears.class); setPrimarilyTransfusionTarget(ItemFlintAndSteel.class); setPrimarilyTransfusionTarget(ItemBow.class); setPrimarilyTransfusionTarget(ItemFishingRod.class); setPrimarilyTransfusionTarget(IaSItemEchirArmorActive.class); setPrimarilyTransfusionTarget(IaSItemEchirKnifeActive.class); setPrimarilyTransfusionTarget(IaSItemEchirToolActive.class); setPrimarilyTransfusionTarget(IaSItemToolBroken.class); setPrimarilyTransfusionTarget(NyxBaseItemBow.class); setPrimarilyTransfusionTarget(NyxItemFlask.class); setPrimarilyTransfusionTarget(NyxItemSwordFrost.class); addGrenadeLogic(new NyxGrenadeExplosive()); addGrenadeLogic(new NyxGrenadeIceWall()); addGrenadeLogic(new NyxGrenadeShadow()); }
@SubscribeEvent public void onUpdate(LocalPlayerUpdateEvent event) { EntityPlayer me = getLocalPlayer(); ItemStack heldStack = me.getHeldItemMainhand(); // update tick delay if hook is deployed if(ticksCastDelay > casting_delay.get()) ticksCastDelay = casting_delay.get(); // greater than current delay, set to the current delay else if(ticksCastDelay > 0) --ticksCastDelay; // check if player is holding a fishing rod if( heldStack != null && // item not null (shouldn't be, but I am being safe) heldStack.getItem() instanceof ItemFishingRod // item being held is a fishing rod ) { if(!previouslyHadRodEquipped) { ticksCastDelay = casting_delay.get(); previouslyHadRodEquipped = true; } else if(me.fishEntity == null) { // no hook is deployed // cast hook rightClick(); } else { // hook is deployed and rod was not previously equipped // increment the number of ticks that the hook entity has existed ++ticksHookDeployed; if(fail_safe_time.get() != 0 && (ticksHookDeployed > fail_safe_time.get())) { rightClick(); // reel in hook if the fail safe time has passed resetLocals(); } } } else resetLocals(); }
private void rightClick() { // check held item ItemStack stack = WMinecraft.getPlayer().inventory.getCurrentItem(); if(WItem.isNull(stack) || !(stack.getItem() instanceof ItemFishingRod)) return; // right click mc.rightClickMouse(); // reset timer timer = 15; }
public boolean isThrowable() { if (item instanceof ItemBow || item instanceof ItemSnowball || item instanceof ItemEgg || item instanceof ItemEnderPearl || item instanceof ItemSplashPotion || item instanceof ItemLingeringPotion || item instanceof ItemFishingRod) { return true; } return false; }
private boolean playerIsHoldingRod() { ItemStack heldItem = this.player.getHeldItemMainhand(); return (heldItem != null && heldItem.getItem() instanceof ItemFishingRod && heldItem.getItemDamage() <= heldItem.getMaxDamage()); }
private void tryToSwitchRods() { InventoryPlayer inventory = this.player.inventory; for (int i = 0; i < 9; i++) { ItemStack curItemStack = inventory.mainInventory.get(i); if (curItemStack != null && curItemStack.getItem() instanceof ItemFishingRod && (!ModAutoFish.config_autofish_preventBreak || (curItemStack.getMaxDamage() - curItemStack.getItemDamage() > AUTOFISH_BREAKPREVENT_THRESHOLD)) ) { inventory.currentItem = i; break; } } }
private static AdditionalCosts getAdditionalCosts (final Item output) { int index = 0; if (output instanceof ItemArmor) { index = ((ItemArmor) output).armorType; } else if (output instanceof ItemPickaxe) { index = 4; } else if (output instanceof ItemSword) { index = 5; } else if (output instanceof ItemAxe) { index = 6; } else if (output instanceof ItemSpade) { index = 7; } else if (output instanceof ItemHoe) { index = 8; } else if (output instanceof ItemBow) { index = 9; } else if (output instanceof ItemShears) { index = 10; } else if (output instanceof ItemFishingRod) { index = 11; } return AdditionalCosts.values()[index]; }
private boolean playerIsHoldingFishingRod(EntityPlayer player) { return (!Minecraft.getMinecraft().isGamePaused() && player != null && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemFishingRod); }