[1.12.2] [bug + Crash] Prestige Reward "duplication" and Concurrent modification crash when collecting a large volume of prestige rewards
Darkmega18 opened this issue ยท 9 comments
Issue Description:
I am the creator of a modpack called "Timeless Technician". I'm using prestige to give players bonus starting gear between runs in what is basically a roguelike. You play the thing, you get some prestige points. you derp up and you gotta restart. You spend prestige at the startish of next run to get some boosts and try to go further and prestige is cleared once you hit the true starting point.
I have all the items set up to fire as command rewards in a script, however the issue with item duplication was also present before I switched to using commands and was using the very basic player.give functions.
Potentially related: If I select a lot of items at once, maybe 12-16 sets of prestiges the amount of commands being run will hang the game for a brief moment and cause a concurrent modification crash a moment after with an unknown source, atleast as far as vanilla fix is concerned. It initially would try to pin it on genetics reborn, but it was since fixed and now comes up nondescript.
What happens:
I have linked up my prestige icons etc, and in testing I select a handful of them. Like say, helmet, chest, pants and boots of hardened leather armor.
When I close the prestige gui and it sends for the items it will dump me the items directly into my inventory, just as I need it to. But it will also THROW (as if I pressed Q on an item in my inventory) a copy of most of the items infront of me, with a touch of randomness. Sometimes missing the pants, sometimes missing the chest. occasionally with a spare helmet, sometimes without, etc.
If this occurs in one of the sets that drop multiple items, like a cache of 10 gardens to use as a food pinata, it will give me the 10 items directly, then it will drop a single unit of the garden ahead of me, resulting in collecting 11 instead of 10 for most cases, once again with a bit of random deviation of which item it leaves out.
Then select too much, and you can crash the game also with the mentioned concurrent modification crash.
What you expected to happen:
It should just give me the items without tossing the extra infront of me like it's doing, regardless if I use the command or give reward function. (command lets me watch what it's throwing to me in the console atleast.)
Is it cause they'll all compressed together into a single operation when the gui closes cause prestige is weird in doing that?
Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):
crafttweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):
Affected Versions (Do not use "latest"):
- Minecraft: 1.12.2
- Forge: forge-14.23.5.2847
- Crafttweaker: 1.12-4.1.20.564
- Using a server: Nope.
- If yes, does the client have the exact same scripts?
My modpack, Timeless technician is available for download and the issue is present in the latest version that is currently uploaded, version 0.1.3. Although it doesn't have the newer prestiges that I've added since then while gradually tinkering around and expanding.
Your most recent log file where the issue was present:
uploaded directly due to the sheer size of it. From up till the moment that I forced the crash to reproduce it. Crash log it references also provided.
https://gist.github.com/Darkmega18/1a7028e4a64f0f161edfd39aba3377c0
https://gist.github.com/Darkmega18/ce870ae7c48a8bd53df9f969f856e45f
For the duplication:
Make sure you are on the server world only
mods.prestige.Rewards.registerReward("name", function(world as IWorld, player as IPlayer){
//When on the client, do nothing
if(world.remote) {
return;
}
player.give(<minecraft:stick>);
});
This may also be the cause for your crash, since that usually happens when a wrong Thread adds entities (items in the world are also entities)
:O :O :O :O I will definitely need to try this. Thank you.
because without others to help me test or without having properly done a test with friends on my server yet due to issues, I never did figure out if it was just me or if it was happening to anyone else.
I don't see how this has anything to do with CraftTweaker, it is a random error that doesn't link to anything crafttweaker related. try reproduce with just crafttweaker and then get back to me.
it's because it happens when scripted rewards are being mass fired? doesn't happen any other way. It's like theres too much being fired in a single hit although it could be more prestiges fault, but no reply from hax at all... but... well, ok, guess I'm screwed. :V
Correlation does not imply causation, just because it happens doesn't mean any of our mods cause it.
Also if you're giving items, just use the registerReward and give the player the item:
mods.prestige.Rewards.registerReward("name", function(world as IWorld, player as IPlayer){
player.give(<minecraft:stick>);
});
I did use it initially. but had similar item duplication issues. and so switched to commands so it'd display in the console when the internal server throws me the items. but for testing sake since it happens either way, I'll see if the give rewards function still causing the concurrent when mass collecting then...