#LootJS and NBT problem

38 messages · Page 1 of 1 (latest)

idle sinew
#

I'm trying to prevent armors from dropping from Endermans. But this doesn't work because the armors have different durability. Is there a way to make the code detect all nbts/durabilities?

    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_helmet"));
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_chestplate"));
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_leggings"));
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_boots"));
});```
bold solarBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

sudden haven
#

On that item.of add .weakNBT() to the end of it (I think)

shadow cipher
#

also why is armour dropping from endermen in the first place?

#

if they are wearing it, it might not count directly as a drop

idle sinew
# sudden haven On that item.of add .weakNBT() to the end of it (I think)

    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_helmet").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_chestplate").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_leggings").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_boots").weakNBT());

    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:golden_helmet").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:golden_chestplate").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:golden_leggings").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:golden_boots").weakNBT());

    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:leather_helmet").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:leather_chestplate").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:leather_leggings").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:leather_boots").weakNBT());

});```
#

I guess .weakNBT() didn't work.

sudden haven
#

I'm pretty sure there's some method that works for that...

#

Maybe check if there's something LootJS adds that does that

drowsy galleonBOT
#

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)
})
shadow cipher
#

please add the js part for syntax highlighting

shadow cipher
#

because iirc mobs wearing armour is handled differently by the drops

sudden haven
#

Thats probably because they have Reliqery

#

Or however you spell it

#

It messes with loot tables a lot

shadow cipher
#

there's a good chance lootJS might not cut it

#

depending on how reliquary handles it

idle sinew
sudden haven
#

I don't think apoth would do that

idle sinew
#

LootJS.modifiers((event) => {

    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_helmet").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_chestplate").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_leggings").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:iron_boots").weakNBT());

    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:golden_helmet").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:golden_chestplate").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:golden_leggings").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:golden_boots").weakNBT());

    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:leather_helmet").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:leather_chestplate").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:leather_leggings").weakNBT());
    event.addEntityLootModifier("minecraft:enderman").removeLoot(Item.of("minecraft:leather_boots").weakNBT());

});```
shadow cipher
#

if that doesn't work its most likely a mod screwing with how the drops work

sudden haven
#

See if there's any methods on .removeLoot for NBT, it might just be ignoring the item.of

shadow cipher
#

i believe armour drops are handled seperately

sudden haven
#

You sure?

shadow cipher
#

not sure

sudden haven
#

I figure they'd be in the same table

idle sinew
shadow cipher
#

but there's a chance

#

I'm pretty sure its handled differently so it preserves NBT

idle sinew
#

LootJS.modifiers((event) => {
    event
        .addEntityLootModifier("minecraft:creeper")
        .addWeightedLoot(
            [3, 10],
            [Item.of("minecraft:gunpowder").withChance(50), Item.of("minecraft:nether_star").withChance(5)]
        );
});```
#

Is there a way to completely clear a particular mob's loot table? It might be easier to delete everything and then add ender pearl

sudden haven
#

Maybe with .removeAll

idle sinew
#

Is this how it should be used? Because it didn't work

sudden haven
#

I don't know what the method is called, I guessed

#

If there even is one