Duplication
MysteryQuestMan opened this issue ยท 7 comments
I'm apart of a private server where we have your mod and other's installed and I accidentally came across a bug/ glitch. I'm not 100% sure if this is a problem with just the backpack mod or another is causing it but I placed my backpack on an armor stand, a pure vanilla one, and everything inside the backpack dropped. upon swapping my armor with the armor stand again my backpack, along with everything that was inside it, were still there. I had essentially duplicated all my items, and I have yet to tell my friends about it. here is a list of the mods I have if you want to see if another mod is the issue. I hope to hear from you soon
Mhh I never even considered the Vanilla armor stand. The items dropping is sorta intended, as they're stored on the player entity and if for any reason the backpack disappears from the chestplate slot without being properly unequipped, then items should be dropped and then the "backpack data" should disappear from the player. It might be that the data isn't actually removed.
Thank you very much for reporting the issue. I don't currently know when the next version of WBs is coming out yet.
I can tackle this, but only after June 25. I can, however, package up a release if someone else fixes the bug.
WearableBackpacks/src/main/java/net/mcft/copy/backpacks/ProxyCommon.java
Lines 244 to 249 in cbea433
This is likely missing simply backpack.setData(null);
.
I discovered that the Quark mod is responsible. having the backpack on while normal right clicking does nothing but upon sneaking it takes all my armor data and transfers it to the armor stand. since there isn't any code for the armor stand to hold the backpack in the first place [hence why no model appears on the armor stand] it retains the NBT data of the backpack on the stand but since the pack is meant to either be on the ground or on a player for it to have NBT data it glitches slightly and dupes anything in the backpack.
The backpack item, by design, does not store any contents as NBT data. But yes, it is probably true that Quark is "at fault" for unequipping the backpack - which is reasonable considering it is equipped in the armor slots - though it does not extend ItemArmor
, which is one of the ways I tried to avoid mods treating the backpack as regular armor. This specific issue should probably be reported to Quark.
To explain again, I assume what happens is that when Quark moves the backpack item to the armor stand, it is not unequipped properly (as there's no way to do so unless writing a special case handler for backpacks / using the API).
If there is backpack data on the player, which contains the items, but no backpack appears to be equipped, the items are dropped on the ground. The problem here is that I forgot to actually remove the backpack data after the items are dropped.
Then, upon re-equipping the backpack, I assume the existing backpack data that still contains all the same items will be reused so you end up with both dropped and stored items in your backpack.
Yes, just tested with 3.1.3 and 3.1.2. It happens in both.
Strangely, it only happens if the contents of the backpack have been previously observed, ie....
- You put stuff in the pack and put the pack on the armor stand. Items pop out (duped)
- You take the pack off of the armor stand but don't look inside
- You put the pack back on the stand. No items pop out (no dupe this time)
- You take the pack off, set it down and open it (no other interaction required)
- You pick up the pack and put it on the armor stand again. Items pop out (duped)
The item that pops out does not drop at your feet. Make sure to look around the area.
Luckily, this issue can be prevented simply by disabling the "quick armor swapping" feature in quark, which is not a big deal to me, at least.
I officially dub thee "Schrodinger's backpack"