Skip to content

Commit 6f77c4d

Browse files
committed
Bump version to 1.21.1
1 parent a56d32c commit 6f77c4d

33 files changed

+171
-169
lines changed

build.gradle

+25-35
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@ plugins {
33
id 'maven-publish'
44
}
55

6-
sourceCompatibility = JavaVersion.VERSION_17
7-
targetCompatibility = JavaVersion.VERSION_17
8-
9-
group = project.maven_group
106
version = project.mod_version + "+" + project.minecraft_version
7+
group = project.maven_group
8+
9+
base {
10+
archivesName = project.archives_base_name
11+
}
1112

1213
repositories {
1314
// Add repositories to retrieve artifacts from in here.
1415
// You should only use this when depending on other mods because
1516
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
1617
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
1718
// for more information about repositories.
19+
maven {
20+
url "https://maven.nucleoid.xyz/"
21+
name "Nucleoid"
22+
}
1823
}
1924

2025
dependencies {
@@ -32,61 +37,46 @@ processResources {
3237
inputs.property "version", project.version
3338

3439
filesMatching("fabric.mod.json") {
35-
expand ("version": project.version)
40+
expand "version": inputs.properties.version
3641
}
3742
}
3843

3944
tasks.withType(JavaCompile).configureEach {
40-
// ensure that the encoding is set to UTF-8, no matter what the system default is
41-
// this fixes some edge cases with special characters not displaying correctly
42-
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
43-
// If Javadoc is generated, this must be specified in that task too.
44-
it.options.encoding = "UTF-8"
45-
46-
// Minecraft 1.18 upwards uses Java 17.
47-
def targetVersion = 17
48-
if (JavaVersion.current().isJava9Compatible()) {
49-
it.options.release = targetVersion
50-
}
45+
it.options.release = 21
5146
}
5247

5348
java {
5449
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
5550
// if it is present.
5651
// If you remove this line, sources will not be generated.
5752
withSourcesJar()
53+
54+
sourceCompatibility = JavaVersion.VERSION_21
55+
targetCompatibility = JavaVersion.VERSION_21
5856
}
5957

6058
jar {
59+
inputs.property "archivesName", project.base.archivesName
60+
6161
from("LICENSE") {
62-
rename { "${it}_${project.archivesBaseName}"}
62+
rename { "${it}_${inputs.properties.archivesName}"}
6363
}
6464
}
6565

6666
// configure the maven publication
6767
publishing {
6868
publications {
69-
mavenJava(MavenPublication) {
70-
// add all the jars that should be included when publishing to maven
71-
artifact(remapJar) {
72-
builtBy remapJar
73-
}
74-
artifact(sourcesJar) {
75-
builtBy remapSourcesJar
76-
}
69+
create("mavenJava", MavenPublication) {
70+
artifactId = project.archives_base_name
71+
from components.java
7772
}
7873
}
7974

8075
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
81-
allprojects {
82-
repositories {
83-
maven {
84-
url "https://maven.nucleoid.xyz/"
85-
name "Nucleoid"
86-
}
87-
}
88-
89-
afterEvaluate {
90-
}
76+
repositories {
77+
// Add repositories to publish to here.
78+
// Notice: This block does NOT have the same function as the block in the top level.
79+
// The repositories here will be used for publishing your artifact, not for
80+
// retrieving dependencies.
9181
}
9282
}

gradle.properties

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/use
6-
minecraft_version=1.20.4
7-
yarn_mappings=1.20.4+build.3
6+
minecraft_version=1.21.1
7+
yarn_mappings=1.21.1+build.3
88
loader_version=0.16.10
99

1010
# Mod Properties
@@ -13,5 +13,5 @@ org.gradle.jvmargs=-Xmx1G
1313
archives_base_name = svrutil
1414

1515
# Dependencies
16-
fabric_version=0.97.2+1.20.4
17-
placeholder_api_version = 2.4.0-pre.3+1.20.4
16+
fabric_version=0.115.2+1.21.1
17+
placeholder_api_version = 2.4.2+1.21

src/main/java/com/lx862/svrutil/Commands.java

+30-29
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,40 @@
55
import com.lx862.svrutil.commands.*;
66
import com.mojang.brigadier.CommandDispatcher;
77
import com.mojang.brigadier.context.CommandContext;
8+
import net.minecraft.command.CommandRegistryAccess;
89
import net.minecraft.server.command.ServerCommandSource;
910

1011
public class Commands {
1112

12-
public static void register(CommandDispatcher<net.minecraft.server.command.ServerCommandSource> dispatcher) {
13-
afk.register(dispatcher);
14-
barrierblock.register(dispatcher);
15-
clienttime.register(dispatcher);
16-
clientweather.register(dispatcher);
17-
cmdblock.register(dispatcher);
18-
fancyKick.register(dispatcher);
19-
feed.register(dispatcher);
20-
fly.register(dispatcher);
21-
gma.register(dispatcher);
22-
gmc.register(dispatcher);
23-
gms.register(dispatcher);
24-
gmsp.register(dispatcher);
25-
heal.register(dispatcher);
26-
playsoundarea.register(dispatcher);
27-
rootCommand.register(dispatcher);
28-
lightblock.register(dispatcher);
29-
opLevel.register(dispatcher);
30-
nether.register(dispatcher);
31-
overworld.register(dispatcher);
32-
r.register(dispatcher);
33-
selfkill.register(dispatcher);
34-
spawn.register(dispatcher);
35-
spd.register(dispatcher);
36-
spectate.register(dispatcher);
37-
silentTp.register(dispatcher);
38-
theend.register(dispatcher);
39-
unspectate.register(dispatcher);
40-
where.register(dispatcher);
13+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
14+
AfkCommand.register(dispatcher, registryAccess);
15+
BarrierBlockCommand.register(dispatcher, registryAccess);
16+
ClientTimeCommand.register(dispatcher, registryAccess);
17+
ClientWeatherCommand.register(dispatcher, registryAccess);
18+
CmdBlockCommand.register(dispatcher, registryAccess);
19+
FancyKickCommand.register(dispatcher, registryAccess);
20+
FeedCommand.register(dispatcher, registryAccess);
21+
FlyCommand.register(dispatcher, registryAccess);
22+
GmaCommand.register(dispatcher, registryAccess);
23+
GmcCommand.register(dispatcher, registryAccess);
24+
GmsCommand.register(dispatcher, registryAccess);
25+
GmspCommand.register(dispatcher, registryAccess);
26+
HealCommand.register(dispatcher, registryAccess);
27+
PlaySoundAreaCommand.register(dispatcher, registryAccess);
28+
RootCommand.register(dispatcher, registryAccess);
29+
LightBlockCommand.register(dispatcher, registryAccess);
30+
OpLevelCommand.register(dispatcher, registryAccess);
31+
NetherCommand.register(dispatcher, registryAccess);
32+
OverworldCommand.register(dispatcher, registryAccess);
33+
RCommand.register(dispatcher, registryAccess);
34+
SelfKillCommand.register(dispatcher, registryAccess);
35+
SpawnCommand.register(dispatcher, registryAccess);
36+
SpdCommand.register(dispatcher, registryAccess);
37+
SpectateCommand.register(dispatcher, registryAccess);
38+
SilentTpCommand.register(dispatcher, registryAccess);
39+
TheEndCommand.register(dispatcher, registryAccess);
40+
UnspectateCommand.register(dispatcher, registryAccess);
41+
WhereCommand.register(dispatcher, registryAccess);
4142
}
4243

4344
public static void finishedExecution(CommandContext<ServerCommandSource> context, CommandEntry defaultEntry) {

src/main/java/com/lx862/svrutil/SvrUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ public void onInitialize() {
2424
ServerPlayConnectionEvents.JOIN.register(Events::onJoin);
2525
ServerTickEvents.START_SERVER_TICK.register(Events::onServerTick);
2626
ServerTickEvents.END_SERVER_TICK.register(Events::onTickEnd);
27-
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated, third) -> Commands.register(dispatcher));
27+
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, third) -> Commands.register(dispatcher, registryAccess));
2828
}
2929
}

src/main/java/com/lx862/svrutil/commands/afk.java src/main/java/com/lx862/svrutil/commands/AfkCommand.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import com.mojang.brigadier.CommandDispatcher;
77
import com.mojang.brigadier.arguments.StringArgumentType;
88
import com.mojang.brigadier.context.CommandContext;
9+
import com.mojang.brigadier.exceptions.CommandSyntaxException;
10+
import net.minecraft.command.CommandRegistryAccess;
911
import net.minecraft.server.command.CommandManager;
1012
import net.minecraft.server.command.ServerCommandSource;
1113
import net.minecraft.server.network.ServerPlayerEntity;
@@ -16,13 +18,12 @@
1618
import java.util.HashMap;
1719
import java.util.UUID;
1820

19-
public class afk {
21+
public class AfkCommand {
2022
private static final CommandEntry defaultEntry = new CommandEntry("afk", 0, true);
2123
public static final HashMap<UUID, String> afkList = new HashMap<>();
2224

23-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
25+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
2426
final CommandEntry entry = CommandConfig.getCommandEntry(defaultEntry);
25-
2627
if(!entry.enabled) return;
2728

2829
dispatcher.register(CommandManager.literal(entry.commandName)
@@ -34,8 +35,8 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
3435
);
3536
}
3637

37-
private static int execute(CommandContext<ServerCommandSource> context, String reason) {
38-
ServerPlayerEntity player = context.getSource().getPlayer();
38+
private static int execute(CommandContext<ServerCommandSource> context, String reason) throws CommandSyntaxException {
39+
ServerPlayerEntity player = context.getSource().getPlayerOrThrow();
3940
if(player == null) return 1;
4041
Text playerName = player.getDisplayName();
4142

src/main/java/com/lx862/svrutil/commands/barrierblock.java src/main/java/com/lx862/svrutil/commands/BarrierBlockCommand.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
import com.lx862.svrutil.config.CommandConfig;
55
import com.lx862.svrutil.data.CommandEntry;
66
import com.mojang.brigadier.CommandDispatcher;
7+
import net.minecraft.command.CommandRegistryAccess;
78
import net.minecraft.item.ItemStack;
89
import net.minecraft.item.Items;
910
import net.minecraft.server.command.CommandManager;
1011
import net.minecraft.server.command.ServerCommandSource;
1112

12-
public class barrierblock {
13+
public class BarrierBlockCommand {
1314
private static final CommandEntry defaultEntry = new CommandEntry("barrierblock", 2, true);
1415

15-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
16+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
1617
final CommandEntry entry = CommandConfig.getCommandEntry(defaultEntry);
1718
if(!entry.enabled) return;
1819

src/main/java/com/lx862/svrutil/commands/clienttime.java src/main/java/com/lx862/svrutil/commands/ClientTimeCommand.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.mojang.brigadier.arguments.IntegerArgumentType;
99
import com.mojang.brigadier.context.CommandContext;
1010
import com.mojang.brigadier.exceptions.CommandSyntaxException;
11+
import net.minecraft.command.CommandRegistryAccess;
1112
import net.minecraft.command.argument.TimeArgumentType;
1213
import net.minecraft.server.command.CommandManager;
1314
import net.minecraft.server.command.ServerCommandSource;
@@ -17,10 +18,10 @@
1718

1819
import java.util.UUID;
1920

20-
public class clienttime {
21+
public class ClientTimeCommand {
2122
private static final CommandEntry defaultEntry = new CommandEntry("clienttime", 0, true);
2223

23-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
24+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
2425
final CommandEntry entry = CommandConfig.getCommandEntry(defaultEntry);
2526
if(!entry.enabled) return;
2627

src/main/java/com/lx862/svrutil/commands/clientweather.java src/main/java/com/lx862/svrutil/commands/ClientWeatherCommand.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.mojang.brigadier.CommandDispatcher;
77
import com.mojang.brigadier.context.CommandContext;
88
import com.mojang.brigadier.exceptions.CommandSyntaxException;
9+
import net.minecraft.command.CommandRegistryAccess;
910
import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket;
1011
import net.minecraft.server.command.CommandManager;
1112
import net.minecraft.server.command.ServerCommandSource;
@@ -15,10 +16,10 @@
1516
import net.minecraft.util.Formatting;
1617
import net.minecraft.world.World;
1718

18-
public class clientweather {
19+
public class ClientWeatherCommand {
1920
private static final CommandEntry defaultEntry = new CommandEntry("clientweather", 0, true);
2021

21-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
22+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
2223

2324
final CommandEntry entry = CommandConfig.getCommandEntry(defaultEntry);
2425
if(!entry.enabled) return;

src/main/java/com/lx862/svrutil/commands/cmdblock.java src/main/java/com/lx862/svrutil/commands/CmdBlockCommand.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
import com.lx862.svrutil.config.CommandConfig;
55
import com.lx862.svrutil.data.CommandEntry;
66
import com.mojang.brigadier.CommandDispatcher;
7+
import net.minecraft.command.CommandRegistryAccess;
78
import net.minecraft.item.ItemStack;
89
import net.minecraft.item.Items;
910
import net.minecraft.server.command.CommandManager;
1011
import net.minecraft.server.command.ServerCommandSource;
1112

12-
public class cmdblock {
13+
public class CmdBlockCommand {
1314
private static final CommandEntry defaultEntry = new CommandEntry("cmdblock", 2, true);
1415

15-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
16+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
1617

1718
final CommandEntry entry = CommandConfig.getCommandEntry(defaultEntry);
1819
if(!entry.enabled) return;

src/main/java/com/lx862/svrutil/commands/fancyKick.java src/main/java/com/lx862/svrutil/commands/FancyKickCommand.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.lx862.svrutil.config.CommandConfig;
55
import com.lx862.svrutil.data.CommandEntry;
66
import com.mojang.brigadier.CommandDispatcher;
7+
import net.minecraft.command.CommandRegistryAccess;
78
import net.minecraft.command.argument.EntityArgumentType;
89
import net.minecraft.command.argument.TextArgumentType;
910
import net.minecraft.server.command.CommandManager;
@@ -13,17 +14,17 @@
1314

1415
import java.util.Collection;
1516

16-
public class fancyKick {
17+
public class FancyKickCommand {
1718
private static final CommandEntry defaultEntry = new CommandEntry("fancykick", 4, true);
1819

19-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
20+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
2021
final CommandEntry entry = CommandConfig.getCommandEntry(defaultEntry);
2122
if(!entry.enabled) return;
2223

2324
dispatcher.register(CommandManager.literal(entry.commandName)
2425
.requires(ctx -> ctx.hasPermissionLevel(entry.permLevel))
2526
.then(CommandManager.argument("target", EntityArgumentType.players())
26-
.then(CommandManager.argument("reason", TextArgumentType.text())
27+
.then(CommandManager.argument("reason", TextArgumentType.text(registryAccess))
2728
.executes(context -> {
2829
Collection<ServerPlayerEntity> targets = EntityArgumentType.getPlayers(context, "target");
2930
Text text = TextArgumentType.getTextArgument(context, "reason");

src/main/java/com/lx862/svrutil/commands/feed.java src/main/java/com/lx862/svrutil/commands/FeedCommand.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
import com.lx862.svrutil.config.CommandConfig;
55
import com.lx862.svrutil.data.CommandEntry;
66
import com.mojang.brigadier.CommandDispatcher;
7+
import net.minecraft.command.CommandRegistryAccess;
78
import net.minecraft.command.argument.EntityArgumentType;
89
import net.minecraft.server.command.CommandManager;
910
import net.minecraft.server.command.ServerCommandSource;
1011
import net.minecraft.server.network.ServerPlayerEntity;
1112
import net.minecraft.text.Text;
1213
import net.minecraft.util.Formatting;
1314

14-
public class feed {
15+
public class FeedCommand {
1516
private static final CommandEntry defaultEntry = new CommandEntry("feed", 2, true);
1617

17-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
18+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
1819
final CommandEntry entry = CommandConfig.getCommandEntry(defaultEntry);
1920
if(!entry.enabled) return;
2021

src/main/java/com/lx862/svrutil/commands/fly.java src/main/java/com/lx862/svrutil/commands/FlyCommand.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
import com.lx862.svrutil.data.CommandEntry;
66
import com.mojang.brigadier.CommandDispatcher;
77
import com.mojang.brigadier.context.CommandContext;
8+
import net.minecraft.command.CommandRegistryAccess;
89
import net.minecraft.command.argument.EntityArgumentType;
910
import net.minecraft.server.command.CommandManager;
1011
import net.minecraft.server.command.ServerCommandSource;
1112
import net.minecraft.server.network.ServerPlayerEntity;
1213
import net.minecraft.text.Text;
1314
import net.minecraft.util.Formatting;
1415

15-
public class fly {
16+
public class FlyCommand {
1617
private static final CommandEntry defaultEntry = new CommandEntry("fly", 2, true);
1718

18-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
19+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
1920

2021
final CommandEntry entry = CommandConfig.getCommandEntry(defaultEntry);
2122
if(!entry.enabled) return;

0 commit comments

Comments
 (0)