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

Loot Table - Set Count Function doesn't return proper value #10461

Open
PumpkinKnightStudio opened this issue Apr 27, 2024 · 1 comment
Open
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. upstream: bukkit Issues exists in Bukkit and/or CraftBukkit. upstream: spigot Issues exists in Spigot. version: 1.20.4 Game version 1.20.4 version: 1.20.5 Game version 1.20.5

Comments

@PumpkinKnightStudio
Copy link

Expected behavior

With this following code used for randomizing value between 1-3

{ "type": "minecraft:empty", "pools": [ { "rolls": { "min": 1, "max": 3 }, "entries": [ { "type": "minecraft:item", "name": "stone", "functions": [ { **"function": "minecraft:set_count", "count": 0** } ] } ] } ] }

When using "function": "minecraft:set_count", and count to 0 in , it should return a value of dropped item even the there is no actual item drop. In this case the value should be between 1-3

For paper: The value always returned 0

Observed/Actual behavior

The value generated by ths command always returned 0 while using Paper Server, but doesn't happen in Vanilla

Steps/models to reproduce

Use the following code in Datapack Loot Table

{ "type": "minecraft:empty", "pools": [ { "rolls": { "min": 1, "max": 3 }, "entries": [ { "type": "minecraft:item", "name": "stone", "functions": [ { "function": "minecraft:set_count", "count": 1 } ] } ] } ] }

Plugin and Datapack List

This is part of the code in the datapack where
execute store result score @s run loot spawn x y z loot will set a value returned from the loot command

Paper version

This server is running Paper version git-Paper-496 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 7ac24a1 on ver/1.20.4)
You are running the latest version
Previous version: git-Purpur-2176 (MC: 1.20.4)

Other

No response

@PumpkinKnightStudio PumpkinKnightStudio added status: needs triage type: bug Something doesn't work as it was intended to. labels Apr 27, 2024
@kashike kashike added the version: 1.20.4 Game version 1.20.4 label Apr 28, 2024
@electronicboy
Copy link
Member

electronicboy commented Apr 28, 2024

This is generally a spigot issue due to them removing empty stacks from LootCommand#dropInWorld due to their own mangling of ItemStacks, should be easy to patch, just needs a few minutes of testing than I can commit to right now

Well, actually, a trivial quick fix would probably be to just store the size of the list of stacks passed in

@electronicboy electronicboy added upstream status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. upstream: spigot Issues exists in Spigot. upstream: bukkit Issues exists in Bukkit and/or CraftBukkit. version: 1.20.5 Game version 1.20.5 and removed status: needs triage labels Apr 28, 2024
@kashike kashike removed the upstream label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. upstream: bukkit Issues exists in Bukkit and/or CraftBukkit. upstream: spigot Issues exists in Spigot. version: 1.20.4 Game version 1.20.4 version: 1.20.5 Game version 1.20.5
Projects
Status: ✅ Accepted
Development

No branches or pull requests

3 participants