Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplication #81

Open
MysteryQuestMan opened this issue Jun 12, 2018 · 7 comments
Open

Duplication #81

MysteryQuestMan opened this issue Jun 12, 2018 · 7 comments
Labels

Comments

@MysteryQuestMan
Copy link

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
mods

@copygirl copygirl added the bug label Jun 12, 2018
@copygirl
Copy link
Owner

copygirl commented Jun 12, 2018

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.

@asiekierka
Copy link
Collaborator

I can tackle this, but only after June 25. I can, however, package up a release if someone else fixes the bug.

@copygirl
Copy link
Owner

if (!hasBackpack) {
// Backpack has been removed somehow.
backpack.getType().onFaultyRemoval(entity, backpack);
backpack.setStack(ItemStack.EMPTY);
return;
}

This is likely missing simply backpack.setData(null);.

@MysteryQuestMan
Copy link
Author

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.

@copygirl
Copy link
Owner

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.

@asiekierka
Copy link
Collaborator

Is this still an issue in 3.1.3?

@Laike-Endaril
Copy link

Laike-Endaril commented May 26, 2019

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

  1. You put stuff in the pack and put the pack on the armor stand. Items pop out (duped)
  2. You take the pack off of the armor stand but don't look inside
  3. You put the pack back on the stand. No items pop out (no dupe this time)
  4. You take the pack off, set it down and open it (no other interaction required)
  5. 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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants