#LootJS
50 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
You can write your code in a codeblock by typing it between the codeblock delimiters:
Note that these are backticks, not apostrophes
```js :arrow_left:
ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
``` :arrow_left:
This example will look like this:
ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
["reliquary:inject/chests/desert_pyramid",
"apotheosis:chests/chest_valuable",
"betterfortresses:chests/quarters",
"minecraft:chests/desert_pyramid",
"artifacts:inject/chests/spawn_bonus_chest",
"artifacts:inject/chests/woodland_mansion",
"quark:blocks/lootr_bamboo_chest",
"minecraft:chests/jungle_temple_dispenser",
"irons_spellbooks:chests/citadel/wall_loot",
"twilightforest:chests/troll_garden",
"bloodmagic:chests/standard_dungeon/strong_alchemy",
"irons_spellbooks:chests/filler_storage_loot",
"quark:blocks/prismarine_trapped_chest",
"irons_spellbooks:chests/priest_house",
].forEach((loot_p) => {
let flint_armor = LootEntry.tag("#kubejs:armor/flint").randomChance(0.5).setQuality(1).enchantWithLevels([3, 10]);;
let osmium_armor = LootEntry.tag("#kubejs:armor/osmium").randomChance(0.3).setQuality(1).enchantWithLevels([20, 30]);
event.addLootTableModifier(loot_p).addEntry(flint_armor);
event.addLootTableModifier(loot_p).addEntry(osmium_armor);
event.addLootTableModifier(loot_p).removeLoot(ItemFilter.tag("#forge:armor/diamond"));
event.addLootTableModifier(loot_p).removeLoot(ItemFilter.tag("#forge:armor/iron"));
});
is that your entire code thing
you need LootJS.modifiers((event) => {
i think
i cant really tell what ur tying to do rn couldyou explain more in depth
i have it as a wrapper this is inside of it
what im trying to do is remove all diamond/iron armor from these loot tables, and add the tags with flint and osmium armor
you are replacing the tags from diamond and iron armor to flint and osmium?
yes
it looks like there is nothing for that you'd have to manually add them
you can remove them all from diamond/iron armor with event.removeAllTagsFrom
each armor piece has to be added?
can you show me example code?
event.removeAllTagsFrom(minecraft:iron_chestplate)
wait what
what do you want to remove from the loot table
you cant remove tags from a loot table?
diamond armor and iron armor
and then put in osmium armor and flint armor
LootJS.modifiers((event) => {
event.removeLoot("minecraft:flint");
});
try that
wait you wanted replacement?
replacement yes but i want to specify it
also shouldn't i be modifying the loot table that i want?
or does event.removeLoot remove from everything?
LootJS.modifiers((event) => {
event.replaceLoot("minecraft:flint","minecraft:diamond");
});
idk if it needs an itemfilter tho
hmm, I'm trying to add an item in with enchantments
LootEntry.tag("#kubejs:armor/flint").randomChance(0.5).setQuality(1).enchantWithLevels([3, 10]); i was looking at making an entry
wuh
this is all very confusing for me sorry lol
its all good,
what im trying to do is
i have a list of loot tables
i want to remove diamond/iron armor from them
then make an entry for the loot table with enchantments specified above, and then put them into the loot table
event.removeLoot diamond and iron armor
idk the enchant thing tho
sounds good
i got it to work
read the changelogs for 1.20.1
addloottable modifer has an attribute that allows u to directly add an entry
i achieved my solution with the following:
event.addLootTableModifier(loot_table).replaceLoot(Item.of('minecraft:iron_helmet').ignoreNBT(), LootEntry.of('pickletweaks:flint_helmet').enchantWithLevels([3,10]), true);