Botania (Fabric/Quilt)

Botania (Fabric/Quilt)

5M Downloads

Botania bows don't zoom in slightly when drawn

anoomolu opened this issue ยท 4 comments

commented

Mod Loader

Both Fabric and Forge (I confirm that I have tested both loaders and will specify both loader versions below)

Minecraft Version

1.20.1

Botania version

1.20.1-443

Modloader version

Forge 47.2.0 / Fabric Loader 0.15.0, API 0.91.0

Modpack info

No response

The latest.log file

n/a

Issue description

The display zooms in slightly when drawing a normal bow, however the Livingwood and Crystal bows don't appear to do that. Tested on 1.19.2 as well and found the same.

Steps to reproduce

No response

Other information

No response

commented

For that particular implementation we might need MixinExtras. I'm not quite sure if the implementation would be compatible to other bow mods without it.

commented

Made an implementation using MixinExtras functionality. It may or may not make it into any releases before switching over to NeoForge.

commented

This probably requires a mixin for AbstractClientPlayer, injecting logic into getFieldOfViewModifier().
I wonder what would be the better way to do this, from a compatibility point of view:

  • Redirect the ItemStack.is(Items.BOW) call to instead check for ItemStack.getItem() instanceof BowItem and reuse the existing logic. This would likely prevent other mods from hooking into the bow zoom the same way. Also it would not take into account the faster draw speed of the Crystal Bow. It would, however, fix the same issue for other mods with bows extending BowItem.
  • Inject a separate FOV calculation for only the Livingwood Bow and Crystal Bow somewhere such that it likely won't interfere if another mod attempts to do something similar. This would duplicate existing code, but allows taking the Crystal Bow draw speed into account. It might, however, mess with mods that try to inject additional FOV effect logic after the item use section.
commented

I was told in fabriccord that best practice for something like this is to make the inject check for your item(s) specifically instead of instances of the vanilla classes, for example ItemStack.is(BotaniaItems.livingwoodBow)

Ranged Weapon API by Daedelus does something similar here: https://github.com/FabricExtras/RangedWeaponAPI/blob/1.20.1/src/main/java/net/fabric_extras/ranged_weapon/mixin/client/AbstractClientPlayerEntityMixin.java#L22-L29