@@ -11,47 +11,37 @@ import net.fabricmc.api.Environment
1111import net.frozenblock.configurableeverything.block.util.MutableBlockSoundGroupOverwrite
1212import net.frozenblock.configurableeverything.block.util.MutableSoundType
1313import net.frozenblock.configurableeverything.config.BlockConfig
14- import net.frozenblock.configurableeverything.util.id
1514import net.frozenblock.configurableeverything.util.text
1615import net.frozenblock.configurableeverything.util.tooltip
1716import net.frozenblock.configurableeverything.util.vanillaId
1817import net.frozenblock.lib.config.api.client.gui.EntryBuilder
18+ import net.frozenblock.lib.config.api.client.gui.SimpleEntryBuilder
19+ import net.frozenblock.lib.config.api.client.gui.configEntryList
1920import net.frozenblock.lib.config.api.client.gui.multiElementEntry
2021import net.frozenblock.lib.config.api.client.gui.typedEntryList
2122import net.minecraft.core.registries.BuiltInRegistries
2223import net.minecraft.resources.Identifier
2324import net.minecraft.sounds.SoundEvent
2425import net.minecraft.sounds.SoundEvents
25- /*
26- private val configInstance = BlockConfig
2726
2827private inline val mainToggleReq: Requirement
2928 get() = Requirement .isTrue(MainConfigGui .INSTANCE !! .block)
3029
3130object BlockConfigGui {
3231 fun setupEntries (category : ConfigCategory , entryBuilder : ConfigEntryBuilder ) {
33- val config = configInstance.instance()
34- val syncConfig = configInstance.configWithSync()
35- val defaultConfig = configInstance.defaultInstance()
36-
37- category.addEntry(soundGroupOverwrites(entryBuilder, config, syncConfig, defaultConfig))
32+ category.addEntry(soundGroupOverwrites(entryBuilder))
3833 }
3934}
4035
4136private fun soundGroupOverwrites (
4237 entryBuilder : ConfigEntryBuilder ,
43- config: BlockConfig,
44- syncConfig: BlockConfig,
45- defaultConfig: BlockConfig
4638): AbstractConfigListEntry <* > {
47- return typedEntryList (
39+ return configEntryList (
4840 entryBuilder,
4941 text(" sound_group_overwrites" ),
50- syncConfig::soundGroupOverwrites,
51- { defaultConfig.soundGroupOverwrites },
42+ BlockConfig .soundGroupOverwrites,
5243 false ,
5344 tooltip(" sound_group_overwrites" ),
54- { newValue -> config.soundGroupOverwrites = newValue},
5545 { element: MutableBlockSoundGroupOverwrite ? , _ ->
5646 val defaultOverwrite = MutableBlockSoundGroupOverwrite (
5747 vanillaId(" grass_block" ),
@@ -72,7 +62,7 @@ private fun soundGroupOverwrites(
7262 overwrite,
7363 true ,
7464
75- EntryBuilder (text("sound_group_overwrites.id"), overwrite.blockId.toString(),
65+ SimpleEntryBuilder (text(" sound_group_overwrites.id" ), overwrite.blockId.toString(),
7666 " " ,
7767 { newValue -> overwrite.blockId = Identifier .parse(newValue) },
7868 tooltip(" sound_group_overwrites.id" )
@@ -83,43 +73,43 @@ private fun soundGroupOverwrites(
8373 soundOverwrite,
8474 true ,
8575
86- EntryBuilder (text("sound_group_overwrites.volume"), soundOverwrite.volume,
76+ SimpleEntryBuilder (text(" sound_group_overwrites.volume" ), soundOverwrite.volume,
8777 1F ,
8878 { newValue -> soundOverwrite.volume = newValue },
8979 tooltip(" sound_group_overwrites.volume" )
9080 ).build(entryBuilder),
9181
92- EntryBuilder (text("sound_group_overwrites.pitch"), soundOverwrite.pitch,
82+ SimpleEntryBuilder (text(" sound_group_overwrites.pitch" ), soundOverwrite.pitch,
9383 1F ,
9484 { newValue -> soundOverwrite.pitch = newValue },
9585 tooltip(" sound_group_overwrites.pitch" )
9686 ).build(entryBuilder),
9787
98- EntryBuilder (text("sound_group_overwrites.break_sound"), soundId(soundOverwrite.breakSound),
88+ SimpleEntryBuilder (text(" sound_group_overwrites.break_sound" ), soundId(soundOverwrite.breakSound),
9989 " " ,
10090 { newValue -> sound(newValue)?.also { soundOverwrite.breakSound = it } },
10191 tooltip(" sound_group_overwrites.break_sound" )
10292 ).build(entryBuilder),
10393
104- EntryBuilder (text("sound_group_overwrites.step_sound"), soundId(soundOverwrite.stepSound),
94+ SimpleEntryBuilder (text(" sound_group_overwrites.step_sound" ), soundId(soundOverwrite.stepSound),
10595 " " ,
10696 { newValue -> sound(newValue)?.also { soundOverwrite.stepSound = it } },
10797 tooltip(" sound_group_overwrites.step_sound" )
10898 ).build(entryBuilder),
10999
110- EntryBuilder (text("sound_group_overwrites.place_sound"), soundId(soundOverwrite.placeSound),
100+ SimpleEntryBuilder (text(" sound_group_overwrites.place_sound" ), soundId(soundOverwrite.placeSound),
111101 " " ,
112102 { newValue -> sound(newValue)?.also { soundOverwrite.placeSound = it } },
113103 tooltip(" sound_group_overwrites.place_sound" )
114104 ).build(entryBuilder),
115105
116- EntryBuilder (text("sound_group_overwrites.hit_sound"), soundId(soundOverwrite.hitSound),
106+ SimpleEntryBuilder (text(" sound_group_overwrites.hit_sound" ), soundId(soundOverwrite.hitSound),
117107 " " ,
118108 { newValue -> sound(newValue)?.also { soundOverwrite.hitSound = it } },
119109 tooltip(" sound_group_overwrites.hit_sound" )
120110 ).build(entryBuilder),
121111
122- EntryBuilder (text("sound_group_overwrites.fall_sound"), soundId(soundOverwrite.fallSound),
112+ SimpleEntryBuilder (text(" sound_group_overwrites.fall_sound" ), soundId(soundOverwrite.fallSound),
123113 " " ,
124114 { newValue -> sound(newValue)?.also { soundOverwrite.fallSound = it } },
125115 tooltip(" sound_group_overwrites.fall_sound" )
@@ -140,4 +130,3 @@ private fun soundId(sound: SoundEvent?): String? {
140130private fun sound (id : String ): SoundEvent ? {
141131 return BuiltInRegistries .SOUND_EVENT .getValue(Identifier .parse(id))
142132}
143- */
0 commit comments