[bug] scrapbox
Romz24 opened this issue · 9 comments
When I add new items to the scrapbox, some pretty weird logic happens. The first item I added starts to drop very often, although it has a low drop rate.
There is some weird logic in the original (maybe it's for balance) that hoes fall very often anyway. If I add new items with IC2Tweaker, they get into the array before IC2 itself does, and therefore the first item I add drops out very often (instead of a hoe).
private void addBuiltinDrops() {
if (IC2.suddenlyHoes) {
this.addDrop(Items.WOODEN_HOE, 9001.0F);
} else {
this.addDrop(Items.WOODEN_HOE, 5.01F);
}
this.addDrop(Blocks.DIRT, 5.0F);
this.addDrop(Items.STICK, 4.0F);
this.addDrop(Blocks.GRASS, 3.0F);
....
}
Perhaps you have IC2Tweaker adding elements to the end of the array, due to the fact that the script is triggered after loading the ic2 mod.
It seems to be the beginning of array for me as well. The array was empty when script was executed. That explains why things went to the beginning instead of the end. That is also why I said "I can confirm this".
Are there mods that remove things from the scrap box pool? Due to how IC2 draws item from the pool, chances that improper pool entry removal can lead to this. Just a theory; I haven't tested it yet.
Are there mods that remove things from the scrap box pool?
Unfortunately, there are no such mods, if you add support in future versions, it will be good.
This is my script
import mods.ic2.ScrapBox;
ScrapBox.addDrop(<cfm:item_bread_slice>, 0.8F); // Кусочек хлеба
ScrapBox.addDrop(<cfm:item_toast>, 0.7F); // Тост
// ...
In this case, instead of hoes, <cfm:item_bread_slice> drops in huge numbers
Edit:
And yes, it does not depend on items from other mods. If I put something else first, like <minecraft:arrow>. They will fall most often, and this creates a lot of problems with the balance.
Does https://forum.industrial-craft.net/thread/16455-ic2-tweaker-wrong-dropping-chance-from-scrapbox-custom-recipe/ describe the exactly same issue here?
describe the exactly same issue here?
It seems to be the same problem. Incorrect chance of dropping only the first element from the array (in the original it is a hoe). I suspect this is done on purpose.
The problem with IC2Tweaker is that it adds items to the beginning of the array, and therefore, instead of a hoe, another item drops out very often, exactly the one that we add first through your scripts.
I am unable to reproduce this issue. Here are results of 64 scrap boxes:
The pool has been modified to include bedrock, with same weight as of glowstone in the original pool:
adds items to the beginning of the array
I can confirm this, but in theory this should not affect the overall distribution. What is your IC2 version? I have 2.8.222-ex122 in my workspace.
You can look at the contents of the array, in what order do you have the elements in it? Perhaps you have IC2Tweaker adding elements to the end of the array, due to the fact that the script is triggered after loading the ic2 mod. My script is executed before the array is initialized, so all new items are at the beginning of the array, before the hoe.
Perhaps it will be useful for you, I'm testing everything in a local game. Perhaps the server will have a different behavior (not tested yet).
Mod version:
- industrialcraft-2-2.8.222-ex112.jar
- ic2-tweaker-0.2.0.jar
- CraftTweaker2-1.12-4.1.20.681.jar
Code:
import mods.ic2.ScrapBox;
ScrapBox.addDrop(<minecraft:bedrock>, 1.0F);
Have same issue too. "Fixed" by adding scrapbox as first result
ScrapBox.addDrop(<ic2:crafting:24>, 0.00000001F); // Dropping about 50% of times
[...] // other additions
This how it looked like when there was "Matter Ball" as first entry (you can see its about 5000, comparing to 320 next item)
javaw_im3P4mGHQN.mp4
https://www.curseforge.com/minecraft/mc-mods/ic2-tweaker/files/4136686
Please try this new version to see if the issue is fixed or not.
This version also introduces ScrapBox.removeDrop(IItemStack)
method which you can use to remove something from the scrap box drop pool.
ScrapBox.addDrop(<minecraft:bedrock>, 0.8F);
ScrapBox.removeDrop(<item:minecraft:wooden_shovel>);
ScrapBox.removeDrop(<item:minecraft:wooden_hoe>);