Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi again,

 

First of all, here's the code I'm updating right now :

/**
 * Cancel the FOV decrease caused by the decreasing speed due to player penalties.
 * @param event
 */
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent event) {
	EntityPlayer player = event.getEntity();
	PenaltyManager penalty = new PenaltyManager(player);//It's just a set of methods that give info about the player, not important
	float f = 1.0F;

	if (player.capabilities.isFlying) {
		f *= 1.1F;
	}

	IAttributeInstance iattributeinstance = player
			.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
	f = (float) ((double) f * (((iattributeinstance.getAttributeValue() / penalty
			.getHealthAndExhaustionModifier())
			/ (double) player.capabilities.getWalkSpeed() + 1.0D) / 2.0D));

	if (player.capabilities.getWalkSpeed() == 0.0F || Float.isNaN(f)
			|| Float.isInfinite(f)) {
		f = 1.0F;
	}

	if (player.isHandActive()
			&& player.getActiveItemStack().getItem() == Items.BOW) {
		int i = player.getItemInUseDuration();// FIXME Does not exist anymore ?
		float f1 = (float) i / 20.0F;

		if (f1 > 1.0F) {
			f1 = 1.0F;
		} else {
			f1 *= f1;
		}

		f *= 1.0F - f1 * 0.15F;
	}
	event.setNewfov(f);
}

 

Since 1.9 I believe, all EntityLivingBase can use items, so I naturally searched through it to find replacements for my methods. I found some, but not for getItemInUseDuration(). I used it to know for how long the bow is being used.

 

If anyone has a workaround or found a replacement, I would be very grateful.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.