aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
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/java
parent2bd3ed1e238d75c4a185656ac6fd857ac6897a99 (diff)
downloadFirmament-139089d9beb134465737c4afff3b1303bf481aa1.tar.gz
Firmament-139089d9beb134465737c4afff3b1303bf481aa1.tar.bz2
Firmament-139089d9beb134465737c4afff3b1303bf481aa1.zip
Port to 1.20.2
Diffstat (limited to 'src/main/java')
-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
7 files changed, 90 insertions, 52 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();
}
}