Jump to content

Recommended Posts

Posted

I'm rewriting configs with the new annotation system. The problem is that I can't use Lists since I get a net.minecraftforge.fml.common.LoaderException: java.lang.RuntimeException: Can't handle field 'restrictedDrops' of class 'net.insane96mcp.iguanatweaks.lib.Properties.ConfigOptions.Drops': Unknown type. I'm forced to use Arrays or there's anyway to use lists?

Posted (edited)

Can you post some code for it?

 

If not, what is the data type for restrictedDrops?  Is it a list, an array?

 

(Also if no code posting) If restrictedDrops is any type of data structure (I'm assuming it's a list based on what you said), what type is each element in theory, and in actuality (eg. in many cases you'll have data structures filled with "Object"s which are actually all the same Object subtype)?

 

Edit 1 =============================================

I've just started delving into forge's config annotations myself (I started forge modding a few days ago, so sorry about my ignorance).  I doubt they have any built-in support for lists, but if you're already getting an array to pass from your config text file to your config java file, you may find this conversion example helpful:

Integer[] ints = new Integer[] {1, 2, 3};
List<Integer> list = Arrays.asList(ints);

 

Just keep in mind that this is a non-expandable list.  Also note I had to use "Integer" (the class type) instead of "int" (the primitive type) to get this to work.  Not sure if this will help you at all or not.

Edited by Laike_Endaril
Posted (edited)

This is the properties file: https://github.com/Insane-96/IguanaTweaksReborn/blob/master/common/net/insane96mcp/iguanatweaks/lib/Properties.java
This is where I use the property: https://github.com/Insane-96/IguanaTweaksReborn/blob/master/common/net/insane96mcp/iguanatweaks/modules/ModuleDrops.java#L32
I've now changed it to Arrays.asList(Properties.config.drops.restrictedDrops).contains(itemName) 

The point was to prevent casting and things, since I needed lists and not arrays (I didn't need index), but since seems not possible (unless I "cast" the array to list) I'll change the loops to work for arrays and use the asList().contains (even if I'm not sure that's a good practice).

 

Edit: Seems like I can use foreach for arrays in Java, then it's not a big deal

Edited by Insane96MCP

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

    • seguridad seguridad
    • I am creating a server with mods but when i try tostart it it say in the logs:   [29Jan2025 20:36:50.715] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/libraries/net/minecraftforge/fmlcore/1.20.1-47.3.27/fmlcore-1.20.1-47.3.27.jar is missing mods.toml file 159[29Jan2025 20:36:50.717] [main/DEBUG] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Considering mod file candidate /server/libraries/net/minecraftforge/javafmllanguage/1.20.1-47.3.27/javafmllanguage-1.20.1-47.3.27.jar 160[29Jan2025 20:36:50.717] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/libraries/net/minecraftforge/javafmllanguage/1.20.1-47.3.27/javafmllanguage-1.20.1-47.3.27.jar is missing mods.toml file 161[29Jan2025 20:36:50.718] [main/DEBUG] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Considering mod file candidate /server/libraries/net/minecraftforge/lowcodelanguage/1.20.1-47.3.27/lowcodelanguage-1.20.1-47.3.27.jar 162[29Jan2025 20:36:50.718] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/libraries/net/minecraftforge/lowcodelanguage/1.20.1-47.3.27/lowcodelanguage-1.20.1-47.3.27.jar is missing mods.toml file 163[29Jan2025 20:36:50.719] [main/DEBUG] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Considering mod file candidate /server/libraries/net/minecraftforge/mclanguage/1.20.1-47.3.27/mclanguage-1.20.1-47.3.27.jar 164[29Jan2025 20:36:50.719] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/libraries/net/minecraftforge/mclanguage/1.20.1-47.3.27/mclanguage-1.20.1-47.3.27.jar is missing mods.toml file
    • How do you configure the entity reach of a custom weapon? Asking for 1.21 Minecraft parchment
    • This topic is over a year old. If you are having an issue, please read the FAQ for the proper way to post logs, and create your own thread.
    • hello i have been trying to put this specific pack for a while now but ive been hit with a new error everytime. no matter if its a previous version or if i change the pack format it will just not work please help latest log:https://mclo.gs/b6Qra5d <----- this is with pack version 1.20 no changes done to it debug log: https://mclo.gs/jczkfRK
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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