cabaletta / baritone

google maps for block game
GNU Lesser General Public License v3.0
7.15k stars 1.43k forks source link

Unable to set a setting with type `BlockEntityType` #4468

Closed Redhawk18 closed 1 week ago

Redhawk18 commented 1 month ago

Some information

Operating system: Java version: Minecraft version: Baritone version: master 1.19 Other mods (if used):

Exception, error or logs

I added this setting

    /**
     * The block entity to scan the world for to collect items from.
     */
    public Setting<BlockEntityType> storageBox = new Setting<>(BlockEntityType.CHEST);

When I try to set it in game with for example #settings storageBox BlockEntityType.SHULKER_BOX I got an uncaught exception.

ZacSharp commented 1 month ago

If you want to use new types for setting values and be able to set them via commands / settings file you also have to implement a parser + serializer pair for that type in SettingsUtil. (Note: This is my last inbox check before disappearing for two weeks)

Redhawk18 commented 1 month ago

If you want to use new types for setting values and be able to set them via commands / settings file you also have to implement a parser + serializer pair for that type in SettingsUtil. (Note: This is my last inbox check before disappearing for two weeks)

Is there a style guide for what is expect? Because minecraft has all of these types as constants but we could for example change SHULKER_BOX to minecraft:shulker_box

ZacSharp commented 1 month ago

No, there is no style guide. For #4452 I went for the enum names mainly for ease of parsing, but generally I think using the textual id is preferable from a usage point of view.