net.minecraft.item.ItemFishingRod Java Examples
The following examples show how to use
net.minecraft.item.ItemFishingRod.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoFishModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Listener public void receivePacket(EventReceivePacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if(event.getPacket() instanceof SPacketSoundEffect) { final SPacketSoundEffect packet = (SPacketSoundEffect) event.getPacket(); if(packet.getCategory() == SoundCategory.NEUTRAL && packet.getSound() == SoundEvents.ENTITY_BOBBER_SPLASH) { final Minecraft mc = Minecraft.getMinecraft(); if (mc.player.getHeldItemMainhand().getItem() instanceof ItemFishingRod) { mc.player.connection.sendPacket(new CPacketPlayerTryUseItem(EnumHand.MAIN_HAND)); mc.player.swingArm(EnumHand.MAIN_HAND); mc.player.connection.sendPacket(new CPacketPlayerTryUseItem(EnumHand.MAIN_HAND)); mc.player.swingArm(EnumHand.MAIN_HAND); } } } } }
Example #2
Source File: AutoFishHack.java From ForgeWurst with GNU General Public License v3.0 | 6 votes |
private int getRodValue(ItemStack stack) { if(WItem.isNullOrEmpty(stack) || !(stack.getItem() instanceof ItemFishingRod)) return -1; int luckOTSLvl = EnchantmentHelper .getEnchantmentLevel(Enchantments.LUCK_OF_THE_SEA, stack); int lureLvl = EnchantmentHelper.getEnchantmentLevel(Enchantments.LURE, stack); int unbreakingLvl = EnchantmentHelper .getEnchantmentLevel(Enchantments.UNBREAKING, stack); int mendingBonus = EnchantmentHelper.getEnchantmentLevel(Enchantments.MENDING, stack); int noVanishBonus = WEnchantments.hasVanishingCurse(stack) ? 0 : 1; return luckOTSLvl * 9 + lureLvl * 9 + unbreakingLvl * 2 + mendingBonus + noVanishBonus; }
Example #3
Source File: AutoFishHack.java From ForgeWurst with GNU General Public License v3.0 | 6 votes |
private void rightClick() { // check held item ItemStack stack = WMinecraft.getPlayer().inventory.getCurrentItem(); if(WItem.isNullOrEmpty(stack) || !(stack.getItem() instanceof ItemFishingRod)) return; // right click try { Method rightClickMouse = mc.getClass().getDeclaredMethod( wurst.isObfuscated() ? "func_147121_ag" : "rightClickMouse"); rightClickMouse.setAccessible(true); rightClickMouse.invoke(mc); }catch(ReflectiveOperationException e) { setEnabled(false); throw new RuntimeException(e); } // reset timer timer = 15; }
Example #4
Source File: AutoFishMod.java From ForgeHax with MIT License | 5 votes |
@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(); } }