Skip to content

Commit

Permalink
Add mcdev annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Sep 24, 2023
1 parent 6304362 commit 0e9e691
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.gaming32.worldhost.gui.screen;

import com.demonwav.mcdev.annotations.Translatable;
import io.github.gaming32.worldhost.WorldHost;
import io.github.gaming32.worldhost.WorldHostComponents;
import io.github.gaming32.worldhost.WorldHostConfig;
Expand Down Expand Up @@ -183,7 +184,7 @@ private interface ConfigOption {
}

private record YesNoOption(
String name,
@Translatable(prefix = "world-host.config.") String name,
Function<WorldHostConfig, Boolean> get,
BiConsumer<WorldHostConfig, Boolean> set,
@Nullable Runnable onSet
Expand Down Expand Up @@ -218,7 +219,7 @@ public Button createButton(int x, int y, int width, int height) {
}

private record EnumOption<E extends Enum<E> & StringRepresentable>(
String name,
@Translatable(prefix = "world-host.config.") String name,
Function<WorldHostConfig, E> get,
BiConsumer<WorldHostConfig, E> set,
E... typeGetter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.gaming32.worldhost.versions;

import com.demonwav.mcdev.annotations.Translatable;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
Expand All @@ -22,15 +23,15 @@ public static MutableComponent literal(String text) {
//#endif
}

public static MutableComponent translatable(String key) {
public static MutableComponent translatable(@Translatable(foldMethod = true) String key) {
//#if MC >= 1.19.1
return Component.translatable(key);
//#else
//$$ return new TranslatableComponent(key);
//#endif
}

public static MutableComponent translatable(String key, Object... args) {
public static MutableComponent translatable(@Translatable(foldMethod = true) String key, Object... args) {
//#if MC >= 1.19.1
return Component.translatable(key, args);
//#else
Expand Down
2 changes: 2 additions & 0 deletions version.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ dependencies {
}
}
}

compileOnly("com.demonwav.mcdev:annotations:2.0.0")
}

java {
Expand Down

0 comments on commit 0e9e691

Please sign in to comment.