Jump to content

[1.9.4] Decreasing Bow Draw Speed


TLHPoE

Recommended Posts

I have this event method registered:

@SubscribeEvent
public void onUpdate(LivingEvent.LivingUpdateEvent e) {
	if(e.getEntityLiving() instanceof EntityPlayer) {
		EntityPlayer p = (EntityPlayer) e.getEntityLiving();

		if(!p.worldObj.isRemote) {
			PlayerStats stats = ScalaeCapabilities.getStats(p);

			...

			if(p.getActiveItemStack() != null && p.getActiveItemStack().getItem() == Items.BOW && (stats.hasPerk(31) || stats.hasPerk(30))) {
				Field f = null;
				int useCount = -1;

				try {
					f = EntityLivingBase.class.getDeclaredField("activeItemStackUseCount");

					f.setAccessible(true);

					useCount = f.getInt(p);

					if(stats.hasPerk(31)) {
						f.set(p, useCount + 1);

						System.out.println("HELLO");
					}
				} catch(NoSuchFieldException e1) {
					e1.printStackTrace();
				} catch(SecurityException e1) {
					e1.printStackTrace();
				} catch(IllegalArgumentException e1) {
					e1.printStackTrace();
				} catch(IllegalAccessException e1) {
					e1.printStackTrace();
				}
			}
		}
	}
}

 

I thought this code would decrease the amount of time needed to fully draw the bow, but instead it did nothing to the length of time (visually at least), made the arrows travel a meager 1 block away after drawing for a couple of seconds, and not being able to produce the "critical hit" that is usually seen when you fully draw the bow and release the arrow.

 

The message "HELLO" is being printed.

Kain

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.