#Prevent Mobs dropping Armor & Weapons

3 messages · Page 1 of 1 (latest)

placid kindle
#
// Disable armor and tool drops from mobs
EntityEvents.spawned((event) => {
  const { entity } = event;
  if (!entity.alive) return;
  let nbt = entity.getNbt();
  nbt.ArmorDropChances = [NBT.f(0), NBT.f(0), NBT.f(0), NBT.f(0)];
  nbt.HandDropChances = [NBT.f(0), NBT.f(0)];
  entity.setNbt(nbt);
});

Updated for KubeJS 6+

Original Thread: https://discord.com/channels/303440391124942858/1070765020717269063

shell temple
#

happy_sikao ```js
EntityEvents.spawned((event) => {
const { entity } = event;
if (!entity.alive) return;

entity.mergeNbt({
ArmorDropChances: [NBT.f(0), NBT.f(0), NBT.f(0), NBT.f(0)],
HandDropChances: [NBT.f(0), NBT.f(0)],
})
});

EntityEvents.spawned((event) => {
  const { entity, entity: { nbt } } = event;
  if (!entity.alive) return;

  nbt.put('ArmorDropChances', NBT.listTag([NBT.f(0), NBT.f(0), NBT.f(0), NBT.f(0)]));
  nbt.put('HandDropChances', NBT.listTag([NBT.f(0), NBT.f(0)]));
  entity.mergeNbt(nbt);
});
```
summer gull
#

Would there be a way to make special exceptions or is this an “all or nothing” situation?