-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add options to specify where the boat should be boosted
- Loading branch information
Showing
9 changed files
with
202 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
paths: | ||
- "README.md" | ||
branches: | ||
- main | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- simplify movement logic | ||
- add options to specify where the player wants to get boosted | ||
- use yacl 3.5 for config screen creation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,67 @@ | ||
package dev.nyon.bbm.config | ||
|
||
import dev.isxander.yacl3.api.ConfigCategory | ||
import dev.isxander.yacl3.api.Option | ||
import dev.isxander.yacl3.api.OptionDescription | ||
import dev.isxander.yacl3.api.YetAnotherConfigLib | ||
import dev.isxander.yacl3.api.controller.FloatFieldControllerBuilder | ||
import dev.isxander.yacl3.api.controller.TickBoxControllerBuilder | ||
import dev.isxander.yacl3.dsl.* | ||
import dev.nyon.konfig.config.saveConfig | ||
import net.minecraft.client.gui.screens.Screen | ||
import net.minecraft.network.chat.Component | ||
|
||
fun generateYaclScreen(parent: Screen?): Screen { | ||
val builder = YetAnotherConfigLib.createBuilder() | ||
|
||
builder.title(Component.translatable("menu.bbm.config.title")) | ||
builder.appendCategory() | ||
|
||
builder.save { saveConfig(config) } | ||
val yacl = builder.build() | ||
return yacl.generateScreen(parent) | ||
} | ||
|
||
private fun YetAnotherConfigLib.Builder.appendCategory() = category( | ||
ConfigCategory.createBuilder().name(Component.translatable("menu.bbm.config.category.title")).option( | ||
Option.createBuilder<Float>().name(Component.translatable("menu.bbm.config.category.ground_step_height.title")) | ||
.description(OptionDescription.of(Component.translatable("menu.bbm.config.category.ground_step_height.description"))) | ||
.binding(config.stepHeight, { config.stepHeight }, { config.stepHeight = it }) | ||
.controller(FloatFieldControllerBuilder::create).build() | ||
).option( | ||
Option.createBuilder<Float>().name(Component.translatable("menu.bbm.config.category.player_eject_ticks.title")) | ||
.description(OptionDescription.of(Component.translatable("menu.bbm.config.category.player_eject_ticks.description"))) | ||
.binding(config.playerEjectTicks, { config.playerEjectTicks }, { config.playerEjectTicks = it }) | ||
.controller(FloatFieldControllerBuilder::create).build() | ||
).option( | ||
Option.createBuilder<Boolean>().name(Component.translatable("menu.bbm.config.category.boost_underwater.title")) | ||
.description(OptionDescription.of(Component.translatable("menu.bbm.config.category.boost_underwater.description"))) | ||
.binding(config.boostUnderwater, { config.boostUnderwater }, { config.boostUnderwater = it }) | ||
.controller(TickBoxControllerBuilder::create).build() | ||
).option( | ||
Option.createBuilder<Boolean>().name(Component.translatable("menu.bbm.config.category.only_for_players.title")) | ||
.description(OptionDescription.of(Component.translatable("menu.bbm.config.category.only_for_players.description"))) | ||
.binding(config.onlyForPlayers, { config.onlyForPlayers }, { config.onlyForPlayers = it }) | ||
.controller(TickBoxControllerBuilder::create).build() | ||
).build() | ||
) | ||
|
||
fun generateYaclScreen(parent: Screen?): Screen = YetAnotherConfigLib("bbm") { | ||
val general by categories.registering { | ||
val stepHeight by rootOptions.registering { | ||
binding(1f, { config.stepHeight }, { config.stepHeight = it}) | ||
controller = numberField(0f) | ||
descriptionBuilder { | ||
addDefaultText(1) | ||
} | ||
} | ||
|
||
val playerEjectTicks by rootOptions.registering { | ||
binding(0.2f, { config.playerEjectTicks }, { config.playerEjectTicks = it}) | ||
controller = numberField(0f, 10000f) | ||
descriptionBuilder { | ||
addDefaultText(1) | ||
} | ||
} | ||
|
||
val boostUnderwater by rootOptions.registering { | ||
binding(true, { config.boostUnderwater }, { config.boostUnderwater = it }) | ||
controller = tickBox() | ||
descriptionBuilder { | ||
addDefaultText(1) | ||
} | ||
} | ||
|
||
val boostOnBlocks by rootOptions.registering { | ||
binding(true, { config.boostOnBlocks }, { config.boostOnBlocks = it }) | ||
controller = tickBox() | ||
descriptionBuilder { | ||
addDefaultText(1) | ||
} | ||
} | ||
|
||
val boostOnIce by rootOptions.registering { | ||
binding(true, { config.boostOnIce }, { config.boostOnIce = it }) | ||
controller = tickBox() | ||
descriptionBuilder { | ||
addDefaultText(1) | ||
} | ||
} | ||
|
||
val boostOnWater by rootOptions.registering { | ||
binding(true, { config.boostOnWater }, { config.boostOnWater = it }) | ||
controller = tickBox() | ||
descriptionBuilder { | ||
addDefaultText(1) | ||
} | ||
} | ||
|
||
val onlyForPlayers by rootOptions.registering { | ||
binding(true, { config.onlyForPlayers }, { config.onlyForPlayers = it }) | ||
controller = tickBox() | ||
descriptionBuilder { | ||
addDefaultText(1) | ||
} | ||
} | ||
} | ||
|
||
save { saveConfig(config) } | ||
}.generateScreen(parent) |
Oops, something went wrong.