Skip to content

Commit

Permalink
remove preview features;
Browse files Browse the repository at this point in the history
update dependency
  • Loading branch information
LucunJi committed Jul 3, 2024
1 parent 203bf13 commit f8f42e9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
7 changes: 1 addition & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,10 @@ processResources {
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"

// Minecraft 1.18 upwards uses Java 17.
// Minecraft 1.18 upwards uses Java 17. 1.20.5 upwards uses Java 21
it.options.release = 21
}

// https://stackoverflow.com/questions/61849514/how-to-set-the-use-enable-preview-compile-and-run-flags-from-gradle
tasks.withType(JavaCompile).all {
options.compilerArgs += ['--enable-preview']
}

java {
withSourcesJar()
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.21
yarn_mappings=1.21+build.2
yarn_mappings=1.21+build.7
loader_version=0.15.11
# Mod Properties
maven_group=github.io.lucunji
# Dependencies
# Fabric api
fabric_version=0.100.3+1.21
fabric_version=0.100.4+1.21
# mod menu
mod_menu_version=11.0.0
mod_menu_version=11.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public <T, U extends ConfigOption<T>> Optional<ListWidget.ListEntry> getConfigEn
}

private static <T> ButtonWidget getResetButton(ConfigOption<T> option, ConfigValueUpdater<T> setter) {
var reset = new ConfigButton(RESET_BUTTON_WIDTH, WIDGET_HEIGHT, Text.translatable(RESET_LANGKEY), _ -> setter.setValue(option.getDefaultValue()));
var reset = new ConfigButton(RESET_BUTTON_WIDTH, WIDGET_HEIGHT, Text.translatable(RESET_LANGKEY), self -> setter.setValue(option.getDefaultValue()));
reset.active = !option.isValueDefault();
return reset;
}
Expand All @@ -80,7 +80,7 @@ private static ListWidget.ListEntry getDoubleSlider(RangedConfigOption<Double> o
WIDGET_WIDTH, WIDGET_HEIGHT,
(option.getValue() - option.getMin()) / (option.getMax() - option.getMin()),
val -> setter.setValue(MathHelper.lerp(val, option.getMin(), option.getMax())),
_ -> Text.of("%.2f".formatted(option.getValue())));
val -> Text.of("%.2f".formatted(option.getValue())));
var reset = getResetButton(option, setter);
setter.setUpdateHandler(val -> {
option.setValue(val);
Expand All @@ -97,7 +97,7 @@ private static ListWidget.ListEntry getIntegerSlider(RangedConfigOption<Integer>
WIDGET_WIDTH, WIDGET_HEIGHT,
(option.getValue() - option.getMin()) / steps,
val -> setter.setValue((int) Math.round(val * steps) + option.getMin()),
_ -> Text.of(Integer.toString(option.getValue())));
val -> Text.of(Integer.toString(option.getValue())));
var reset = getResetButton(option, setter);
setter.setUpdateHandler(val -> {
option.setValue(val);
Expand All @@ -112,7 +112,7 @@ private static ListWidget.ListEntry getOnOffButton(ConfigOption<Boolean> option)
var btn = new ConfigButton(
WIDGET_WIDTH, WIDGET_HEIGHT,
Text.translatable(option.getValue() ? ON_LANGKEY : OFF_LANGKEY),
_ -> setter.setValue(!option.getValue()));
self -> setter.setValue(!option.getValue()));
var reset = getResetButton(option, setter);
setter.setUpdateHandler(val -> {
option.setValue(val);
Expand All @@ -132,7 +132,7 @@ private static <T extends Enum<?>> ListWidget.ListEntry getEnumCycleButton(Confi
var btn = new ConfigButton(
WIDGET_WIDTH, WIDGET_HEIGHT,
translations[option.getValue().ordinal()],
_ -> setter.setValue(values[(option.getValue().ordinal() + 1) % values.length]));
self -> setter.setValue(values[(option.getValue().ordinal() + 1) % values.length]));
var reset = getResetButton(option, setter);
setter.setUpdateHandler(val -> {
option.setValue(val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ else if (option.getType().isEnum())
private Map<Identifier, Map<Identifier, ConfigOption<?>>> categorize(List<? extends ConfigOption<?>> options) {
var categories = new LinkedHashMap<Identifier, Map<Identifier, ConfigOption<?>>>();
for (ConfigOption<?> option : options)
categories.computeIfAbsent(option.getCategory(), _ -> new LinkedHashMap<>()).put(option.getId(), option);
categories.computeIfAbsent(option.getCategory(), k -> new LinkedHashMap<>()).put(option.getId(), option);
return categories;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "explayerenderer",
"version": "3.0.0-alpha.4",
"version": "3.0.0-alpha.5",

"name": "ExtraPlayerRenderer",
"description": "Render an extra player figure on your screen. Made for game streaming and recordings.",
Expand Down

0 comments on commit f8f42e9

Please sign in to comment.