Skip to content

Commit 8d8c57b

Browse files
authored
Add 1.21.5 (#30)
- Add automatic -SNAPSHOT to filename when building - Fix allowed mc version to represent the actual version range
2 parents 1abf076 + 92c4e6f commit 8d8c57b

File tree

8 files changed

+82
-18
lines changed

8 files changed

+82
-18
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup workspace
2121
run: gradle preprocessBase
2222
- name: Build
23-
run: gradle collectBuilds
23+
run: gradle collectBuilds -Prelease=true
2424
- name: Upload assets
2525
uses: softprops/action-gh-release@v2
2626
with:
@@ -55,3 +55,9 @@ jobs:
5555
files: 'build/*-1.21.4-*!(*-@(dev|sources|javadoc|all)).jar'
5656
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
5757
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
58+
- name: Publish 1.21.5
59+
uses: Kir-Antipov/[email protected]
60+
with:
61+
files: 'build/*-1.21.5-*!(*-@(dev|sources|javadoc|all)).jar'
62+
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
63+
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

1.21.4/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
org.gradle.jvmargs=-Xmx3G
22

33
minecraft_version=1.21.4
4-
allowed_mc_version=>=1.21.2 <=1.21.4
4+
allowed_mc_version=>1.21.3 <=1.21.4
55
fabric_version=0.110.5+1.21.4

1.21.5/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
plugins {
2+
id 'fabric-loom' version "${loom_version}"
3+
}
4+
5+
apply from: "../common.gradle"

1.21.5/gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
org.gradle.jvmargs=-Xmx3G
2+
3+
minecraft_version=1.21.5
4+
allowed_mc_version=>1.21.4 <=1.21.5
5+
fabric_version=0.118.6+1.21.5

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44

55
discombobulator {
66
versions = [
7+
"1.21.5":"",
78
"1.21.4":"",
89
"1.21.3":"",
910
"1.21.1":"",

common.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
java {
22
sourceCompatibility = targetCompatibility = 21
3-
withSourcesJar()
3+
//withSourcesJar()
44
}
55

6-
version = project.mod_version
6+
def snapshot = project.release=="true" ? "" : "-SNAPSHOT"
7+
version = project.mod_version + snapshot
78
group = project.maven_group
89

910
base {

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ discombobulator_version=1.3
1010
# mod
1111
mod_name=LoTAS-Light
1212
mod_version=1.2.0
13-
maven_group=com.mincecrafttas
13+
maven_group=com.minecrafttas
14+
release=false

src/main/java/com/minecrafttas/lotas_light/command/SavestateCommand.java

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,10 @@ private static int deleteMore(CommandContext<CommandSourceStack> context) {
326326
.withStyle(
327327
style -> style
328328
.withClickEvent(
329-
new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/savestate delete %s %s force", index, indexTo))
329+
createClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/savestate delete %s %s force", index, indexTo))
330330
)
331-
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.deleteMore.hover").withStyle(ChatFormatting.DARK_RED)))
331+
.withHoverEvent(
332+
createHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.deleteMore.hover").withStyle(ChatFormatting.DARK_RED)))
332333
)).withStyle(ChatFormatting.GREEN);
333334

334335

@@ -471,7 +472,9 @@ private static void showInfo(CommandContext<CommandSourceStack> context, Integer
471472

472473
//@formatter:off
473474
UnaryOperator<Style> hover = t ->
474-
t.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(date).withStyle(dateColor)));
475+
t.withHoverEvent(
476+
createHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(date).withStyle(dateColor))
477+
);
475478

476479
Component msg = null;
477480

@@ -483,8 +486,8 @@ private static void showInfo(CommandContext<CommandSourceStack> context, Integer
483486
Component.translatable("msg.lotaslight.savestate.info.error", failedSavestate.getError().getMessage())
484487
.withStyle(ChatFormatting.RED))
485488
.withStyle(t ->
486-
t.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
487-
Component.literal(date).withStyle(ChatFormatting.GOLD)
489+
t.withHoverEvent(
490+
createHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(date).withStyle(ChatFormatting.GOLD)
488491
)));
489492
} else {
490493
if(!LoTASLightClient.config.getBoolean(ConfigOptions.SAVESTATE_SHOW_CONTROLS)) {
@@ -497,34 +500,36 @@ private static void showInfo(CommandContext<CommandSourceStack> context, Integer
497500
else {
498501
Component saveComponent = Component.translatable("msg.lotaslight.savestate.save.clickable").withStyle(saveColor)
499502
.withStyle(t->
500-
t.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/savestate save %s", index)))
503+
t.withClickEvent(
504+
createClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/savestate save %s", index)))
501505
)
502506
.withStyle(t->
503-
t.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.save.hover", name).withStyle(saveColor)))
507+
t.withHoverEvent(
508+
createHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.save.hover", name).withStyle(saveColor)))
504509
);
505510

506511
Component deleteComponent = Component.translatable("msg.lotaslight.savestate.delete.clickable").withStyle(deleteColor)
507512
.withStyle(t->
508-
t.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/savestate delete %s", index)))
513+
t.withClickEvent(createClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/savestate delete %s", index)))
509514
)
510515
.withStyle(t->
511-
t.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.delete.hover", name).withStyle(deleteColor)))
516+
t.withHoverEvent(createHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.delete.hover", name).withStyle(deleteColor)))
512517
);
513518

514519
Component renameComponent = Component.translatable("msg.lotaslight.savestate.rename.clickable").withStyle(renameColor)
515520
.withStyle(t->
516-
t.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/savestate rename %s ", index)))
521+
t.withClickEvent(createClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/savestate rename %s ", index)))
517522
)
518523
.withStyle(t->
519-
t.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.rename.hover", name).withStyle(renameColor)))
524+
t.withHoverEvent(createHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.rename.hover", name).withStyle(renameColor)))
520525
);
521526

522527
Component loadComponent = Component.translatable("msg.lotaslight.savestate.load.clickable").withStyle(loadColor)
523528
.withStyle(t->
524-
t.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/savestate load %s", index)))
529+
t.withClickEvent(createClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/savestate load %s", index)))
525530
)
526531
.withStyle(t->
527-
t.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.load.hover", name).withStyle(loadColor)))
532+
t.withHoverEvent(createHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("msg.lotaslight.savestate.load.hover", name).withStyle(loadColor)))
528533
);
529534

530535
msg = Component.translatable("%s: %s %s %s %s %s",
@@ -542,6 +547,46 @@ private static void showInfo(CommandContext<CommandSourceStack> context, Integer
542547
context.getSource().sendSystemMessage(msg);
543548
}
544549
}
550+
551+
private static ClickEvent createClickEvent(ClickEvent.Action action, String command) {
552+
//# 1.21.5
553+
//$$ return switch (action) {
554+
//$$ case COPY_TO_CLIPBOARD: {
555+
//$$ yield new ClickEvent.CopyToClipboard(command);
556+
//$$ }
557+
//$$ case RUN_COMMAND: {
558+
//$$ yield new ClickEvent.RunCommand(command);
559+
//$$ }
560+
//$$ case SUGGEST_COMMAND: {
561+
//$$ yield new ClickEvent.SuggestCommand(command);
562+
//$$ }
563+
//$$ default:
564+
//$$ throw new IllegalArgumentException("Unexpected value: " + action);
565+
//$$ };
566+
//# def
567+
return new ClickEvent(action, command);
568+
//# end
569+
}
570+
571+
private static HoverEvent createHoverEvent(
572+
//# 1.21.5
573+
//$$ HoverEvent.Action action,
574+
//# def
575+
HoverEvent.Action<Component> action,
576+
//# end
577+
Component component) {
578+
//# 1.21.5
579+
//$$ return switch (action) {
580+
//$$ case SHOW_TEXT: {
581+
//$$ yield new HoverEvent.ShowText(component);
582+
//$$ }
583+
//$$ default:
584+
//$$ throw new IllegalArgumentException("Unexpected value: " + action);
585+
//$$ };
586+
//# def
587+
return new HoverEvent(action, component);
588+
//# end
589+
}
545590

546591
private static Component wrap(Component component, ChatFormatting color) {
547592
return ComponentUtils.wrapInSquareBrackets(component).withStyle(color);

0 commit comments

Comments
 (0)