"Tool / weapon overrides entity" bug or feature? Fix or enhancement proposition
rumrunner0 opened this issue · 4 comments
Game version: 1.20.1
Mod Loader version: Fabric 0.16.9
Dynamic Crosshair mod version: 9.3+1.20.1-fabric
It seems the option "Tool / weapon overrides entity" exactly what its name suggests and sometimes incorrectly. It overrides ONLY tools (like axes, hoes, etc) and weapons (looks like melee weapon only). So it seems this setting does not include ranged weapons or throwables. I'll show my setup and then some in-game screenshots.
Keep in mind that I have the following setting values:
- "Tool / weapon overrides entity": true
- "Holding tool": "Always"
- "Holding melee weapon": true
- "Holding ranged weapon": "Always"
- "Holding throwable": "Always"
Also I have the same crosshair for 3 cases: "Regular", "Looking at block", "Looking at block". This makes debugging a bit harder, my bad. However, I've double-checked everything after taking these screenshots.
Here are some tests with screenshots.
Holding a sword (melee weapon) and:
- not targeting any block or entity and unable to interact with anything -> it shows "Holding melee weapon" crosshair (correct).
- targeting a block -> it still shows "Holding melee weapon" crosshair (correct).
- targeting an interactable block -> it shows "Holding melee weapon" with "Looking at interactable block" crosshairs (correct).
Next, let's do the same holding the ranged weapon.
Holding a bow (ranged weapon) and:
- not targeting any block or entity and unable to interact with anything -> it shows "Holding ranged weapon" with "Regular" crosshairs (INCORRECT). The "Regular" shows up for no reason (it doesn't show up for melee).
- targeting a block -> it still shows "Holding ranged weapon" with "Looking at block" crosshairs (INCORRECT). The "Looking at block" shows up for no reason (it doesn't show up for melee).
- targeting an interactable block -> it shows "Looking at block" with "Looking at interactable block" crosshairs (completely INCORRECT). The "Looking at block" shows up for no reason (it doesn't show up for melee). ALSO the "Holding ranged weapon" disappeared!
Exactly the same for throwables and shields (which I believe is not correct).
And the last thing I've noticed is related to blocks. Let's do the same test.
Keep in ming that I have "Holding block": "IfTargeting".
Holding a block and:
- not targeting any block or entity and unable to interact with anything -> it shows nothing (correct).
- targeting a block -> it shows only "Holding block" crosshair (correct).
- targeting an interactable block -> it shows "Looking at block" with "Looking at interactable block" crosshairs (completely INCORRECT). The "Looking at block" shows up for no reason. ALSO the "Holding block" disappeared!
It would be great if you count include ranged weapons and throwables in the "Tool / weapon overrides entity" setting. Alternatively, you could add a separate setting for this.
Also, there are definitely some bugs related to this. I hope you'll be able to fix them.
Hope my explanation makes sense!
Please let me know if you need any further info!
Oh wow, thank you for the detailed writeup! There are definitely some problems shown here. Sometimes I regret making things this customisable; even getting the default config working correctly is a tedious task, and I'm sure there's still mistakes there as well.
Your interpretation of the settings would have been correct for the older versions of the mod; however, I realised that both code-wise and conceptually, it was a flawed design. I might have to tweak the wording on the config screen to better represent that in some cases.
Rather than looking at it as "what am I holding in my hand", the idea is now that the crosshair should represent the actual effect of actions. Crosshair computation is split between "left mouse action" and "right mouse action". Each of those gets assigned the fitting crosshair—with some hardcoded exceptions, like ranged weapons not showing the default crosshair. This explains your last screenshot, for example: you might be holding a block, but right clicking in this context would interact with the block in front of you. If you were to crouch, the UI would not open anymore, so the "holding block" crosshair shows instead again. The same consideration applies with ranged weapons, throwables, and shields.
This logic works fine with the default settings, but I agree that it becomes muddy when, for example, "Holding block" is set to "Targeting". Because then it will still show the block crosshair even when the block cannot be placed in the current context, invalidating the entire "the crosshair should accurately reflect what happens" idea. Hmm.
That being said, I agree that the regular crosshair showing up with ranged weapons is a bug for sure. Last I checked, this worked fine in the default config, but I will have a look at why it behaves oddly in your case.
@Crendgrim, thanks for the reply! You've done a great job creating this mod and making it so customizable. And yes, it requires some effort to test all the combinations, I understand this. I really hope you can fix it and make this mod even cooler. Good luck!
@Crendgrim btw, everything works as intended on 7.4.4 version (1.20.1).
Here is my setup on this version
Behavior
Style
The correct logic for me is to use the appropriate crosshair for each item type in my hand (melee, ranged, tool, throwable, shield, block, etc.), while combining it with an additional crosshair when needed (e.g., when hovering over an interactable block or holding something usable).
That logic was indeed how it worked at first, but I encountered too many places where I had to code in exceptions. Simply building it around "what do left and right mouse button do" gives me a much cleaner model, and makes it obvious which behaviour should dictate the crosshair (based on what vanilla does).