Posted June 19, 20232 yr To preface this, I can get the damage working on Vanilla Items, but not modded items My issue is that when i have the set_damage function on a modded item in a loot table, it simply doesn't apply Loot Table: Spoiler { "type": "minecraft:entity", "pools": [ { "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", "functions": [ { "add": false, "damage": { "type": "minecraft:uniform", "max": 0.85, "min": 0.15 }, "function": "minecraft:set_damage" } ], "name": "onionadventures:onion_iron_axe" } ], "rolls": 1.0 }, { "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", "functions": [ { "add": false, "count": { "type": "minecraft:uniform", "max": 4.0, "min": 1.0 }, "function": "minecraft:set_count" } ], "name": "onionadventures:solid_chakra" } ], "rolls": 1.0 } ] } Datagen: Spoiler package net.aliphaticus.onionadventures.datagen; import net.aliphaticus.onionadventures.common.entity.OAEntities; import net.aliphaticus.onionadventures.common.item.OAItems; import net.minecraft.data.loot.EntityLootSubProvider; import net.minecraft.world.entity.EntityType; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.item.Items; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.functions.LootItemFunctions; import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; import net.minecraft.world.level.storage.loot.functions.SetItemDamageFunction; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; import net.minecraftforge.registries.RegistryObject; import java.util.stream.Stream; public class OAEntityLootTables extends EntityLootSubProvider { protected OAEntityLootTables() { super(FeatureFlags.REGISTRY.allFlags()); } @Override public void generate() { // Onions // Red Onion add(OAEntities.RED_ONION.get(), LootTable.lootTable().withPool( LootPool.lootPool() .add(LootItem.lootTableItem(OAItems.ONION_IRON_AXE.get()) .apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.15F, 0.85F)))) ).withPool( LootPool.lootPool() .add(LootItem.lootTableItem(OAItems.SOLID_CHAKRA.get()) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0f, 4.0f)))) ) ); // Brown Onion add(OAEntities.BROWN_ONION.get(), LootTable.lootTable().withPool( LootPool.lootPool().add(LootItem.lootTableItem(OAItems.SOLID_CHAKRA.get())) ) ); } @Override protected Stream<EntityType<?>> getKnownEntityTypes() { return OAEntities.ENTITY_TYPES.getEntries().stream().map(RegistryObject::get); } } Heres a link to my git repo so you can view the OnionAxeIron classes Onion Adventures
June 19, 20232 yr Author Fixed, i had a event that ovverode the item tags on pickup, instead of copying the tags and adding to them
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.