Skip to content

Commit

Permalink
Updated VV API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphiMC committed Dec 9, 2024
1 parent 9936622 commit 27e66a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
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.*;
Expand Down Expand Up @@ -115,15 +114,6 @@ public void loadItemMappings(Protocol1_20_3To1_20_5 protocol, CallbackInfo ci) {
}, ViaLoadingEvent.class);
}

@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);
}
}

@Inject(method = "appendItemDataFixComponents", at = @At("RETURN"))
private void appendItemDataFixComponents(UserConnection user, Item item, CallbackInfo ci) {
final StructuredDataContainer data = item.dataContainer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
package net.raphimc.viaproxy.injection.mixins;

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) {
Expand Down

0 comments on commit 27e66a4

Please sign in to comment.