Jump to content

[1.14.4] Override vanilla loot tables


athy

Recommended Posts

I cannot figure out how to override vanilla loot tables, I've been at this for hours, and I can't find anything online. Just very outdated tutorials.
I added custom crops and seeds to my mod, now I need those seeds to drop from the in-world grass.

The loot tables for my custom blocks are in data.modId.loot_tables.blocks and they work just fine.

Now, when I try to override the grass to drop an item of my choosing, say, coal, I do this:

1) Make  grass.json

2) Fill it:

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "item": "minecraft:shears"
                  }
                }
              ],
              "name": "minecraft:grass"
            },
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:random_chance",
                  "chance": 0.125
                }
              ],
              "functions": [
                {
                  "function": "minecraft:apply_bonus",
                  "enchantment": "minecraft:fortune",
                  "formula": "minecraft:uniform_bonus_count",
                  "parameters": {
                    "bonusMultiplier": 2
                  }
                },
                {
                  "function": "minecraft:explosion_decay"
                }
              ],
              "name": "minecraft:coal"
            }
          ]
        }
      ]
    }
  ]
}

 3) Place it in my project in

data.minecraft.loot_tables.blocks

 

 

 

When I test it in game, grass still drops wheat seeds and not coal. Why?

Edited by athy
Link to comment
Share on other sites

Put your custom loot table in data.minecraft.loot_tables.blocks. Yes, you need to create the minecraft folder in your src/main/resources/data directory. It should get overridden proving the file is named the same as the vanilla loot table.

Edited by Xander402

A few bytes about me:

public class Xander402 extends Modder implements IForumMember {
    int javaExperience, moddingExperience;
    LearningWay preferredLearningWay;
    public Xander402() {
        this.javaExperience = BIG;
        this.moddingExperience = NOT_SO_BIG;
        this.preferredLearningWay = LearningWay.through("exampes");
      	super(/*displayName*/"Xander402", /*moddingSince*/"1.9", preferredLearningWay);
    }
    @Override
    public Goal getReasonOfJoining(Forum forum) { return new Goal(() -> { while (true) moddingExperience++; }); }
}

 

Link to comment
Share on other sites

5 hours ago, Xander402 said:

Put your custom loot table in data.minecraft.loot_tables.blocks. Yes, you need to create the minecraft folder in your src/main/resources/data directory. It should get overridden proving the file is named the same as the vanilla loot table.

I already have. It doesn't work. Read point 4 please

Link to comment
Share on other sites

10 hours ago, athy said:

I added custom crops and seeds to my mod, now I need those seeds to drop from the in-world grass.

How about just adding a new loot table with pools only with your mod seeds items instead of overriding the entire grass loot table? Overriding would block others potential opportunity to make their own seeds that drop from vanilla grass.

Edited by Xander402

A few bytes about me:

public class Xander402 extends Modder implements IForumMember {
    int javaExperience, moddingExperience;
    LearningWay preferredLearningWay;
    public Xander402() {
        this.javaExperience = BIG;
        this.moddingExperience = NOT_SO_BIG;
        this.preferredLearningWay = LearningWay.through("exampes");
      	super(/*displayName*/"Xander402", /*moddingSince*/"1.9", preferredLearningWay);
    }
    @Override
    public Goal getReasonOfJoining(Forum forum) { return new Goal(() -> { while (true) moddingExperience++; }); }
}

 

Link to comment
Share on other sites

12 hours ago, Xander402 said:

How about just adding a new loot table with pools only with your mod seeds items instead of overriding the entire grass loot table? Overriding would block others potential opportunity to make their own seeds that drop from vanilla grass.

How would I go about doing that?

 

Link to comment
Share on other sites

 

A few bytes about me:

public class Xander402 extends Modder implements IForumMember {
    int javaExperience, moddingExperience;
    LearningWay preferredLearningWay;
    public Xander402() {
        this.javaExperience = BIG;
        this.moddingExperience = NOT_SO_BIG;
        this.preferredLearningWay = LearningWay.through("exampes");
      	super(/*displayName*/"Xander402", /*moddingSince*/"1.9", preferredLearningWay);
    }
    @Override
    public Goal getReasonOfJoining(Forum forum) { return new Goal(() -> { while (true) moddingExperience++; }); }
}

 

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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