#get entity type as variable

8 messages · Page 1 of 1 (latest)

violet hamlet
#

im using lootjs
trying to make all mobs drop their spawn eggs an am wondering if i can use a variable that gets the entity type

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

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

cedar notch
#

Do you want a list of all entity type?

#

if so:

Utils.getRegistryIds("entity_type").forEach((entity) => {
  console.log(entity)
});  
violet hamlet
#

that could work but it may take more time im just wondering if it possible to detect the entity and tell a script to use its entity name as a variable

smoky cloud
#

maybe try this js LootJS.modifiers((event) => { Utils.getRegistryIds("entity_type").forEach((type) => { event .addEntityLootModifier(`${type}`) .addWeightedLoot( [3, 10], [Item.of(`${type}_spawn_egg`).withChance(5)] ); }); });

#

assuming the registry id is the resource location of the mob that is

violet hamlet
#

okay thanks i forgot to check back lol