Skip to content

Commit 498156d

Browse files
Update to 1.19
Co-authored-by: RacoonDog <[email protected]>
1 parent 2a85aba commit 498156d

17 files changed

+795
-796
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[*]
22
charset = utf-8
3-
indent_style = space
3+
indent_style = tab
44
insert_final_newline = true
55
trim_trailing_whitespace = true
66
indent_size = 4

build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '0.10-SNAPSHOT'
2+
id 'fabric-loom' version '0.12-SNAPSHOT'
33
id 'maven-publish'
44
}
55

@@ -10,6 +10,7 @@ version = project.mod_version
1010
group = project.maven_group
1111

1212
repositories {
13+
mavenCentral()
1314
maven {
1415
name = "meteor-maven"
1516
url = "https://maven.meteordev.org/releases"
@@ -18,6 +19,7 @@ repositories {
1819
name = "meteor-maven-snapshots"
1920
url = "https://maven.meteordev.org/snapshots"
2021
}
22+
maven { url 'https://jitpack.io' }
2123
}
2224

2325
dependencies {
@@ -49,4 +51,4 @@ processResources {
4951
tasks.withType(JavaCompile).configureEach {
5052
it.options.encoding = "UTF-8"
5153
it.options.release = 17
52-
}
54+
}

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
org.gradle.jvmargs=-Xmx2G
22

33
# Fabric (https://fabricmc.net/versions.html)
4-
minecraft_version=1.18.2
5-
yarn_mappings=1.18.2+build.1
6-
loader_version=0.12.12
4+
minecraft_version=1.19.2
5+
yarn_mappings=1.19.2+build.8
6+
loader_version=0.14.9
77

88
# Mod Properties
9-
mod_version=1.0.2
9+
mod_version=1.1.0
1010
maven_group=com.github.simulatan
1111
archives_base_name=notifications-addon
1212

1313
# Dependency Versions
1414

1515
# Meteor (https://maven.meteordev.org/)
16-
meteor_version=SNAPSHOT
16+
meteor_version=0.5.1-SNAPSHOT

src/main/java/com/github/simulatan/meteornotificationsaddon/NotificationsAddon.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,30 @@
22

33
import com.github.simulatan.meteornotificationsaddon.commands.NotificationsCommand;
44
import com.github.simulatan.meteornotificationsaddon.hud.NotificationsHudElement;
5-
import meteordevelopment.meteorclient.MeteorClient;
5+
import com.mojang.logging.LogUtils;
66
import meteordevelopment.meteorclient.addons.MeteorAddon;
7-
import meteordevelopment.meteorclient.systems.Systems;
87
import meteordevelopment.meteorclient.systems.commands.Commands;
9-
import meteordevelopment.meteorclient.systems.hud.HUD;
10-
import org.apache.logging.log4j.LogManager;
11-
import org.apache.logging.log4j.Logger;
12-
13-
import java.lang.invoke.MethodHandles;
8+
import meteordevelopment.meteorclient.systems.hud.Hud;
9+
import meteordevelopment.meteorclient.systems.hud.HudGroup;
10+
import org.slf4j.Logger;
1411

1512
public class NotificationsAddon extends MeteorAddon {
1613

17-
public static final Logger LOG = LogManager.getLogger();
14+
public static final Logger LOG = LogUtils.getLogger();
15+
public static final HudGroup HUD_GROUP = new HudGroup("Notifications");
1816

1917
@Override
2018
public void onInitialize() {
2119
LOG.info("Initializing Meteor Notifications Addon by SIMULATAN");
2220

23-
// Required when using @EventHandler
24-
MeteorClient.EVENT_BUS.registerLambdaFactory("com.github.simulatan.meteornotificationsaddon", (lookupInMethod, clazz) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, clazz, MethodHandles.lookup()));
25-
26-
Commands.get().add(new NotificationsCommand());
21+
Commands.get().add(new NotificationsCommand());
2722

2823
// HUD
29-
HUD hud = Systems.get(HUD.class);
30-
hud.elements.add(new NotificationsHudElement(hud));
24+
Hud.get().register(NotificationsHudElement.INFO);
25+
}
26+
27+
@Override
28+
public String getPackage() {
29+
return this.getClass().getPackageName();
3130
}
32-
}
31+
}

src/main/java/com/github/simulatan/meteornotificationsaddon/commands/NotificationsCommand.java

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.github.simulatan.meteornotificationsaddon.notifications.Notification;
44
import com.github.simulatan.meteornotificationsaddon.notifications.NotificationsManager;
5+
import com.mojang.brigadier.LiteralMessage;
56
import com.mojang.brigadier.StringReader;
67
import com.mojang.brigadier.arguments.ArgumentType;
78
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
@@ -13,7 +14,6 @@
1314
import meteordevelopment.meteorclient.systems.commands.Command;
1415
import meteordevelopment.meteorclient.utils.player.ChatUtils;
1516
import net.minecraft.command.CommandSource;
16-
import net.minecraft.text.LiteralText;
1717

1818
import java.awt.*;
1919
import java.util.Arrays;
@@ -26,54 +26,54 @@
2626

2727
public class NotificationsCommand extends Command {
2828

29-
public NotificationsCommand() {
30-
super("notifications", "Sends a dummy notification");
31-
}
29+
public NotificationsCommand() {
30+
super("notifications", "Sends a dummy notification");
31+
}
3232

33-
@Override
34-
public void build(LiteralArgumentBuilder<CommandSource> builder) {
35-
builder.then(argument("mode", new NotificationsArgumentType()).executes(context -> {
36-
NotificationCommandType arg = context.getArgument("mode", NotificationCommandType.class);
37-
if (arg == NotificationCommandType.SEND) {
38-
NotificationsManager.add(new Notification("hey, this is a test!", "very cool indeed yes", new Color((int) (Math.random() * 0x1000000))));
39-
ChatUtils.info("Notifications", "Successfully triggered notification!");
40-
} else if (arg == NotificationCommandType.CLEAR) {
41-
NotificationsManager.clearNotifications();
42-
ChatUtils.warning("Notifications", "Successfully cleared notifications!");
43-
}
44-
return SINGLE_SUCCESS;
45-
}));
46-
}
33+
@Override
34+
public void build(LiteralArgumentBuilder<CommandSource> builder) {
35+
builder.then(argument("mode", new NotificationsArgumentType()).executes(context -> {
36+
NotificationCommandType arg = context.getArgument("mode", NotificationCommandType.class);
37+
if (arg == NotificationCommandType.SEND) {
38+
NotificationsManager.add(new Notification("hey, this is a test!", "very cool indeed yes", new Color((int) (Math.random() * 0x1000000))));
39+
ChatUtils.info("Notifications", "Successfully triggered notification!");
40+
} else if (arg == NotificationCommandType.CLEAR) {
41+
NotificationsManager.clearNotifications();
42+
ChatUtils.warning("Notifications", "Successfully cleared notifications!");
43+
}
44+
return SINGLE_SUCCESS;
45+
}));
46+
}
4747

48-
private enum NotificationCommandType {
49-
SEND,
50-
CLEAR;
48+
private enum NotificationCommandType {
49+
SEND,
50+
CLEAR
5151
}
5252

53-
private static class NotificationsArgumentType implements ArgumentType<NotificationCommandType> {
53+
private static class NotificationsArgumentType implements ArgumentType<NotificationCommandType> {
5454

55-
private static final DynamicCommandExceptionType NO_SUCH_MODULE = new DynamicCommandExceptionType(o -> new LiteralText("Type " + o + " doesn't exist."));
55+
private static final DynamicCommandExceptionType NO_SUCH_MODULE = new DynamicCommandExceptionType(o -> new LiteralMessage("Type " + o + " doesn't exist."));
5656

57-
@Override
58-
public NotificationCommandType parse(StringReader reader) throws CommandSyntaxException {
59-
String argument = reader.readString();
60-
try {
61-
return NotificationCommandType.valueOf(argument.toUpperCase());
62-
} catch (Exception ignored){
63-
throw NO_SUCH_MODULE.create(argument);
64-
}
65-
}
57+
@Override
58+
public NotificationCommandType parse(StringReader reader) throws CommandSyntaxException {
59+
String argument = reader.readString();
60+
try {
61+
return NotificationCommandType.valueOf(argument.toUpperCase());
62+
} catch (Exception ignored) {
63+
throw NO_SUCH_MODULE.create(argument);
64+
}
65+
}
6666

67-
@Override
68-
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
69-
return CommandSource.suggestMatching(Arrays.stream(NotificationCommandType.values()).map(NotificationCommandType::name), builder);
70-
}
67+
@Override
68+
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
69+
return CommandSource.suggestMatching(Arrays.stream(NotificationCommandType.values()).map(NotificationCommandType::name), builder);
70+
}
7171

72-
private static final List<String> EXAMPLES = Arrays.stream(NotificationCommandType.values()).map(Enum::name).collect(Collectors.toList());
72+
private static final List<String> EXAMPLES = Arrays.stream(NotificationCommandType.values()).map(Enum::name).collect(Collectors.toList());
7373

74-
@Override
75-
public Collection<String> getExamples() {
76-
return EXAMPLES;
77-
}
78-
}
79-
}
74+
@Override
75+
public Collection<String> getExamples() {
76+
return EXAMPLES;
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)