aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-09-25 19:24:16 +0200
committernea <nea@nea.moe>2023-09-25 19:24:46 +0200
commit139089d9beb134465737c4afff3b1303bf481aa1 (patch)
treeca2582bee8d9988afe9ca4f6ed70b043d47aaf3a /src/main
parent2bd3ed1e238d75c4a185656ac6fd857ac6897a99 (diff)
downloadFirmament-139089d9beb134465737c4afff3b1303bf481aa1.tar.gz
Firmament-139089d9beb134465737c4afff3b1303bf481aa1.tar.bz2
Firmament-139089d9beb134465737c4afff3b1303bf481aa1.zip
Port to 1.20.2
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinClientCommonNetworkHandler.java25
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java7
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinPlayerInventory.java17
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinPlayerListEntry.java24
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinProperty.java33
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinYggdrasilServicesKeyInfo.java25
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java11
-rw-r--r--src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt4
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt9
-rw-r--r--src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt14
-rw-r--r--src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt3
-rw-r--r--src/main/resources/firmament.accesswidener1
12 files changed, 110 insertions, 63 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinClientCommonNetworkHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinClientCommonNetworkHandler.java
new file mode 100644
index 0000000..767d25c
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/MixinClientCommonNetworkHandler.java
@@ -0,0 +1,25 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins;
+
+import moe.nea.firmament.events.OutgoingPacketEvent;
+import net.minecraft.client.network.ClientCommonNetworkHandler;
+import net.minecraft.network.packet.Packet;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(ClientCommonNetworkHandler.class)
+public class MixinClientCommonNetworkHandler {
+ @Inject(method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true)
+ public void onSendPacket(Packet<?> packet, CallbackInfo ci) {
+ if (OutgoingPacketEvent.Companion.publish(new OutgoingPacketEvent(packet)).getCancelled()) {
+ ci.cancel();
+ }
+ }
+}
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java
index aa6ce38..dbf8c7f 100644
--- a/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java
+++ b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java
@@ -29,11 +29,4 @@ public class MixinClientPacketHandler {
packet.isLongDistance()
));
}
-
- @Inject(method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true)
- public void onSendPacket(Packet<?> packet, CallbackInfo ci) {
- if (OutgoingPacketEvent.Companion.publish(new OutgoingPacketEvent(packet)).getCancelled()) {
- ci.cancel();
- }
- }
}
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinPlayerInventory.java b/src/main/java/moe/nea/firmament/mixins/MixinPlayerInventory.java
deleted file mode 100644
index 2076923..0000000
--- a/src/main/java/moe/nea/firmament/mixins/MixinPlayerInventory.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- */
-
-package moe.nea.firmament.mixins;
-
-import net.minecraft.entity.player.PlayerInventory;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(PlayerInventory.class)
-public class MixinPlayerInventory {
-
-
-
-}
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinPlayerListEntry.java b/src/main/java/moe/nea/firmament/mixins/MixinPlayerListEntry.java
deleted file mode 100644
index 870aaad..0000000
--- a/src/main/java/moe/nea/firmament/mixins/MixinPlayerListEntry.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- */
-
-package moe.nea.firmament.mixins;
-
-import moe.nea.firmament.features.fixes.Fixes;
-import net.minecraft.client.network.PlayerListEntry;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.ModifyArg;
-
-@Mixin(PlayerListEntry.class)
-public class MixinPlayerListEntry {
- @ModifyArg(method = "loadTextures", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/PlayerSkinProvider;loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V"))
- public boolean shouldBeSecure(boolean originalSecure) {
- if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) {
- return false;
- }
- return originalSecure;
- }
-}
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinProperty.java b/src/main/java/moe/nea/firmament/mixins/MixinProperty.java
new file mode 100644
index 0000000..15ff6e4
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/MixinProperty.java
@@ -0,0 +1,33 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins;
+
+import com.mojang.authlib.properties.Property;
+import moe.nea.firmament.features.fixes.Fixes;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+import java.security.PublicKey;
+
+@Mixin(value = Property.class, remap = false)
+public class MixinProperty {
+ @Inject(method = "isSignatureValid", cancellable = true, at = @At("HEAD"), remap = false)
+ public void onValidateSignature(PublicKey publicKey, CallbackInfoReturnable<Boolean> cir) {
+ if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) {
+ cir.setReturnValue(true);
+ }
+ }
+
+ @Inject(method = "hasSignature", cancellable = true, at = @At("HEAD"), remap = false)
+ public void onHasSignature(CallbackInfoReturnable<Boolean> cir) {
+ if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) {
+ cir.setReturnValue(true);
+ }
+ }
+}
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinYggdrasilServicesKeyInfo.java b/src/main/java/moe/nea/firmament/mixins/MixinYggdrasilServicesKeyInfo.java
new file mode 100644
index 0000000..38c380b
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/MixinYggdrasilServicesKeyInfo.java
@@ -0,0 +1,25 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins;
+
+import com.mojang.authlib.properties.Property;
+import com.mojang.authlib.yggdrasil.YggdrasilServicesKeyInfo;
+import moe.nea.firmament.features.fixes.Fixes;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(value = YggdrasilServicesKeyInfo.class, remap = false)
+public class MixinYggdrasilServicesKeyInfo {
+ @Inject(method = "validateProperty", at = @At("HEAD"), cancellable = true, remap = false)
+ public void validate(Property property, CallbackInfoReturnable<Boolean> cir) {
+ if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) {
+ cir.setReturnValue(true);
+ }
+ }
+}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java
index 9fc2ab0..3d557fc 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java
@@ -7,21 +7,24 @@
package moe.nea.firmament.mixins.devenv;
import net.minecraft.client.network.ClientPlayNetworkHandler;
+import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Objects;
@Mixin(ClientPlayNetworkHandler.class)
public class DisableCommonPacketWarnings {
- @Redirect(method = "onCustomPayload", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
- public void onCustomPacket(Logger instance, String s, Object o) {
- if (!Objects.equals(o, Identifier.of("badlion", "mods"))) {
- instance.warn(s, o);
+ @Inject(method = "method_52801", at = @At("HEAD"))
+ public void onCustomPacketError(CustomPayload customPayload, CallbackInfo ci) {
+ if (Objects.equals(customPayload.id(), Identifier.of("badlion", "mods"))) {
+ ci.cancel();
}
}
diff --git a/src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt b/src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt
index 8288283..a78b423 100644
--- a/src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt
+++ b/src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt
@@ -50,8 +50,8 @@ object UrsaManager {
withContext(Dispatchers.IO) {
val mc = MinecraftClient.getInstance()
val serverId = UUID.randomUUID().toString()
- mc.sessionService.joinServer(mc.session.profile, mc.session.accessToken, serverId)
- header("x-ursa-username", mc.session.profile.name)
+ mc.sessionService.joinServer(mc.session.uuidOrNull, mc.session.accessToken, serverId)
+ header("x-ursa-username", mc.session.username)
header("x-ursa-serverid", serverId)
}
} else {
diff --git a/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt b/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt
index 63ce134..8251c92 100644
--- a/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt
@@ -102,9 +102,14 @@ class StorageOverlayScreen() : Screen(Text.empty()) {
return page.inventory?.rows?.let { it * 19 + MC.font.fontHeight + 2 } ?: 60
}
- override fun mouseScrolled(mouseX: Double, mouseY: Double, amount: Double): Boolean {
+ override fun mouseScrolled(
+ mouseX: Double,
+ mouseY: Double,
+ horizontalAmount: Double,
+ verticalAmount: Double
+ ): Boolean {
scroll =
- (scroll + amount * StorageOverlay.config.scrollSpeed *
+ (scroll + horizontalAmount * StorageOverlay.config.scrollSpeed *
(if (StorageOverlay.config.inverseScroll) 1 else -1)).toInt()
.coerceAtMost(lastRenderedHeight - height + 2 * StorageOverlay.config.margin).coerceAtLeast(0)
return true
diff --git a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
index eda6130..6c877ec 100644
--- a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
+++ b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
@@ -13,7 +13,11 @@ import io.github.moulberry.repo.NEURepositoryException
import io.github.moulberry.repo.data.NEUItem
import io.github.moulberry.repo.data.NEURecipe
import io.github.moulberry.repo.data.Rarity
+import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
import kotlinx.coroutines.launch
+import net.minecraft.client.MinecraftClient
+import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket
+import net.minecraft.text.Text
import moe.nea.firmament.Firmament
import moe.nea.firmament.Firmament.logger
import moe.nea.firmament.gui.config.ManagedConfig
@@ -21,10 +25,6 @@ import moe.nea.firmament.hud.ProgressBar
import moe.nea.firmament.rei.PetData
import moe.nea.firmament.util.MinecraftDispatcher
import moe.nea.firmament.util.SkyblockId
-import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
-import net.minecraft.client.MinecraftClient
-import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket
-import net.minecraft.text.Text
object RepoManager {
object Config : ManagedConfig("repo") {
@@ -54,8 +54,10 @@ object RepoManager {
var recentlyFailedToUpdateItemList = false
- val progressBar = ProgressBar("", null, 0).also {
- it.setSize(180, 22)
+ val progressBar by lazy {
+ ProgressBar("", null, 0).also {
+ it.setSize(180, 22)
+ }
}
val neuRepo: NEURepository = NEURepository.of(RepoDownloadManager.repoSavedLocation).apply {
diff --git a/src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt b/src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt
index afbdd82..b437357 100644
--- a/src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt
+++ b/src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt
@@ -8,6 +8,7 @@ package moe.nea.firmament.util
import java.util.Optional
import net.minecraft.scoreboard.Scoreboard
+import net.minecraft.scoreboard.ScoreboardDisplaySlot
import net.minecraft.scoreboard.Team
import net.minecraft.text.StringVisitable
import net.minecraft.text.Style
@@ -16,7 +17,7 @@ import net.minecraft.util.Formatting
fun getScoreboardLines(): List<Text> {
val scoreboard = MC.player?.scoreboard ?: return listOf()
- val activeObjective = scoreboard.getObjectiveForSlot(Scoreboard.SIDEBAR_DISPLAY_SLOT_ID) ?: return listOf()
+ val activeObjective = scoreboard.getObjectiveForSlot(ScoreboardDisplaySlot.SIDEBAR) ?: return listOf()
return scoreboard.getAllPlayerScores(activeObjective).reversed().take(15).map {
val team = scoreboard.getPlayerTeam(it.playerName)
Team.decorateName(team, Text.literal(it.playerName))
diff --git a/src/main/resources/firmament.accesswidener b/src/main/resources/firmament.accesswidener
index 8b4f3d7..08d4bff 100644
--- a/src/main/resources/firmament.accesswidener
+++ b/src/main/resources/firmament.accesswidener
@@ -4,3 +4,4 @@ accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters
accessible class net/minecraft/client/font/TextRenderer$Drawer
accessible class net/minecraft/client/render/model/ModelLoader$BakerImpl
accessible method net/minecraft/client/render/model/ModelLoader$BakerImpl <init> (Lnet/minecraft/client/render/model/ModelLoader;Ljava/util/function/BiFunction;Lnet/minecraft/util/Identifier;)V
+accessible field net/minecraft/client/texture/PlayerSkinProvider TEXTURES Ljava/lang/String;