Jump to content

Recommended Posts

Posted

Hi everyone,

      I wondered why my mob doesn't drop anything, so I used the loot tables for the sheep and it works, I returned to the webpage where I learned to make loot tables it turns out it was posted 5 years ago, HAHA Idiot me, so I was looking for a tutorial on making custom loot tables thanks a bunch.

Posted
  1. Make sure that your loottable is a valid json and has proper syntax (name property defined)
  2. Place it somewhere within assets/modid/loot_tables/
  3. Get a ResourceLocation pointing to it in your core. It should point to your loottable file, but it should not include the path up to loot_tables folder and the extension. 
  4. Obtain a registry ResourceLocation using LootTableList::register
  5. Double check that your ResourceLocation is correct, your json is correct, etc.

That ResourceLocation you obtain in step 4 is what you need.

Refer to this topic for more details and examples:

It is a very recent one too, so all the information there is up to date.

 

Another related topic I've found:

loottable file, location and syntax example.

And registration example.

 

Posted
2 minutes ago, V0idWa1k3r said:

 

I've changed those files since posting in that other thread, you can see the latest versions (as of the writing of this post) here:

 

Loot table file

Loot table registration

 

For anyone reading this thread in the future, you can use the Tree/Branch/Tag dropdown on GitHub to see the latest versions of these files on each branch. The branches are currently named after the Minecraft version they're targeting.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
Just now, V0idWa1k3r said:
  1. Make sure that your loottable is a valid json and has proper syntax (name property defined)
  2. Place it somewhere within assets/modid/loot_tables/
  3. Get a ResourceLocation pointing to it in your core. It should point to your loottable file, but it should not include the path up to loot_tables folder and the extension. 
  4. Obtain a registry ResourceLocation using LootTableList::register
  5. Double check that your ResourceLocation is correct, your json is correct, etc.

That ResourceLocation you obtain in step 4 is what you need.

Refer to this topic for more details and examples:

It is a very recent one too, so all the information there is up to date.

 

Another related topic I've found:

loottable file, location and syntax example.

And registration example.

 

Do I have to extend my lootable list to minecraft's LootTableList?

Posted
3 hours ago, V0idWa1k3r said:

Make sure that your loottable is a valid json and has proper syntax (name property defined)

Your json has no name property defined for your pools. Forge requires that property to be defined for mod loottables.

Posted
Just now, V0idWa1k3r said:

Your json has no name property defined for your pools. Forge requires that property to be defined for mod loottables.

So you're telling me that minecraft van put anything without name property but modders need to?

Posted
Just now, V0idWa1k3r said:

Your json has no name property defined for your pools. Forge requires that property to be defined for mod loottables.

So you're telling me that minecraft van put anything without name property but modders need to?

 

Just now, V0idWa1k3r said:

Erm, yes

Am I forgetting something?

 

package com.TheRPGAdventurer;

import static com.TheRPGAdventurer.RealmOfTheDragonsLootTables.RegistrationHandler.create;
import com.TheRPGAdventurer.RealmOfTheDragons;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraft.world.storage.loot.LootTableList;

public class RealmOfTheDragonsLootTables {
    
    public static final ResourceLocation ENTITIES_DRAGON_AMETHYST = create("amethsyt");
    public static final ResourceLocation ENTITIES_DRAGON_GARNET = create("garnet");
    public static final ResourceLocation ENTITIES_DRAGON_JADE = create("jade");
    public static final ResourceLocation ENTITIES_DRAGON_RUBY = create("ruby");
    public static final ResourceLocation ENTITIES_DRAGON_SAPPHIRE = create("sapphire");

    /**
     * Register this mod's {@link LootTable}s.
     */
    public static void registerLootTables() {
        RegistrationHandler.LOOT_TABLES.forEach(LootTableList::register);
    }

    public static class RegistrationHandler {

        /**
         * Stores the IDs of this mod's {@link LootTable}s.
         */
        private static final Set<ResourceLocation> LOOT_TABLES = new HashSet<>();

        /**
         * Create a {@link LootTable} ID.
         *
         * @param id The ID of the LootTable without the testmod3: prefix
         * @return The ID of the LootTable
         */
        protected static ResourceLocation create(String id) {
            final ResourceLocation lootTable = new ResourceLocation(RealmOfTheDragons.MODID, id);
            RegistrationHandler.LOOT_TABLES.add(lootTable);
            return lootTable;
        }
    }
}    

Posted
7 minutes ago, TheRPGAdventurer said:

So you're telling me that minecraft van put anything without name property but modders need to?

Yes. Forge adds the naming requirement for mod loot tables and auto-generates names for vanilla loot tables.

 

7 minutes ago, TheRPGAdventurer said:

Am I forgetting something?

You need to specify a name for each pool in the loot table file. I explained the naming requirements here (in the thread that @V0idWa1k3r linked).

 

Please use code blocks (the <> icon in the editor) when posting code. Alternatively, use Gist/Pastebin.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
Just now, Choonster said:

Yes. Forge adds the naming requirement for mod loot tables and auto-generates names for vanilla loot tables.

 

You need to specify a name for each pool in the loot table file. I explained the naming requirements here (in the thread that @V0idWa1k3r linked).

 

Please use code blocks (the <> icon in the editor) when posting code. Alternatively, use Gist/Pastebin.

I did, I mean in the loot table class.

Posted
2 minutes ago, TheRPGAdventurer said:

I did, I mean in the loot table class.

 

I'm talking about the loot table JSON file, not the class that registers the loot tables.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
5 minutes ago, TheRPGAdventurer said:

So there's nothing wrong in the class I made?

 

The class looks correct, but make sure you call RealmOfTheDragonsLootTables.registerLootTables in preInit.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
4 minutes ago, TheRPGAdventurer said:

what second pool?

 

There are two loot pools in that file, one that includes an entry for the rotd:amethsyt_dragon_scales item and one that includes an entry for the rotd:entities loot table. Only the first has a name.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
Just now, Choonster said:

 

There are two loot pools in that file, one that includes an entry for the rotd:amethsyt_dragon_scales item and one that includes an entry for the rotd:entities loot table. Only the first has a name.

Wait, you don't need to register it just like minecraft's loottablelist and the location is in the JSON itself?

Posted
36 minutes ago, TheRPGAdventurer said:

Wait, you don't need to register it just like minecraft's loottablelist and the location is in the JSON itself?

 

You're registering the loot table correctly, but it's the contents of the JSON file that need to fixed.

 

Each loot pool in the loot table JSON file needs to have a "name" property with a unique value. Currently only the first of the two loot pools has a "name" property.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
Just now, Choonster said:

 

You're registering the loot table correctly, but it's the contents of the JSON file that need to fixed.

 

Each loot pool in the loot table JSON file needs to have a "name" property with a unique value. Currently only the first of the two loot pools has a "name" property.

 

Just now, Choonster said:

 

You're registering the loot table correctly, but it's the contents of the JSON file that need to fixed.

 

Each loot pool in the loot table JSON file needs to have a "name" property with a unique value. Currently only the first of the two loot pools has a "name" property.

I actually based on the sheep's the second pool never existed and what probably causing the bug.

Posted
Just now, Choonster said:

 

You're registering the loot table correctly, but it's the contents of the JSON file that need to fixed.

 

Each loot pool in the loot table JSON file needs to have a "name" property with a unique value. Currently only the first of the two loot pools has a "name" property.

I updated it but it still doesn't drop anything can you see what's wrong with it?https://pastebin.com/HAKGmKp3

Posted
8 minutes ago, TheRPGAdventurer said:

I updated it but it still doesn't drop anything can you see what's wrong with it?https://pastebin.com/HAKGmKp3

 

That looks correct. Are there any errors in the log?

 

Post your loot table registration class and your entity class.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • This is the last line before the crash: [ebwizardry]: Synchronising spell emitters for PixelTraveler But I have no idea what this means
    • What in particular? I barely used that mod this time around, and it's never been a problem in the past.
    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } my entire project:https://github.com/kevin051606/DERP-Mod/tree/Derp-1.0-1.20
    • All versions of Minecraft Forge suddenly black screen even without mods (tried reinstalling original Minecraft, Java, updating drivers doesn't work)
  • Topics

×
×
  • Create New...

Important Information

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