loot table "spreading large stacks" will overwrite existing items
The bug
Item stacks with a count > 1 generated by loot tables are spread into multiple smaller item stacks even if there is not enough place in the container resulting in a loss of items and the following warning message:
[Server thread/WARN]: Tried to over-fill a container
How to reproduce
- Create a loot table which generates 27 item stacks, with some of them having a count > 1
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 1 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": 16 } ], "weight": 1 } ] } ] } - Save it for example in a data pack under \data\loot_tables\custom\test_loot_table.json
- Load the world and place a chest with the loot table
/setblock ~ ~ ~ chest{LootTable:"custom:test_loot_table"} - Open the chest
→ You will notice that it contains less than 24 swords, but the torch item stacks are split into more than 3. Additionally a warning should appear in the log: "[Server thread/WARN]: Tried to over-fill a container"
Code analysis and suggested fix
Based on 1.11.2 decompiled using MCP 9.35 rc1
The problem is that the method net.minecraft.world.storage.loot.LootTable.shuffleItems(List<ItemStack>, int, Random) only calculates the amount of free slots once and not in every iteration and additionally the amount of stacks which should be split is not subtracted.
/** * shuffles items by changing their order and splitting stacks * * @param p_186463_2_ Free slots in container */ private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand) { // Comment: "list" contains the item stacks to split List<ItemStack> list = Lists.<ItemStack>newArrayList(); Iterator<ItemStack> iterator = stacks.iterator(); while (iterator.hasNext()) { ItemStack itemstack = (ItemStack)iterator.next(); if (itemstack.isEmpty()) { iterator.remove(); } else if (itemstack.getCount() > 1) { list.add(itemstack); iterator.remove(); } } // Comment: Removed this and moved it in the loop condition // p_186463_2_ = p_186463_2_ - stacks.size(); // while (p_186463_2_ > 0 && ((List)list).size() > 0) while ((p_186463_2_ - stacks.size() - list.size()) > 0 && ((List)list).size() > 0) { ItemStack itemstack2 = (ItemStack)list.remove(MathHelper.getInt(rand, 0, list.size() - 1)); int i = MathHelper.getInt(rand, 1, itemstack2.getCount() / 2); ItemStack itemstack1 = itemstack2.splitStack(i); if (itemstack2.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack2); } else { stacks.add(itemstack2); } if (itemstack1.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack1); } else { stacks.add(itemstack1); } } stacks.addAll(list); Collections.shuffle(stacks, rand); }
Linked Issues
is duplicated by1
Created Issue:
loot table "spreading large stacks" will overwrite existing items
Here's a chest loot table where I expect to get 24 sword and 3 stacks of torches:
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 5 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 16 } } ], "weight": 15 } ] } ] }Instead, I get far fewer that 24 swords, because there's a new post-processing step that 'spreads out' large stacks of loot into multiple slots in the chest. The bug is that "spreading" should only spread to empty slots, not overwrite existing loot.
relates to
Here's a chest loot table where I expect to get 24 sword and 3 stacks of torches:
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 5 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 16 } } ], "weight": 15 } ] } ] }Instead, I get far fewer that 24 swords, because there's a new post-processing step that 'spreads out' large stacks of loot into multiple slots in the chest. The bug is that "spreading" should only spread to empty slots, not overwrite existing loot.
Here's another example; I want to give the player a diamond sword and a few stacks of blocks. But often the sword is gone:
{ "pools": [ { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:diamond_sword", "weight": 5 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:cooked_porkchop", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:cobblestone", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:grass", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:dirt", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:sand", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:stone", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:brick_block", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] } ] }
Here's a chest loot table where I expect to get 24 sword and 3 stacks of torches:{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 5 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 16 } } ], "weight": 15 } ] } ] }Instead, I get far fewer that 24 swords, because there's a new post-processing step that 'spreads out' large stacks of loot into multiple slots in the chest. The bug is that "spreading" should only spread to empty slots, not overwrite existing loot.
Here's another example; I want to give the player a diamond sword and a few stacks of blocks. But often the sword is gone:
{ "pools": [ { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:diamond_sword", "weight": 5 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:cooked_porkchop", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:cobblestone", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:grass", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:dirt", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:sand", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:stone", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] }, { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:brick_block", "functions": [ { "function": "set_count", "count": 64 } ], "weight": 15 } ] } ] }The bug
Item stacks with a count > 1 generated by loot tables are spread into multiple smaller item stacks even if there is not enough place in the container resulting in a loss of items and the following warning message:
[Server thread/WARN]: Tried to over-fill a containerHow to reproduce
- Create a loot table which generates 27 item stacks, with some of them having a count > 1
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 1 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": { "min": 16, "max": 16 } } ], "weight": 1 } ] } ] }- Save it for example under [WORLD_NAME]\data\loot_tables\custom\test_loot_table.json
- Load the world and place a chest with the loot table
/setblock ~ ~ ~ chest default replace {LootTable:"custom:test_loot_table"}- Open the chest
→ You will notice that it contains less than 24 swords, but the torch item stacks are splitted into more than 3. Additionally a warning should appear in the log: "[Server thread/WARN]: Tried to over-fill a container"Code analysis and suggested fix
Based on 1.11.2 decompiled using MCP 9.35 rc1
The problem is that the method net.minecraft.world.storage.loot.LootTable.shuffleItems(List<ItemStack>, int, Random) only calculates the amount of free slots once and not in every iteration and additionally the amount of stacks which should be splitted is not subtracted.
Suggested fix/** * shuffles items by changing their order and splitting stacks * * @param p_186463_2_ Free slots in container */ private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand) { // Comment: "list" contains the item stacks to split List<ItemStack> list = Lists.<ItemStack>newArrayList(); Iterator<ItemStack> iterator = stacks.iterator(); while (iterator.hasNext()) { ItemStack itemstack = (ItemStack)iterator.next(); if (itemstack.isEmpty()) { iterator.remove(); } else if (itemstack.getCount() > 1) { list.add(itemstack); iterator.remove(); } } // Comment: Removed this and moved it in the loop condition // p_186463_2_ = p_186463_2_ - stacks.size(); // while (p_186463_2_ > 0 && ((List)list).size() > 0) while ((p_186463_2_ - stacks.size() - list.size()) > 0 && ((List)list).size() > 0) { ItemStack itemstack2 = (ItemStack)list.remove(MathHelper.getInt(rand, 0, list.size() - 1)); int i = MathHelper.getInt(rand, 1, itemstack2.getCount() / 2); ItemStack itemstack1 = itemstack2.splitStack(i); if (itemstack2.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack2); } else { stacks.add(itemstack2); } if (itemstack1.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack1); } else { stacks.add(itemstack1); } } stacks.addAll(list); Collections.shuffle(stacks, rand); }
The bug
Item stacks with a count > 1 generated by loot tables are spread into multiple smaller item stacks even if there is not enough place in the container resulting in a loss of items and the following warning message:
[Server thread/WARN]: Tried to over-fill a containerHow to reproduce
- Create a loot table which generates 27 item stacks, with some of them having a count > 1
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 1 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": { "min": 16, "max": 16 } } ], "weight": 1 } ] } ] }- Save it for example under [WORLD_NAME]\data\loot_tables\custom\test_loot_table.json
- Load the world and place a chest with the loot table
/setblock ~ ~ ~ chest default replace {LootTable:"custom:test_loot_table"}- Open the chest
→ You will notice that it contains less than 24 swords, but the torch item stacks are splittedinto more than 3. Additionally a warning should appear in the log: "[Server thread/WARN]: Tried to over-fill a container"Code analysis and suggested fix
Based on 1.11.2 decompiled using MCP 9.35 rc1
The problem is that the method net.minecraft.world.storage.loot.LootTable.shuffleItems(List<ItemStack>, int, Random) only calculates the amount of free slots once and not in every iteration and additionally the amount of stacks which should be split
tedis not subtracted.Suggested fix/** * shuffles items by changing their order and splitting stacks * * @param p_186463_2_ Free slots in container */ private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand) { // Comment: "list" contains the item stacks to split List<ItemStack> list = Lists.<ItemStack>newArrayList(); Iterator<ItemStack> iterator = stacks.iterator(); while (iterator.hasNext()) { ItemStack itemstack = (ItemStack)iterator.next(); if (itemstack.isEmpty()) { iterator.remove(); } else if (itemstack.getCount() > 1) { list.add(itemstack); iterator.remove(); } } // Comment: Removed this and moved it in the loop condition // p_186463_2_ = p_186463_2_ - stacks.size(); // while (p_186463_2_ > 0 && ((List)list).size() > 0) while ((p_186463_2_ - stacks.size() - list.size()) > 0 && ((List)list).size() > 0) { ItemStack itemstack2 = (ItemStack)list.remove(MathHelper.getInt(rand, 0, list.size() - 1)); int i = MathHelper.getInt(rand, 1, itemstack2.getCount() / 2); ItemStack itemstack1 = itemstack2.splitStack(i); if (itemstack2.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack2); } else { stacks.add(itemstack2); } if (itemstack1.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack1); } else { stacks.add(itemstack1); } } stacks.addAll(list); Collections.shuffle(stacks, rand); }
The bug
Item stacks with a count > 1 generated by loot tables are spread into multiple smaller item stacks even if there is not enough place in the container resulting in a loss of items and the following warning message:
[Server thread/WARN]: Tried to over-fill a containerHow to reproduce
- Create a loot table which generates 27 item stacks, with some of them having a count > 1
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 1 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count":{"min": 16,"max": 16 } } ], "weight": 1 } ] } ] }- Save it for example under [WORLD_NAME]\data\loot_tables\custom\test_loot_table.json
- Load the world and place a chest with the loot table
/setblock ~ ~ ~ chest default replace {LootTable:"custom:test_loot_table"}- Open the chest
→ You will notice that it contains less than 24 swords, but the torch item stacks are split into more than 3. Additionally a warning should appear in the log: "[Server thread/WARN]: Tried to over-fill a container"Code analysis and suggested fix
Based on 1.11.2 decompiled using MCP 9.35 rc1
The problem is that the method net.minecraft.world.storage.loot.LootTable.shuffleItems(List<ItemStack>, int, Random) only calculates the amount of free slots once and not in every iteration and additionally the amount of stacks which should be split is not subtracted.
Suggested fix/** * shuffles items by changing their order and splitting stacks * * @param p_186463_2_ Free slots in container */ private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand) { // Comment: "list" contains the item stacks to split List<ItemStack> list = Lists.<ItemStack>newArrayList(); Iterator<ItemStack> iterator = stacks.iterator(); while (iterator.hasNext()) { ItemStack itemstack = (ItemStack)iterator.next(); if (itemstack.isEmpty()) { iterator.remove(); } else if (itemstack.getCount() > 1) { list.add(itemstack); iterator.remove(); } } // Comment: Removed this and moved it in the loop condition // p_186463_2_ = p_186463_2_ - stacks.size(); // while (p_186463_2_ > 0 && ((List)list).size() > 0) while ((p_186463_2_ - stacks.size() - list.size()) > 0 && ((List)list).size() > 0) { ItemStack itemstack2 = (ItemStack)list.remove(MathHelper.getInt(rand, 0, list.size() - 1)); int i = MathHelper.getInt(rand, 1, itemstack2.getCount() / 2); ItemStack itemstack1 = itemstack2.splitStack(i); if (itemstack2.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack2); } else { stacks.add(itemstack2); } if (itemstack1.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack1); } else { stacks.add(itemstack1); } } stacks.addAll(list); Collections.shuffle(stacks, rand); }The bug
Item stacks with a count > 1 generated by loot tables are spread into multiple smaller item stacks even if there is not enough place in the container resulting in a loss of items and the following warning message:
[Server thread/WARN]: Tried to over-fill a containerHow to reproduce
- Create a loot table which generates 27 item stacks, with some of them having a count > 1
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 1 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": 16 } ], "weight": 1 } ] } ] }- Save it for example under [WORLD_NAME]\data\loot_tables\custom\test_loot_table.json
- Load the world and place a chest with the loot table
/setblock ~ ~ ~ chest default replace {LootTable:"custom:test_loot_table"}- Open the chest
→ You will notice that it contains less than 24 swords, but the torch item stacks are split into more than 3. Additionally a warning should appear in the log: "[Server thread/WARN]: Tried to over-fill a container"Code analysis and suggested fix
Based on 1.11.2 decompiled using MCP 9.35 rc1
The problem is that the method net.minecraft.world.storage.loot.LootTable.shuffleItems(List<ItemStack>, int, Random) only calculates the amount of free slots once and not in every iteration and additionally the amount of stacks which should be split is not subtracted.
Suggested fix/** * shuffles items by changing their order and splitting stacks * * @param p_186463_2_ Free slots in container */ private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand) { // Comment: "list" contains the item stacks to split List<ItemStack> list = Lists.<ItemStack>newArrayList(); Iterator<ItemStack> iterator = stacks.iterator(); while (iterator.hasNext()) { ItemStack itemstack = (ItemStack)iterator.next(); if (itemstack.isEmpty()) { iterator.remove(); } else if (itemstack.getCount() > 1) { list.add(itemstack); iterator.remove(); } } // Comment: Removed this and moved it in the loop condition // p_186463_2_ = p_186463_2_ - stacks.size(); // while (p_186463_2_ > 0 && ((List)list).size() > 0) while ((p_186463_2_ - stacks.size() - list.size()) > 0 && ((List)list).size() > 0) { ItemStack itemstack2 = (ItemStack)list.remove(MathHelper.getInt(rand, 0, list.size() - 1)); int i = MathHelper.getInt(rand, 1, itemstack2.getCount() / 2); ItemStack itemstack1 = itemstack2.splitStack(i); if (itemstack2.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack2); } else { stacks.add(itemstack2); } if (itemstack1.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack1); } else { stacks.add(itemstack1); } } stacks.addAll(list); Collections.shuffle(stacks, rand); }
The bug
Item stacks with a count > 1 generated by loot tables are spread into multiple smaller item stacks even if there is not enough place in the container resulting in a loss of items and the following warning message:
[Server thread/WARN]: Tried to over-fill a containerHow to reproduce
- Create a loot table which generates 27 item stacks, with some of them having a count > 1
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 1 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": 16 } ], "weight": 1 } ] } ] }- Save it for example under
[WORLD_NAME]\data\loot_tables\custom\test_loot_table.json- Load the world and place a chest with the loot table
/setblock ~ ~ ~ chestdefaultreplace {LootTable:"custom:test_loot_table"}- Open the chest
→ You will notice that it contains less than 24 swords, but the torch item stacks are split into more than 3. Additionally a warning should appear in the log: "[Server thread/WARN]: Tried to over-fill a container"Code analysis and suggested fix
Based on 1.11.2 decompiled using MCP 9.35 rc1
The problem is that the method net.minecraft.world.storage.loot.LootTable.shuffleItems(List<ItemStack>, int, Random) only calculates the amount of free slots once and not in every iteration and additionally the amount of stacks which should be split is not subtracted.
Suggested fix/** * shuffles items by changing their order and splitting stacks * * @param p_186463_2_ Free slots in container */ private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand) { // Comment: "list" contains the item stacks to split List<ItemStack> list = Lists.<ItemStack>newArrayList(); Iterator<ItemStack> iterator = stacks.iterator(); while (iterator.hasNext()) { ItemStack itemstack = (ItemStack)iterator.next(); if (itemstack.isEmpty()) { iterator.remove(); } else if (itemstack.getCount() > 1) { list.add(itemstack); iterator.remove(); } } // Comment: Removed this and moved it in the loop condition // p_186463_2_ = p_186463_2_ - stacks.size(); // while (p_186463_2_ > 0 && ((List)list).size() > 0) while ((p_186463_2_ - stacks.size() - list.size()) > 0 && ((List)list).size() > 0) { ItemStack itemstack2 = (ItemStack)list.remove(MathHelper.getInt(rand, 0, list.size() - 1)); int i = MathHelper.getInt(rand, 1, itemstack2.getCount() / 2); ItemStack itemstack1 = itemstack2.splitStack(i); if (itemstack2.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack2); } else { stacks.add(itemstack2); } if (itemstack1.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack1); } else { stacks.add(itemstack1); } } stacks.addAll(list); Collections.shuffle(stacks, rand); }The bug
Item stacks with a count > 1 generated by loot tables are spread into multiple smaller item stacks even if there is not enough place in the container resulting in a loss of items and the following warning message:
[Server thread/WARN]: Tried to over-fill a containerHow to reproduce
- Create a loot table which generates 27 item stacks, with some of them having a count > 1
{ "pools": [ { "rolls": 24, "entries": [ { "type": "item", "name": "minecraft:iron_sword", "weight": 1 } ] }, { "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": 16 } ], "weight": 1 } ] } ] }- Save it for example in a data pack under \data\loot_tables\custom\test_loot_table.json
- Load the world and place a chest with the loot table
/setblock ~ ~ ~ chest{LootTable:"custom:test_loot_table"}- Open the chest
→ You will notice that it contains less than 24 swords, but the torch item stacks are split into more than 3. Additionally a warning should appear in the log: "[Server thread/WARN]: Tried to over-fill a container"Code analysis and suggested fix
Based on 1.11.2 decompiled using MCP 9.35 rc1
The problem is that the method net.minecraft.world.storage.loot.LootTable.shuffleItems(List<ItemStack>, int, Random) only calculates the amount of free slots once and not in every iteration and additionally the amount of stacks which should be split is not subtracted.
Suggested fix/** * shuffles items by changing their order and splitting stacks * * @param p_186463_2_ Free slots in container */ private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand) { // Comment: "list" contains the item stacks to split List<ItemStack> list = Lists.<ItemStack>newArrayList(); Iterator<ItemStack> iterator = stacks.iterator(); while (iterator.hasNext()) { ItemStack itemstack = (ItemStack)iterator.next(); if (itemstack.isEmpty()) { iterator.remove(); } else if (itemstack.getCount() > 1) { list.add(itemstack); iterator.remove(); } } // Comment: Removed this and moved it in the loop condition // p_186463_2_ = p_186463_2_ - stacks.size(); // while (p_186463_2_ > 0 && ((List)list).size() > 0) while ((p_186463_2_ - stacks.size() - list.size()) > 0 && ((List)list).size() > 0) { ItemStack itemstack2 = (ItemStack)list.remove(MathHelper.getInt(rand, 0, list.size() - 1)); int i = MathHelper.getInt(rand, 1, itemstack2.getCount() / 2); ItemStack itemstack1 = itemstack2.splitStack(i); if (itemstack2.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack2); } else { stacks.add(itemstack2); } if (itemstack1.getCount() > 1 && rand.nextBoolean()) { list.add(itemstack1); } else { stacks.add(itemstack1); } } stacks.addAll(list); Collections.shuffle(stacks, rand); }
is duplicated by
Caused by MC-91727.
Note that this is similar to
MC-91310which they just fixed, which is another instance of 'DeathLootTable's being exact, whereas chest 'LootTable's were "lossy". So I expect this bug is an unintended thing they will fix, since they fixed the other similar issue.Still present in 15w45a
This is your ticket, please update the affected versions yourself instead of leaving a comment.
Confirmed for 15w50a
I've seen this happen with vanilla loot tables. Like when I go to a nether fortress, often, I find gold ingots, all in stacks of one, spread throughout the chest.
Confirmed for 16w02a.
Confirmed for 16w04a.
Confirmed for 16w05a.
Confirmed for 16w06a.
Confirmed for 1.9 pre-release 1.
Added save file with loot table bundled for reproduction (and confirmed for pre-release 2).
Confirmed for pre-release 3. Should I be adding new comments for confirmation or is editing an older comment preferred?
New comment is more easily noticeable
Confirmed for 1.9.1 pre-release 3.
@Brian McNamara: Structured the report a little bit and reduced it to one example loot table, I hope you are alright with that.
I'm still getting an issue where stacks get split up, is that part intentional or not? It definitely seems wrong since you set the number of potential stacks with "rolls" and then set the number of a given item in each stack with the "set_count" function. But instead the set_count value gets split up into extra stacks for no apparent reason.
Stacks get split up by design, when there's space. It makes things look richer than they really are
How do i fix this? Its an issue becuase other items are being overwritten
You do realize this was fixed all the wayback in 1.13, right?
Im working on a datapack and I guess the issue is becuase the items are being spread, other items are failing to be added if there's no room left. Basically, this bug but backwards. If you have the torches placed first, they spread so there's not enough room for everything else/.
Should I post a new bug report?
Aceplante, unfortunately I can't reproduce your bug. Spreading is done after all rolls have been made. Please verify your datapack and if you still find the bug present in latest stable or snapshot version, feel free to create a new bug report with steps to reproduce. Thank you.
@aceplante, to me it sounds like you are requesting the behavior which was originally considered a bug here. It appears there can either be the current behavior of omitting items if there is no free space, or overwriting existing ones, but not both.
You can create a new bug report (please refer to this one then), but most likely the Mojang developers will close it as "Works as Intended" or similar.