TheRedBrain / rpg-inventory

MIT License
1 stars 0 forks source link

Weirdness when Equipping Weapons in Offhand and Main Hand #22

Closed InputandOutput closed 1 month ago

InputandOutput commented 1 month ago

With a custom mod pack that has rpg inventory and better combat installed (with necessary dependencies), trying to equip weapons in both the main hand and off hand will result in "ghost items".

In survival, trying to equip the main hand while the offhand occupies a weapon and swinging results in the main hand weapon "appearing" in the same slot that the main hand weapon used to occupy. Interacting with the ghost item in the inventory "unequips" the main hand weapon, while interacting with the main hand weapon in the rpg inventory main hand slot causes the weapon in the inventory to "disappear".

In creative mode, instead of disappearing, the main hand weapon may be duplicated. Mainhand/offhand behavior is normal when rpg inventory is disabled and Better Combat is enabled.

Yeah idk what to make of this

TheRedBrain commented 1 month ago

Can this issue be reproduced with only RPG Inventory installed? Or is Better Combat required?

InputandOutput commented 1 month ago

Better Combat is required for dual-wielding attacks. Without better combat, it's just the main hand swinging vanilla Minecraft style.

TheRedBrain commented 1 month ago

okay Does one of the equipped weapons weapon_attribute have a "two_handed" value set to true?

InputandOutput commented 1 month ago

Likely not, since I was testing with vanilla swords and vanilla mace that were able to be dual-wielded for the bug to occur. Should I record what I see for better understanding?

TheRedBrain commented 1 month ago

Okay, thanks for the information! I'll try to reproduce this issue

A recording of the bug could be quite helpful! :)

TheRedBrain commented 1 month ago

I managed to duplicate the main hand weapon, when an offhand weapon is equipped.

The ghost item always appears in the 9th hotbar slot, regardless of where the mainhand itemstack was located before. When another item is in the 9th hotbar slot, the following happens:

This behaviour stays the same after a full game restart.

Is this the same issue you are having? Or are there differences?

InputandOutput commented 1 month ago

The issue you're describing seems to be similar to the issue I am having. Here is a video that shows what I am experiencing on survival mode.

https://github.com/user-attachments/assets/8bfa78e1-6aac-4735-9042-6d5cec49f40c

Not seen is me duplicating the mace on full game restart.

TheRedBrain commented 1 month ago

Can you go into the client options of RPG Inventory and set the "Always show selected hotbar slot" option to true?

In my testing the ghost item is always placed in the selected hotbar slot. Can you confirm that behaviour?

Thanks!

InputandOutput commented 1 month ago

Yes, the selected hot bar slot is always the spot where the ghost item appears. Funnily enough, I can also reproduce the easy duping by sheathing, then interacting with the now-legit "ghost" item.

TheRedBrain commented 1 month ago

Sheathing also creates a ghost item?

Or is the ghost item still created by attacking?

TheRedBrain commented 1 month ago

I managed to fix the ghost item creation on attacking.

It's actually an issue with Better Combats off hand attacking

Currently making sure that my fix has no unintended side effects

InputandOutput commented 1 month ago

After creating a ghost item and sheathing, the main hand item and the item in the hotbar are effectively legit items (i.e., hotbar item not deleted when interacting with the main hand item). As shown below:

https://github.com/user-attachments/assets/72a74546-03eb-445a-9324-eff88f6204cb

TheRedBrain commented 1 month ago

I will implement my solution in "Better Combat Extension"

This solution is very much experimental, which is why it is not implemented in Better Combat right now.

TheRedBrain commented 1 month ago

"Better Combat Extension" has been updated with the fix for this bug. Please report any problems that might come up in Better Combat Extensions GitHub