Jump to content

Recommended Posts

Posted (edited)

I don't know if I'm doing something wrong, or if it was removed and I'm using outdated tutorials, but I just started with this whole Minecraft Forge programming stuff (although I have programmed before) and I went to use LootEntryTable here: (I know it's not complete)

@SubscribeEvent
public void lootLoad(LootTableLoadEvent evt) {
    String name = evt.getName().toString();

    if (name.contains("minecraft:entities")) {
        String entryName = name.split("/")[1];
        entryName = "soulstone" + entryName;
        LootEntry ent = new LootEntryTable();
        //                     ^^^^
    }
}

The first time I added it, I hadn't added the import to use LootEntryTable so when it showed red I went to add the import, it said Create Class 'LootEntryTable'.

LootTableList also doesn't work. The most annoying thing is that I couldn't find anything about it anywhere. I replaced all the files after redownloading the mdk and it still doesn't work.

And I use IntelliJ, I'm not sure if that matters.

 

Also, it's my first time posting here so if I forgot something just tell me what to add.

image.png.2d155d064dc818a87f3b96ce887eee33.png

 

Edited by Sparib
Added screenshot
Posted

When it says

Create a global_loot_modifiers.json file at /data/forge/loot_modifiers/

does that mean I have to get something more than the mdk or do I create that directory myself.

Posted

Its a data file, like all other data files, you want to override it, then you have to supply an override at the correct location.

That's the path, create it in your /src directory like any other resource.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Thanks Draco (or Draco18s, idk how you like to be called), I got it now.

Thanks for all your help, without you I would be absolutely lost. :)

(And coffee)

Posted
9 minutes ago, Sparib said:

Thanks Draco (or Draco18s, idk how you like to be called)

Either works.

Technically the s is possessive and the number is just a uniquifier.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

When adding the loot modifiers registry(?) (I just kept the name from https://dragoness-e.dreamwidth.org/136561.html) I had to add the GlobalLootModifierSerializer (I just copied it) I got as far as 

GlobalLootModifierSerializer<T extends IGlobalLootModifier>

and it said "cannot resolve symbol IGlobalLootModifier"

That makes me think that I'm missing something or I'm just bad at this :/

Posted (edited)
3 hours ago, Sparib said:

When adding the loot modifiers registry(?) (I just kept the name from https://dragoness-e.dreamwidth.org/136561.html) I had to add the GlobalLootModifierSerializer (I just copied it) I got as far as 


GlobalLootModifierSerializer<T extends IGlobalLootModifier>

and it said "cannot resolve symbol IGlobalLootModifier"

That makes me think that I'm missing something or I'm just bad at this :/

 

Sigh.

Quote

A class that extends `LootModifier`

 

There's even DOCS on this stuff.

/**
 * A base implementation of a Global Loot Modifier for modders to extend.
 * Takes care of ILootCondition matching and comes with a base serializer
 * implementation that takes care of Forge registry things.
 */
public abstract class LootModifier implements IGlobalLootModifier {

A base implementation of a Global Loot Modifier for modders to extend.

https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/main/java/net/minecraftforge/common/loot/LootModifier.java#L32-L37

/**
 * Abstract base deserializer for LootModifiers. Takes care of Forge registry things.<br/>
 * Modders should extend this class to return their modifier and implement the abstract
 * <code>read</code> method to deserialize from json.
 * @param <T> the Type to deserialize
 */
public abstract class GlobalLootModifierSerializer<T extends IGlobalLootModifier> implements IForgeRegistryEntry<GlobalLootModifierSerializer<?>> {

Modders should extend this class to return their modifier and implement the abstract read method

https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java#L29-L35

 

Oh, and three existing implementations:

https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)

So I switched to Eclipse and I made a class with an inner class that extends LootModifier and it still showed an error, and inside the forge snapshot with all the net.minecraftforge stuff I didn't have a net.minecraftforge.common.loot at all, which is used https://github.com/Sinhika/SimpleOres2/blob/1.15/src/main/java/mod/alexndr/simpleores/helpers/SimpleOresLootModifiers.java#L18

Attached it a screenshot showing the minecraftforge.common packages(?) and the LootModifierHandler with an inner class MobDropLootModifier that extends LootModifier. Both the import and LootHandler are errors.image.thumb.png.e9da4543176aed926379f8a1f6b56a3c.png

Edited by Sparib
Forgot to add screenshot
Posted (edited)

Would that be the Forge Mdk you're talking about?

If so I have the recommended version that is the latest (31.1.0)

 

 

Edited by Sparib
Posted

Okay, I was trying as best as possible to say the recommended version, but the latest of it because the two versions are latest and recommended so it's confusing talking about the latest recommended.

But I'll try that!

Posted (edited)

IT FINALLY WORKS

THANK YOU SO MUCH

It finally showed some hope, thank you so much. I shouldn't need any more help because of all the references you've all given me.

Again,

THANK YOU SO MUCH!

Edited by Sparib

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.