FlorianMichael 2023-08-03 09:23:19 +02:00
parent cefc76dc5a
commit d35054f35c
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 60 additions and 4 deletions

View File

@ -4,12 +4,14 @@ import com.google.gson.annotations.SerializedName;
import com.mojang.authlib.yggdrasil.response.KeyPairResponse;
import de.florianmichael.viafabricplus.injection.access.IKeyPairResponse;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import java.nio.ByteBuffer;
@Mixin(KeyPairResponse.class)
public class MixinKeyPairResponse implements IKeyPairResponse {
@Unique
@SerializedName("publicKeySignature")
private ByteBuffer viafabricplus_legacyKeySignature;

View File

@ -0,0 +1,55 @@
/*
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.ipnext;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* <a href="https://github.com/blackd/Inventory-Profiles/tree/all-in-one">Inventory-Profiles</a> is handling the offhand slot even when
* ViaFabricPlus removes the slot in <= 1.8.9, so we have to cancel the handling of the offhand slot
* <p>
* Fixes <a href="https://github.com/ViaVersion/ViaFabricPlus/issues/209">ViaFabricPlus Issue 209</a>
*/
@Pseudo
@Mixin(targets = "org.anti_ad.mc.ipnext.event.AutoRefillHandler$ItemSlotMonitor")
public class MixinAutoRefillHandler_ItemSlotMonitor {
@Shadow
public int currentSlotId;
@Inject(method = { "checkHandle", "checkShouldHandle" }, at = @At("HEAD"), cancellable = true)
public void dontHandleOffhandSlot(CallbackInfo ci) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
if (currentSlotId == 45) ci.cancel();
}
}
@Inject(method = "updateCurrent", at = @At(value = "FIELD", target = "Lorg/anti_ad/mc/ipnext/event/AutoRefillHandler$ItemSlotMonitor;currentSlotId:I", shift = At.Shift.AFTER), cancellable = true)
public void dontUpdateCurrentOffhandSlot(CallbackInfo ci) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
if (currentSlotId == 45) ci.cancel();
}
}
}

View File

@ -23,6 +23,7 @@
"base.MixinSharedConstants",
"classic4j.MixinCCAuthenticationResponse",
"fixes.authlib.MixinKeyPairResponse",
"fixes.ipnext.MixinAutoRefillHandler_ItemSlotMonitor",
"fixes.minecraft.MixinBipedEntityModel",
"fixes.minecraft.MixinCamera",
"fixes.minecraft.MixinClientPlayerInteractionManager",
@ -52,6 +53,7 @@
"fixes.minecraft.block.MixinBrewingStandBlock",
"fixes.minecraft.block.MixinCauldronBlock",
"fixes.minecraft.block.MixinChestBlock",
"fixes.minecraft.block.MixinCropBlock",
"fixes.minecraft.block.MixinEndPortalBlock",
"fixes.minecraft.block.MixinEndPortalFrameBlock",
"fixes.minecraft.block.MixinFarmlandBlock",
@ -173,8 +175,5 @@
],
"injectors": {
"defaultRequire": 1
},
"mixins": [
"fixes.minecraft.block.MixinCropBlock"
]
}
}