Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.