Port to 1.20.2
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
33
src/main/java/moe/nea/firmament/mixins/MixinProperty.java
Normal file
33
src/main/java/moe/nea/firmament/mixins/MixinProperty.java
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user