LootTweaker

LootTweaker

17M Downloads

.clear(); command dont work with all mods

Freebi85 opened this issue ยท 3 comments

commented

Hello =) I have noticed that certain loot cannot be removed by the clear() command. For example Loot from Quark and Ice&Fire Dragons. I built a wither skeleton farm for the test. My custom loot works perfectly. But in between are Dark wither ashes from quark and necrotic bones from ice&fire dragons. It's not something bad that interferes with the progress of the game or acute that needs to be fixed immediately. Just wanted to share it so it's known.

Version Info (Exact versions only):
LootTweaker: 0.08
CraftTweaker/Minetweaker: 4.1.13
Forge: .2798
Minecraft: 1.12.2

import loottweaker.vanilla.loot.LootTables;
import loottweaker.vanilla.loot.LootTable;
import loottweaker.vanilla.loot.LootPool;
import loottweaker.vanilla.loot.Conditions;
import loottweaker.vanilla.loot.Functions;
import crafttweaker.data.IData;

// Wither Skeleton Loottable ========================================================================================================================================================
val wither = LootTables.getTable("minecraft:entities/wither_skeleton");
wither.clear();

var preciouses = wither.addPool("preciouses", 0, 1, 0, 0);
preciouses.addItemEntryHelper(minecraft:coal,5, 0, [Functions.setCount(1, 1)], []);
preciouses.addItemEntryHelper(thermalfoundation:material:193, 4, 0, [Functions.setCount(1, 1)], []);
preciouses.addItemEntryHelper(thermalfoundation:material:192, 3, 0, [Functions.setCount(1, 1)], []);
preciouses.addItemEntryHelper(mysticalagriculture:coal, 2, 0, [Functions.setCount(1, 1)], []);
preciouses.addItemEntryHelper(minecraft:skull:1, 1, 0, [Functions.setCount(1, 1)], []);
preciouses.addItemEntryHelper(tconstruct:materials:17, 1, 0, [Functions.setCount(1, 1)], []);

var utils = wither.addPool("utils", 0, 1, 0, 0);
utils.addItemEntryHelper(minecraft:nether_wart, 3, 0, [Functions.setCount(1, 1)], []);
utils.addItemEntryHelper(techreborn:smalldust:3, 5, 0, [Functions.setCount(1, 1)], []);
utils.addItemEntryHelper(techreborn:smalldust:15, 5, 0, [Functions.setCount(1, 1)], []);
utils.addItemEntryHelper(techreborn:smalldust:4, 2, 0, [Functions.setCount(1, 1)], []);
utils.addItemEntryHelper(techreborn:smalldust:23, 4, 0, [Functions.setCount(1, 1)], []);

var scrap = wither.addPool("scrap", 0, 1, 0, 0);
scrap.addItemEntryHelper(minecraft:torch, 5, 0, [Functions.setCount(1, 1)], []);
scrap.addItemEntryHelper(extraplanets:chocolate_bar, 4, 0, [Functions.setCount(1, 1)], []);
scrap.addItemEntryHelper(minecraft:bone, 5, 0, [Functions.setCount(1, 1)], []);
scrap.addItemEntryHelper(minecraft:string, 5, 0, [Functions.setCount(1, 1)], []);

commented

Many thanks for the answer and the tip, that saves a lot of work^^ Grat mod btw! ;-)
Freebi

commented

This is because the loot isn't loot table loot. The issue is on the side of the other mods.

Additionally, doing this
scrap.addItemEntryHelper(minecraft:torch, 5, 0, [Functions.setCount(1, 1)], []);
is redundant. LootTweaker preserves the stack size, metadata/damage, & NBT of any IItemStack passed into one of its methods, as explained here. So you can just write
scrap.addItemEntry(minecraft:torch, 5);

Also please note the section of the template that requests a script that reproduces the issue with the minimal number of mods installed. Getting mods working in a development environment can be a major hassle, I can fix issues much faster with a minimal script.

commented

Oh, before I forget. It may not be possible for all mods to adapt their added drops to the loot table system. Most usecases should be adaptable, but not all. I'm happy to help authors with adapting their drop code to use loot tables.