Update VV API usage

This commit is contained in:
RaphiMC 2024-12-09 12:24:30 +01:00
parent 75cf57ab78
commit 5b677af35d
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
3 changed files with 7 additions and 17 deletions

View File

@ -45,7 +45,6 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
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.*;
@ -118,15 +117,6 @@ public abstract class MixinBlockItemPacketRewriter1_20_5 extends ItemRewriter<Cl
});
}
@Redirect(method = "appendItemDataFixComponents", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;olderThanOrEqualTo(Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;)Z"))
private boolean changeSwordFixVersionRange(ProtocolVersion instance, ProtocolVersion other) {
if (other == ProtocolVersion.v1_8) {
return instance.betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8);
} else {
return instance.olderThanOrEqualTo(other);
}
}
// Older servers don't have these components, so we can use them to emulate old item behaviour without the need
// of modifying tons of code in the game.
@Inject(method = "appendItemDataFixComponents", at = @At("RETURN"))

View File

@ -20,14 +20,14 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2;
import com.viaversion.viaversion.protocols.v1_21_2to1_21_4.rewriter.BlockItemPacketRewriter1_21_4;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(value = BlockItemPacketRewriter1_21_2.class, remap = false)
public abstract class MixinBlockItemPacketRewriter1_21_2 {
@Mixin(value = BlockItemPacketRewriter1_21_4.class, remap = false)
public abstract class MixinBlockItemPacketRewriter1_21_4 {
@Redirect(method = "appendItemDataFixComponents", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;olderThanOrEqualTo(Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;)Z"))
private boolean changeSwordFixVersionRange(ProtocolVersion instance, ProtocolVersion other) {

View File

@ -117,6 +117,7 @@
"fixes.minecraft.entity.MixinItemEntity",
"fixes.minecraft.entity.MixinLivingEntity",
"fixes.minecraft.entity.MixinMobEntity",
"fixes.minecraft.entity.MixinMooshroomEntity",
"fixes.minecraft.entity.MixinOtherClientPlayerEntity",
"fixes.minecraft.entity.MixinPlayerEntity",
"fixes.minecraft.entity.MixinPlayerEntityRenderer",
@ -191,7 +192,7 @@
"fixes.vialegacy.MixinProtocolc0_30cpeToc0_28_30",
"fixes.vialegacy.MixinProtocolr1_7_6_10Tor1_8",
"fixes.viaversion.MixinBlockItemPacketRewriter1_20_5",
"fixes.viaversion.MixinBlockItemPacketRewriter1_21_2",
"fixes.viaversion.MixinBlockItemPacketRewriter1_21_4",
"fixes.viaversion.MixinCommandBlockProvider",
"fixes.viaversion.MixinCommonBoss",
"fixes.viaversion.MixinEntityPacketRewriter1_12",
@ -220,8 +221,7 @@
"fixes.viaversion.MixinWorldPacketRewriter1_19",
"viabedrock.MixinJoinPackets",
"vialegacy.MixinExtensionProtocolMetadataStorage",
"vialegacy.MixinViaLegacyConfig",
"fixes.minecraft.entity.MixinMooshroomEntity"
"vialegacy.MixinViaLegacyConfig"
],
"injectors": {
"defaultRequire": 1
@ -229,4 +229,4 @@
"overwrites": {
"requireAnnotations": true
}
}
}