From 9a1a6b2029308f1943750f467df2de32c0e50731 Mon Sep 17 00:00:00 2001 From: Jeroen Bollen <contact@jeroenbollen.eu> Date: Tue, 23 Apr 2024 21:46:47 +0200 Subject: [PATCH] Update to 1.20.5 --- build.gradle | 2 +- gradle.properties | 8 ++++---- .../us/potatoboy/invview/ViewCommand.java | 20 +++++++++++-------- src/main/resources/fabric.mod.json | 4 ++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index d9172b8..fa86d04 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.4.+' + id 'fabric-loom' version '1.6.+' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index 7fa1f29..9671fe2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,16 +2,16 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop/ -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.3 -loader_version=0.15.2 +minecraft_version=1.20.5 +yarn_mappings=1.20.5+build.1 +loader_version=0.15.10 # Mod Properties mod_version=1.4.14 maven_group=us.potatoboy archives_base_name=InvView # Dependencies # check this on https://fabricmc.net/develop/ -fabric_version=0.91.2+1.20.4 +fabric_version=0.97.5+1.20.5 trinkets_version=3.8.0 apoli_version=2.10.3 sgui_version=1.3.0+1.20.2 diff --git a/src/main/java/us/potatoboy/invview/ViewCommand.java b/src/main/java/us/potatoboy/invview/ViewCommand.java index 855d7e2..cb28ff9 100644 --- a/src/main/java/us/potatoboy/invview/ViewCommand.java +++ b/src/main/java/us/potatoboy/invview/ViewCommand.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.Map; +import java.util.Optional; public class ViewCommand { private static final MinecraftServer minecraftServer = InvView.getMinecraftServer(); @@ -169,14 +170,17 @@ private static ServerPlayerEntity getRequestedPlayer(CommandContext<ServerComman if (requestedPlayer == null) { requestedPlayer = minecraftServer.getPlayerManager().createPlayer(requestedProfile, SyncedClientOptions.createDefault()); - NbtCompound compound = minecraftServer.getPlayerManager().loadPlayerData(requestedPlayer); - if (compound != null) { - ServerWorld world = minecraftServer.getWorld( - DimensionType.worldFromDimensionNbt(new Dynamic<>(NbtOps.INSTANCE, compound.get("Dimension"))) - .result().get()); - - if (world != null) { - ((EntityAccessor) requestedPlayer).callSetWorld(world); + Optional<NbtCompound> compoundOpt = minecraftServer.getPlayerManager().loadPlayerData(requestedPlayer); + if (compoundOpt.isPresent()) { + NbtCompound compound = compoundOpt.get(); + if (compound.contains("Dimension")) { + ServerWorld world = minecraftServer.getWorld( + DimensionType.worldFromDimensionNbt(new Dynamic<>(NbtOps.INSTANCE, compound.get("Dimension"))) + .result().get()); + + if (world != null) { + ((EntityAccessor) requestedPlayer).callSetWorld(world); + } } } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 707fc42..1cfd5e9 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,8 +32,8 @@ "invview.mixins.json" ], "depends": { - "fabricloader": ">=0.7.2", + "fabricloader": ">=0.15.10", "fabric": "*", - "minecraft": ">=1.20.4" + "minecraft": ">=1.20.5" } } \ No newline at end of file