LootTweaker

LootTweaker

17M Downloads

Item chance not working properly?

GreenLandisaLie opened this issue ยท 2 comments

commented

Using this script:

import loottweaker.LootTweaker;
import loottweaker.vanilla.loot.LootTable;
import loottweaker.vanilla.loot.LootPool;

val table = LootTweaker.getTable("minecraft:chests/simple_dungeon");
val mypool = table.addPool("mypool", 1, 1, 0, 0);
mypool.addItemEntry(<minecraft:diamond_block>, 5, 90, [], []);
mypool.addItemEntry(<minecraft:bookshelf>, 95, 0, [], []);

The chest should have a base 5% chance of giving a diamond block and 95% chance of giving a bookshelf - this seems to be working.
However - according to the documentation on how the item chance is calculated - when the player is under the Luck I effect, the chance should be 50% chance for each item. And yet (under that effect) I'm still finding bookshelves a lot more often than diamond blocks - so something isn't working right.

Am I doing something wrong or is this a bug?

Mod version: 0.3.1
MC version: 1.12.2

commented

How are you generating the loot to test results?
Different ways of generating loot provide different information to the loot generator.

Also you can dump the loot table to see if the values you gave made it from LootTweaker into the vanilla loot system correctly.

commented

RFTools dimensions adds a 'Lost Cities' dimension that spawns a ton of chests.
Using /ct loottables target I noticed that those chests are randomly selected vanilla chests such as simple_dungeon, village_blacksmith, etc... as well as the one added by the mod itself.
So my script is pretty much an extension of the sample above but for all the chests and I've been testing it by going around checking on them (on newly loaded chunks - just to be safe) with and without the Luck effect (from both vanilla potions and modded luck potions like the ones from thermalfoundation).

Checking a dumped table, the pool was added successfully:

{
  "name": "mypool",
  "entries": [
    {
      "entryName": "loottweaker#1",
      "weight": 5,
      "quality": 90,
      "type": "item",
      "name": "minecraft:diamond_block"
    },
    {
      "entryName": "loottweaker#2",
      "weight": 95,
      "quality": 0,
      "type": "item",
      "name": "minecraft:bookshelf"
    }
  ],
  "rolls": 1.0
},

Testing with just this mod and CraftTweaker enabled: seems to be working flawlessly.
Testing with RFTools inside a a Lost City dimension: The ratio is being calculated differently because even when I set the diamond block to have a ~90% chance of 'spawning' (with Luck I) - it still only 'spawns' about 66% of the time at best.

So the issue is within RFTools and not this mod. Sorry for your time - the mod is working just fine.