Shweit / Shweit/Expendable-Backpacks
Diamond dupe + other dupes in crafting grid
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
There is a bug that lets you duplicate backpack upgrade materials (copper, iron, gold, diamond)
To Reproduce
Steps to reproduce the behavior:
- Open a crafting table
- surround a gold backpack with diamonds, (multiple per slot)
- craft the backpack
- Dupe the diamonds in the crafting grid!, it can even push a stack past 64
Version information:
- Plugin version [e.g. v1.2.0]
Additional context
I actually tracked the bug down to a snippet of BackpackCraftingListener.class starting at line 133 and fixed it, by replacing
for (int i : surrounding = new int[]{0, 1, 2, 3, 5, 6, 7, 8}) {
ItemStack slot = matrix[i];
if (slot == null || slot.getType() == Material.AIR) continue;
if (slot.getAmount() > 1) {
ItemStack reduced = slot.clone();
reduced.setAmount(slot.getAmount() - 1);
inv.setItem(i + 1, reduced);
continue;
}
inv.setItem(i + 1, null);
}
inv.setItem(5, null);
With this
surrounding = new int[]{0, 1, 2, 3, 5, 6, 7, 8};
int[] var7 = surrounding;
int var8 = surrounding.length;
for(int var9 = 0; var9 < var8; ++var9) {
int i = var7[var9];
ItemStack slot = matrix[i];
if (slot != null && slot.getType() != Material.AIR) {
int invSlot = i + 1;
if (slot.getAmount() > 1) {
ItemStack reduced = slot.clone();
reduced.setAmount(slot.getAmount() - 1);
inv.setItem(invSlot, reduced);
} else {
inv.setItem(invSlot, (ItemStack)null);
}
}
}
inv.setItem(5, (ItemStack)null);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting BackpackCraftingListener.class around line 133, then reproduce the crafting-table steps with a gold backpack and diamond stacks. Verify that crafting consumes the surrounding materials correctly and that no stack can exceed 64 or be duplicated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100