baritone icon indicating copy to clipboard operation
baritone copied to clipboard

Unable to set a setting with type `BlockEntityType`

Open Redhawk18 opened this issue 1 year ago • 3 comments

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.

Redhawk18 avatar Aug 10 '24 16:08 Redhawk18

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)

ZacSharp avatar Aug 10 '24 22:08 ZacSharp

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

Redhawk18 avatar Aug 12 '24 04:08 Redhawk18

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.

ZacSharp avatar Aug 28 '24 12:08 ZacSharp