diff --git a/gradle.properties b/gradle.properties index 8ebc1b4c..c9332354 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,11 +5,11 @@ minecraft_version=1.19.3 yarn_mappings=1.19.3+build.5 loader_version=0.14.14 -mod_version=1.5.4 +mod_version=1.5.5 maven_group=de.florianmichael archives_base_name=viafabricplus -vialoadingbase_version=8df0605c3d +vialoadingbase_version=db24c2279c viaversion_version=4.6.0-1.19.4-pre2-SNAPSHOT viabackwards_version=4.6.0-1.19.4-pre1-SNAPSHOT vialegacy_version=cc56733803 diff --git a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java index ed14cb9b..a8a23e9f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java +++ b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java @@ -86,35 +86,6 @@ public class ViaFabricPlus { return MinecraftClient.getInstance().isInSingleplayer(); }); builder = builder.eventLoop(new DefaultEventLoop()); - builder = builder.dumpSupplier(() -> { - final JsonObject parentNode = new JsonObject(); - final JsonArray modsNode = new JsonArray(); - for (ModContainer mod : FabricLoader.getInstance().getAllMods()) { - final JsonObject modNode = new JsonObject(); - modNode.addProperty("id", mod.getMetadata().getId()); - modNode.addProperty("name", mod.getMetadata().getName()); - modNode.addProperty("version", mod.getMetadata().getVersion().getFriendlyString()); - - final JsonArray authorsNode = new JsonArray(); - for (Person author : mod.getMetadata().getAuthors()) { - final JsonObject infoNode = new JsonObject(); - - final JsonObject contactNode = new JsonObject(); - author.getContact().asMap().forEach(contactNode::addProperty); - if (contactNode.size() != 0) { - infoNode.add("contact", contactNode); - } - infoNode.addProperty("name", author.getName()); - - authorsNode.add(infoNode); - } - modNode.add("author", authorsNode); - modsNode.add(modNode); - } - parentNode.add("mods", modsNode); - parentNode.addProperty("native version", SharedConstants.getProtocolVersion()); - return parentNode; - }); builder = builder.providers(providers -> { providers.use(MovementTransmitterProvider.class, new ViaFabricPlusMovementTransmitterProvider()); providers.use(HandItemProvider.class, new ViaFabricPlusHandItemProvider()); diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/PackFormatsDefinition.java b/src/main/java/de/florianmichael/viafabricplus/definition/PackFormatsDefinition.java index d1ded1b5..6591192b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/definition/PackFormatsDefinition.java +++ b/src/main/java/de/florianmichael/viafabricplus/definition/PackFormatsDefinition.java @@ -65,7 +65,7 @@ public class PackFormatsDefinition { } public static GameVersion current() { - final int targetVersion = ViaLoadingBase.getTargetVersion().getOriginalVersion(); + final int targetVersion = ViaLoadingBase.getClassWrapper().getTargetVersion().getOriginalVersion(); if (!protocolMap.containsKey(targetVersion)) return SharedConstants.getGameVersion(); return protocolMap.get(targetVersion); } diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassicWorldHeightInjection.java b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassicWorldHeightInjection.java index 28775e0c..b71d1f7f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassicWorldHeightInjection.java +++ b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassicWorldHeightInjection.java @@ -34,7 +34,7 @@ public class ClassicWorldHeightInjection { parentRemapper.handle(wrapper); if (wrapper.isCancelled()) return; - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { for (Tag dimension : wrapper.get(Type.NBT, 0).get("minecraft:dimension_type").get("value")) { changeDimensionTagHeight(wrapper.user(), ((CompoundTag) dimension).get("element")); } @@ -53,7 +53,7 @@ public class ClassicWorldHeightInjection { parentRemapper.handle(wrapper); if (wrapper.isCancelled()) return; - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 0)); } }); @@ -69,7 +69,7 @@ public class ClassicWorldHeightInjection { parentRemapper.handle(wrapper); if (wrapper.isCancelled()) return; - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { wrapper.resetReader(); final Chunk chunk = wrapper.read(new Chunk1_17Type(16)); wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk); @@ -163,7 +163,7 @@ public class ClassicWorldHeightInjection { @Override public void register() { handler(wrapper -> { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { classicLightHandler.handle(wrapper); } else { parentRemapper.handle(wrapper); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java index 09ba663b..8d006a05 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java @@ -37,7 +37,7 @@ public class MixinClientConnection implements IClientConnection { @Inject(method = "setupEncryption", at = @At("HEAD"), cancellable = true) private void storeEncryptionCiphers(Cipher decryptionCipher, Cipher encryptionCipher, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { ci.cancel(); this.viafabricplus_decryptionCipher = decryptionCipher; this.viafabricplus_encryptionCipher = encryptionCipher; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection_1.java index f1a03ac3..4bad88ef 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection_1.java @@ -6,8 +6,8 @@ import com.viaversion.viaversion.protocol.ProtocolPipelineImpl; import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.platform.PreNettyConstants; import de.florianmichael.vialoadingbase.ViaLoadingBase; -import de.florianmichael.vialoadingbase.netty.CustomViaDecodeHandler; -import de.florianmichael.vialoadingbase.netty.CustomViaEncodeHandler; +import de.florianmichael.vialoadingbase.netty.VLBViaDecodeHandler; +import de.florianmichael.vialoadingbase.netty.VLBViaEncodeHandler; import de.florianmichael.vialoadingbase.netty.NettyConstants; import io.netty.channel.Channel; import io.netty.channel.socket.SocketChannel; @@ -39,10 +39,10 @@ public class MixinClientConnection_1 { new ProtocolPipelineImpl(user); - channel.pipeline().addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new CustomViaEncodeHandler(user)); - channel.pipeline().addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new CustomViaDecodeHandler(user)); + channel.pipeline().addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new VLBViaDecodeHandler(user)); + channel.pipeline().addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new VLBViaEncodeHandler(user)); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { user.getProtocolInfo().getPipeline().add(PreNettyBaseProtocol.INSTANCE); channel.pipeline().addBefore("prepender", PreNettyConstants.HANDLER_ENCODER_NAME, new PreNettyEncoder(user)); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java index b33f59cb..82a4ebab 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java @@ -22,7 +22,7 @@ public class MixinClientLoginNetworkHandler { @Inject(method = "joinServerSession", at = @At("HEAD"), cancellable = true) public void dontVerifySessionIfCracked(String serverId, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (!connection.channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get().get(ProtocolMetadataStorage.class).authenticate) { cir.setReturnValue(null); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDebugHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDebugHud.java index c3c87db8..a79c088c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDebugHud.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDebugHud.java @@ -32,24 +32,24 @@ public class MixinDebugHud { final UserConnection userConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get(); information.add("Pipeline count: " + userConnection.getProtocolInfo().getPipeline().pipes().size()); - information.add("Target version: " + ViaLoadingBase.getTargetVersion().getName() + " (" + ViaLoadingBase.getTargetVersion().getVersion() + ")"); + information.add("Target version: " + ViaLoadingBase.getClassWrapper().getTargetVersion().getName() + " (" + ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion() + ")"); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) { final EntityTracker entityTracker1_7_10 = userConnection.get(EntityTracker.class); if (entityTracker1_7_10 != null) { information.add("Entity Tracker (" + ProtocolVersion.v1_7_6.getName() + "): " + entityTracker1_7_10.getTrackedEntities().size()); } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_5_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_5_2)) { final net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker entityTracker1_5_2 = userConnection.get(net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker.class); if (entityTracker1_5_2 != null) { information.add("Entity Tracker (" + LegacyProtocolVersion.r1_5_2.getName() + "): " + entityTracker1_5_2.getTrackedEntities().size()); } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { final net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker entityTracker1_2_4_5 = userConnection.get(net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker.class); if (entityTracker1_2_4_5 != null) { information.add("Entity Tracker (" + LegacyProtocolVersion.r1_2_4tor1_2_5.getName() + "): " + entityTracker1_2_4_5.getTrackedEntities().size()); } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_1)) { final SeedStorage seedStorage = userConnection.get(SeedStorage.class); if (seedStorage != null) { information.add("World Seed (" + LegacyProtocolVersion.r1_1.getName() + "): " + seedStorage.seed); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayNetworkHandler.java index 0ba8f619..d6c98150 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayNetworkHandler.java @@ -51,14 +51,14 @@ public abstract class MixinClientPlayNetworkHandler { @Inject(method = "", at = @At("RETURN")) public void fixPlayerListOrdering(MinecraftClient client, Screen screen, ClientConnection connection, ServerInfo serverInfo, GameProfile profile, WorldSession worldSession, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { this.listedPlayerListEntries = new LinkedHashSet<>(); } } @Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true) private void onPing(PlayPingS2CPacket packet, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) { return; } @@ -75,14 +75,14 @@ public abstract class MixinClientPlayNetworkHandler { @Inject(method = "onChunkLoadDistance", at = @At("RETURN")) public void emulateSimulationDistance(ChunkLoadDistanceS2CPacket packet, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17_1)) { this.onSimulationDistance(new SimulationDistanceS2CPacket(packet.getDistance())); } } @Inject(method = "onEntitySpawn", at = @At("TAIL")) public void forceEntityVelocity(EntitySpawnS2CPacket packet, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (packet.getEntityType() == EntityType.ITEM || packet.getEntityType() == EntityType.ARROW || packet.getEntityType() == EntityType.SPECTRAL_ARROW || packet.getEntityType() == EntityType.TRIDENT) { onEntityVelocityUpdate(new EntityVelocityUpdateS2CPacket(packet.getId(), new Vec3d(packet.getVelocityX(), packet.getVelocityY(), packet.getVelocityZ()))); } @@ -91,7 +91,7 @@ public abstract class MixinClientPlayNetworkHandler { @Inject(method = { "onGameJoin", "onPlayerRespawn" }, at = @At("TAIL")) private void injectOnOnGameJoinOrRespawn(CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { ClientPlayerEntity player = MinecraftClient.getInstance().player; assert player != null; onEntityStatus(new EntityStatusS2CPacket(player, (byte) 28)); @@ -100,14 +100,14 @@ public abstract class MixinClientPlayNetworkHandler { @Redirect(method = "onPlayerSpawnPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;setReady()V")) public void moveDownloadingTerrainClosing(DownloadingTerrainScreen instance) { - if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) { instance.setReady(); } } @Inject(method = "onPlayerPositionLook", at = @At("RETURN")) public void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2) && MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2) && MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen) { MinecraftClient.getInstance().setScreen(null); } } @@ -115,7 +115,7 @@ public abstract class MixinClientPlayNetworkHandler { @SuppressWarnings("InvalidInjectorMethodSignature") @ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class)) public Class dontChangePlayerYaw(Object entity, Class constant) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { return Integer.class; } return constant; @@ -123,7 +123,7 @@ public abstract class MixinClientPlayNetworkHandler { @Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false)) public void removeNewWarning(Logger instance, String s, Object o) { - if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) { instance.warn(s, o); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayerInteractionManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayerInteractionManager.java index 76e4f03c..2b648be7 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayerInteractionManager.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayerInteractionManager.java @@ -53,7 +53,7 @@ public abstract class MixinClientPlayerInteractionManager { @Inject(method = "attackEntity", at = @At("HEAD")) private void injectAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && player instanceof IClientPlayerEntity) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && player instanceof IClientPlayerEntity) { player.swingHand(Hand.MAIN_HAND); ((IClientPlayerEntity) player).viafabricplus_cancelSwingOnce(); } @@ -73,7 +73,7 @@ public abstract class MixinClientPlayerInteractionManager { if (type == SlotActionType.QUICK_CRAFT) return true; // quick move always uses empty stack for verification since 1.12 - if (type == SlotActionType.QUICK_MOVE && ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) return true; + if (type == SlotActionType.QUICK_MOVE && ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) return true; // pickup with slot -999 (outside window) to throw items always uses empty stack for verification return type == SlotActionType.PICKUP && slot == -999; @@ -82,7 +82,7 @@ public abstract class MixinClientPlayerInteractionManager { @Redirect(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V")) private void modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet packet) { try { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) { ItemStack slotItemBeforeModification; if (this.protocolhack_shouldEmpty(clickSlot.getActionType(), clickSlot.getSlot())) @@ -119,7 +119,7 @@ public abstract class MixinClientPlayerInteractionManager { slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"), to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V", ordinal = 0))) private void redirectInteractItem(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet packet) { - if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) { clientPlayNetworkHandler.sendPacket(packet); } } @@ -139,7 +139,7 @@ public abstract class MixinClientPlayerInteractionManager { @Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true) public void cacheActionResult(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { this.protocolhack_actionResult = this.interactBlockInternal(player, hand, hitResult); if (this.protocolhack_actionResult == ActionResult.FAIL) { @@ -150,7 +150,7 @@ public abstract class MixinClientPlayerInteractionManager { @Redirect(method = "method_41933", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactBlockInternal(Lnet/minecraft/client/network/ClientPlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;")) public ActionResult provideCachedResult(ClientPlayerInteractionManager instance, ClientPlayerEntity player, Hand hand, BlockHitResult hitResult) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return this.protocolhack_actionResult; } return interactBlockInternal(player, hand, hitResult); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinMinecraftClient.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinMinecraftClient.java index ff4e4d1e..e7610935 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinMinecraftClient.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinMinecraftClient.java @@ -41,7 +41,7 @@ public abstract class MixinMinecraftClient { slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactItem(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;")), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;resetEquipProgress(Lnet/minecraft/util/Hand;)V", ordinal = 0)) private void redirectDoItemUse(HeldItemRenderer heldItemRenderer, Hand hand) { - if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_8) || !(player.getStackInHand(hand).getItem() instanceof SwordItem)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_8) || !(player.getStackInHand(hand).getItem() instanceof SwordItem)) { heldItemRenderer.resetEquipProgress(hand); } } @@ -50,7 +50,7 @@ public abstract class MixinMinecraftClient { slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactEntity(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/Entity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;")), at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;isAccepted()Z", ordinal = 0)) private boolean preventGenericInteract(ActionResult instance) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) { return true; } @@ -62,7 +62,7 @@ public abstract class MixinMinecraftClient { */ @Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;attackCooldown:I", ordinal = 1)) public int unwrapOperation(MinecraftClient instance) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return 0; } return attackCooldown; @@ -70,7 +70,7 @@ public abstract class MixinMinecraftClient { @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;handleInputEvents()V", shift = At.Shift.BEFORE)) public void updateCooldown(CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (this.attackCooldown > 0) { --this.attackCooldown; } @@ -91,7 +91,7 @@ public abstract class MixinMinecraftClient { if (getNetworkHandler() != null && DebugSettings.getClassWrapper().sendOpenInventoryPacket.getValue()) { final UserConnection viaConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get(); - if (viaConnection != null && ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + if (viaConnection != null && ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) { final PacketWrapper clientStatus = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_STATUS, viaConnection); clientStatus.write(Type.VAR_INT, 2); // Open Inventory Achievement diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinPlayerEntityRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinPlayerEntityRenderer.java index afc2bc5e..413b18ba 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinPlayerEntityRenderer.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinPlayerEntityRenderer.java @@ -17,7 +17,7 @@ public class MixinPlayerEntityRenderer { @Inject(method = "getPositionOffset*", at = @At("RETURN"), cancellable = true) private void injectGetPositionOffset(AbstractClientPlayerEntity player, float delta, CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (player.getSleepingDirection() != null) { ci.setReturnValue(ci.getReturnValue().subtract(player.getSleepingDirection().getOffsetX() * 0.4, 0, player.getSleepingDirection().getOffsetZ() * 0.4)); } @@ -27,6 +27,6 @@ public class MixinPlayerEntityRenderer { @Redirect(method = "getPositionOffset(Lnet/minecraft/client/network/AbstractClientPlayerEntity;F)Lnet/minecraft/util/math/Vec3d;", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;isInSneakingPose()Z")) private boolean redirectGetPositionOffset(AbstractClientPlayerEntity player) { - return (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) && player.isInSneakingPose(); + return (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) && player.isInSneakingPose(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinServerAddress.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinServerAddress.java index 1f7a67b7..50b634c1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinServerAddress.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinServerAddress.java @@ -18,7 +18,7 @@ public class MixinServerAddress { @Inject(method = "parse", at = @At("RETURN"), cancellable = true) private static void fixAddress(String address, CallbackInfoReturnable cir) { - if (!cir.getReturnValue().equals(INVALID) && ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (!cir.getReturnValue().equals(INVALID) && ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(AllowedAddressResolver.DEFAULT.redirectResolver.lookupRedirect(cir.getReturnValue()).orElse(cir.getReturnValue())); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinServerResourcePackProvider.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinServerResourcePackProvider.java index 200cc2ab..767693e1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinServerResourcePackProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinServerResourcePackProvider.java @@ -37,10 +37,10 @@ public class MixinServerResourcePackProvider { @Inject(method = "getDownloadHeaders", at = @At("TAIL"), cancellable = true) private static void removeHeaders(CallbackInfoReturnable> cir) { final LinkedHashMap modifiableMap = new LinkedHashMap<>(cir.getReturnValue()); - if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_14)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_14)) { modifiableMap.remove("X-Minecraft-Version-ID"); } - if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_13)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_13)) { modifiableMap.remove("X-Minecraft-Pack-Format"); modifiableMap.remove("User-Agent"); } @@ -56,10 +56,10 @@ public class MixinServerResourcePackProvider { @Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Lcom/google/common/hash/HashCode;toString()Ljava/lang/String;", remap = false)) public String revertHashAlgorithm(HashCode instance) { try { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { //noinspection deprecation return Hashing.sha1().hashBytes(Files.toByteArray(protocolhack_trackedFile)).toString(); - } else if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_18)) { + } else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_18)) { return DigestUtils.sha1Hex(new FileInputStream(protocolhack_trackedFile)); } } catch (IOException ignored) { @@ -69,7 +69,7 @@ public class MixinServerResourcePackProvider { @Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Ljava/lang/String;toLowerCase(Ljava/util/Locale;)Ljava/lang/String;")) public String disableIgnoreCase(String instance, Locale locale) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return instance; } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAbstractBlock_AbstractBlockState.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAbstractBlock_AbstractBlockState.java index c3dfc84c..6c5e682c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAbstractBlock_AbstractBlockState.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAbstractBlock_AbstractBlockState.java @@ -24,25 +24,25 @@ public abstract class MixinAbstractBlock_AbstractBlockState { public void changeHardness(BlockView world, BlockPos pos, CallbackInfoReturnable cir) { final BlockState state = this.asBlockState(); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (state.getBlock() instanceof InfestedBlock) { cir.setReturnValue(0.75F); } } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (state.getBlock() == Blocks.END_STONE_BRICKS || state.getBlock() == Blocks.END_STONE_BRICK_SLAB || state.getBlock() == Blocks.END_STONE_BRICK_STAIRS || state.getBlock() == Blocks.END_STONE_BRICK_WALL) { cir.setReturnValue(0.8F); } } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (state.getBlock() == Blocks.PISTON || state.getBlock() == Blocks.STICKY_PISTON || state.getBlock() == Blocks.PISTON_HEAD) { cir.setReturnValue(0.5F); } } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (state.getBlock() instanceof InfestedBlock) { cir.setReturnValue(0F); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAnvilBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAnvilBlock.java index aa9d77a6..b181346e 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAnvilBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAnvilBlock.java @@ -34,7 +34,7 @@ public class MixinAnvilBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(state.get(FACING).getAxis() == Direction.Axis.X ? viafabricplus_x_axis_shape_v1_12_2 : viafabricplus_z_axis_shape_v1_12_2); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBambooBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBambooBlock.java index 0fd1935d..917ee2c9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBambooBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBambooBlock.java @@ -16,7 +16,7 @@ public class MixinBambooBlock { @Inject(method = "isShapeFullCube", at = @At("HEAD"), cancellable = true) public void changeFullCube(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) { cir.setReturnValue(true); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBedBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBedBlock.java index d43cdaea..6d998bb3 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBedBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBedBlock.java @@ -25,7 +25,7 @@ public class MixinBedBlock { @Inject(method = "bounceEntity", at = @At("HEAD"), cancellable = true) public void injectBounceEntity(Entity entity, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) { ci.cancel(); } } @@ -33,7 +33,7 @@ public class MixinBedBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { if (ViaLoadingBase.getClassWrapper() != null) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { cir.setReturnValue(viafabricplus_bed_shape_v1_13_2); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBlock.java index 57413e23..8480c2c0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBlock.java @@ -17,19 +17,19 @@ public class MixinBlock { private void modifyBlastResistance(CallbackInfoReturnable ci) { final Block block = ((Block) (Object) this); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (block == Blocks.END_STONE_BRICKS || block == Blocks.END_STONE_BRICK_SLAB || block == Blocks.END_STONE_BRICK_STAIRS || block == Blocks.END_STONE_BRICK_WALL) { ci.setReturnValue(0.8F); } } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (block == Blocks.PISTON || block == Blocks.STICKY_PISTON || block == Blocks.PISTON_HEAD) { ci.setReturnValue(0.5F); } } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (block instanceof InfestedBlock) { ci.setReturnValue(0.75F); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBrewingStandBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBrewingStandBlock.java index 1509ff23..e82c8afe 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBrewingStandBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinBrewingStandBlock.java @@ -27,7 +27,7 @@ public class MixinBrewingStandBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viafabricplus_base_shape_v1_12_2); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinCauldronBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinCauldronBlock.java index 6a287fd7..e45622b4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinCauldronBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinCauldronBlock.java @@ -31,7 +31,7 @@ public abstract class MixinCauldronBlock extends AbstractCauldronBlock { @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return viafabricplus_cauldron_shape_v1_12_2; } return super.getOutlineShape(state, world, pos, context); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinEndPortalBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinEndPortalBlock.java index 1ae90498..3a493ed3 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinEndPortalBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinEndPortalBlock.java @@ -35,10 +35,10 @@ public abstract class MixinEndPortalBlock extends BlockWithEntity { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { if (MinecraftClient.getInstance() == null || MinecraftClient.getInstance().world == null) return; - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(viafabricplus_shape_v1_8_x); } - else if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(viafabricplus_shape_v1_16_5); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinEndPortalFrameBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinEndPortalFrameBlock.java index beabf09a..05900c9d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinEndPortalFrameBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinEndPortalFrameBlock.java @@ -27,7 +27,7 @@ public class MixinEndPortalFrameBlock { @Redirect(method = "getOutlineShape", at = @At(value = "FIELD", target = "Lnet/minecraft/block/EndPortalFrameBlock;FRAME_WITH_EYE_SHAPE:Lnet/minecraft/util/shape/VoxelShape;")) public VoxelShape redirectGetOutlineShape() { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return VoxelShapes.union(FRAME_SHAPE, viafabricplus_eye_shape_v1_12_2); } return FRAME_WITH_EYE_SHAPE; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFarmlandBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFarmlandBlock.java index 2fae4d70..1ee8e24c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFarmlandBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFarmlandBlock.java @@ -33,7 +33,7 @@ public class MixinFarmlandBlock extends Block { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3)) { cir.setReturnValue(viafabricplus_shape_v1_9_4); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFenceBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFenceBlock.java index f71ed20c..310c9d2a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFenceBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFenceBlock.java @@ -14,7 +14,7 @@ public class MixinFenceBlock { @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) private void injectOnUse(CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10)) { ci.setReturnValue(ActionResult.SUCCESS); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFireBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFireBlock.java index 32ce71c6..ae2c31a9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFireBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFireBlock.java @@ -19,7 +19,7 @@ public class MixinFireBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { cir.setReturnValue(VoxelShapes.empty()); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFlowerPotBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFlowerPotBlock.java index ad439c7d..d591bec6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFlowerPotBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinFlowerPotBlock.java @@ -22,7 +22,7 @@ public class MixinFlowerPotBlock { @Inject(method = "onUse", at = @At(value = "FIELD", target = "Lnet/minecraft/block/FlowerPotBlock;content:Lnet/minecraft/block/Block;", ordinal = 0), cancellable = true) private void injectOnUse(CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10) && content != Blocks.AIR) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10) && content != Blocks.AIR) { ci.setReturnValue(ActionResult.CONSUME); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinHopperBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinHopperBlock.java index 7c4499bf..efed60d6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinHopperBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinHopperBlock.java @@ -31,14 +31,14 @@ public class MixinHopperBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viafabricplus_hopper_shape_v1_12_2); } } @Inject(method = "getRaycastShape", at = @At("HEAD"), cancellable = true) public void injectGetRaycastShape(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viafabricplus_inside_shape_v1_12_2); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLadderBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLadderBlock.java index ed6913bb..795ec7da 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLadderBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLadderBlock.java @@ -32,7 +32,7 @@ public class MixinLadderBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { switch (state.get(LadderBlock.FACING)) { case NORTH -> ci.setReturnValue(viafabricplus_north_shape_v1_8_x); case SOUTH -> ci.setReturnValue(viafabricplus_south_shape_v1_8_x); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLightBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLightBlock.java index d21fcd05..aaef604e 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLightBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLightBlock.java @@ -14,7 +14,7 @@ public class MixinLightBlock { // Not relevant for GamePlay @Redirect(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isCreativeLevelTwoOp()Z")) public boolean removeIf(PlayerEntity instance) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { return true; } return instance.isCreativeLevelTwoOp(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLilyPadBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLilyPadBlock.java index b6eea584..54d0c123 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLilyPadBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinLilyPadBlock.java @@ -23,7 +23,7 @@ public class MixinLilyPadBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void changeBoundingBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(viafabricplus_shape_v1_8_x); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinPaneBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinPaneBlock.java index abea0223..5309d031 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinPaneBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinPaneBlock.java @@ -19,7 +19,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock { @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return protocolhack_get1_8Shape(state); } return super.getOutlineShape(state, world, pos, context); @@ -27,7 +27,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock { @Override public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return protocolhack_get1_8Shape(state); } return super.getCollisionShape(state, world, pos, context); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinPistonHeadBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinPistonHeadBlock.java index ac8aaebc..53f879d2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinPistonHeadBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinPistonHeadBlock.java @@ -23,13 +23,13 @@ public class MixinPistonHeadBlock extends FacingBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) cir.setReturnValue(viafabricplus_getCoreShape_v1_8_x(state)); } @Override public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) return VoxelShapes.union(viafabricplus_getHeadShape_v1_8_x(state), viafabricplus_getCoreShape_v1_8_x(state)); return super.getCollisionShape(state, world, pos, context); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSnowBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSnowBlock.java index c585fe93..d288dd10 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSnowBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSnowBlock.java @@ -39,7 +39,7 @@ public class MixinSnowBlock { @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viafabricplus_layers_to_shape_v1_12_2[state.get(LAYERS) - 1]); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSoulSandBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSoulSandBlock.java index ce81223a..48fcfcc4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSoulSandBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSoulSandBlock.java @@ -26,7 +26,7 @@ public class MixinSoulSandBlock extends Block { public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { super.onEntityCollision(state, world, pos, entity); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { final Vec3d velocity = entity.getVelocity(); this.viafabricplus_forceValue = true; entity.setVelocity(velocity.getX() * this.getVelocityMultiplier(), velocity.getY(), velocity.getZ() * this.getVelocityMultiplier()); @@ -36,7 +36,7 @@ public class MixinSoulSandBlock extends Block { @Override public float getVelocityMultiplier() { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4) && !this.viafabricplus_forceValue) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4) && !this.viafabricplus_forceValue) { return 1.0F; } return super.getVelocityMultiplier(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSugarCaneBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSugarCaneBlock.java index d95241ee..da01d808 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSugarCaneBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinSugarCaneBlock.java @@ -16,7 +16,7 @@ public class MixinSugarCaneBlock { @Redirect(method = "canPlaceAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isIn(Lnet/minecraft/registry/tag/TagKey;)Z")) public boolean changePlaceTarget(BlockState instance, TagKey tagKey) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) { return instance.isOf(Blocks.GRASS_BLOCK) || instance.isOf(Blocks.DIRT) || instance.isOf(Blocks.COARSE_DIRT) || instance.isOf(Blocks.PODZOL); } return instance.isIn(tagKey); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinWallBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinWallBlock.java index b43662cb..2cfdc595 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinWallBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinWallBlock.java @@ -127,28 +127,28 @@ public class MixinWallBlock extends Block { @Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true) public void injectGetPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { cir.setReturnValue(viafabricplus_oldWallPlacementLogic(cir.getReturnValue())); } } @Inject(method = "getStateForNeighborUpdate", at = @At("RETURN"), cancellable = true) public void injectGetStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { cir.setReturnValue(viafabricplus_oldWallPlacementLogic(cir.getReturnValue())); } } @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) public void injectGetCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viafabricplus_cip_shape_by_index_v1_12_2[viafabricplus_getShapeIndex_v1_12_2(state)]); } } @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viafabricplus_shape_by_index_v1_12_2[viafabricplus_getShapeIndex_v1_12_2(state)]); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAbstractDonkeyEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAbstractDonkeyEntity.java index e648e6f9..8ce70034 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAbstractDonkeyEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAbstractDonkeyEntity.java @@ -33,7 +33,7 @@ public abstract class MixinAbstractDonkeyEntity extends AbstractHorseEntity { @Inject(method = "interactMob", at = @At("HEAD"), cancellable = true) public void fixInteraction(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { ItemStack lv = player.getStackInHand(hand); if (!this.isBaby()) { if (this.isTame() && player.shouldCancelInteraction()) { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAllayEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAllayEntity.java index 9caad6bc..ada40def 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAllayEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAllayEntity.java @@ -13,7 +13,7 @@ public class MixinAllayEntity { @Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true) public void changeHeightOffset(CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { cir.setReturnValue(0.0); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAnimalEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAnimalEntity.java index 71ebce40..028654df 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAnimalEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinAnimalEntity.java @@ -13,6 +13,6 @@ public class MixinAnimalEntity { @Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;isClient:Z")) public boolean redirectInteractMob(World instance) { - return instance.isClient && ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_15); + return instance.isClient && ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_15); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinClientPlayerEntity.java index 56d5c43c..a24228c5 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinClientPlayerEntity.java @@ -75,11 +75,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity double f = this.getZ() - this.lastZ; double g = this.getYaw() - this.lastYaw; double h = this.getPitch() - this.lastPitch; - if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_8)) { ++this.ticksSinceLastPositionPacketSent; } double n = MathHelper.square(2.05E-4); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { n = 9.0E-4D; } boolean bl3 = MathHelper.squaredMagnitude(d, e, f) > n || this.ticksSinceLastPositionPacketSent >= 20; @@ -99,7 +99,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity } else { IdlePacketExecutor.skipIdlePacket(); } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { ++this.ticksSinceLastPositionPacketSent; } @@ -121,7 +121,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Inject(method = "swingHand", at = @At("HEAD"), cancellable = true) public void injectSwingHand(Hand hand, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolhack_areSwingCanceledThisTick) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolhack_areSwingCanceledThisTick) { ci.cancel(); } @@ -134,7 +134,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity at = @At(value = "FIELD", target = "Lnet/minecraft/client/input/Input;sneaking:Z", ordinal = 0) ) private void injectTickMovement(CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (this.input.sneaking) { this.input.movementSideways = (float) ((double) this.input.movementSideways / 0.3D); this.input.movementForward = (float) ((double) this.input.movementForward / 0.3D); @@ -146,7 +146,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z")), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSwimming()Z", ordinal = 0)) public boolean redirectIsSneakingWhileSwimming(ClientPlayerEntity _this) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { return false; } else { return _this.isSwimming(); @@ -155,7 +155,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Redirect(method = "isWalking", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSubmergedInWater()Z")) public boolean easierUnderwaterSprinting(ClientPlayerEntity instance) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { return false; } return instance.isSubmergedInWater(); @@ -163,7 +163,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Redirect(method = "tickMovement()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;hasForwardMovement()Z", ordinal = 0)) private boolean disableSprintSneak(Input input) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { return input.movementForward >= 0.8F; } @@ -172,7 +172,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isTouchingWater()Z")) private boolean redirectTickMovement(ClientPlayerEntity self) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return false; // Disable all water related movement } @@ -181,7 +181,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V")) public void removeSprintingPacket(ClientPlayerEntity instance) { - if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) { sendSprintingPacket(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinCowEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinCowEntity.java index a6b0ae2b..e255ead0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinCowEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinCowEntity.java @@ -23,7 +23,7 @@ public abstract class MixinCowEntity extends AnimalEntity { @Inject(method = "interactMob", at = @At("HEAD"), cancellable = true) public void injectInteractMob(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && player.getAbilities().creativeMode) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && player.getAbilities().creativeMode) { cir.setReturnValue(super.interactMob(player, hand)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinCreeperEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinCreeperEntity.java index c13a9b5b..b685d309 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinCreeperEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinCreeperEntity.java @@ -14,7 +14,7 @@ public class MixinCreeperEntity { @Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/sound/SoundEvents;ITEM_FIRECHARGE_USE:Lnet/minecraft/sound/SoundEvent;")) public SoundEvent fixSound() { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { return SoundEvents.ITEM_FLINTANDSTEEL_USE; } return SoundEvents.ITEM_FIRECHARGE_USE; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntity.java index 730c2f33..400bdf70 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntity.java @@ -42,7 +42,7 @@ public abstract class MixinEntity { @ModifyConstant(method = "movementInputToVelocity", constant = @Constant(doubleValue = 1E-7)) private static double injectMovementInputToVelocity(double epsilon) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return 1E-4; } return epsilon; @@ -50,21 +50,21 @@ public abstract class MixinEntity { @Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true) public void injectGetVelocityAffectingPos(CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { cir.setReturnValue(new BlockPos(pos.x, getBoundingBox().minY - 1, pos.z)); } } @Inject(method = "getRotationVector(FF)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true) public void onGetRotationVector(float pitch, float yaw, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(Vec3d.fromPolar(pitch, yaw)); } } @Inject(method = "setSwimming", at = @At("HEAD"), cancellable = true) private void onSetSwimming(boolean swimming, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && swimming) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && swimming) { ci.cancel(); } } @@ -72,7 +72,7 @@ public abstract class MixinEntity { @SuppressWarnings("deprecation") @Inject(method = "updateMovementInFluid", at = @At("HEAD"), cancellable = true) private void modifyFluidMovementBoundingBox(TagKey fluidTag, double d, CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) { return; } @@ -122,19 +122,19 @@ public abstract class MixinEntity { @Inject(method = "getTargetingMargin", at = @At("HEAD"), cancellable = true) public void expandHitBox(CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(0.1F); } } @Redirect(method = {"setYaw", "setPitch"}, at = @At(value = "INVOKE", target = "Ljava/lang/Float;isFinite(F)Z")) public boolean modifyIsFinite(float f) { - return Float.isFinite(f) || ((Object) this instanceof ClientPlayerEntity && ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)); + return Float.isFinite(f) || ((Object) this instanceof ClientPlayerEntity && ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)); } @ModifyConstant(method = "checkBlockCollision", constant = @Constant(doubleValue = 1.0E-7)) public double changeBlockCollisionConstant(double constant) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { return 0.001; } return constant; @@ -143,7 +143,7 @@ public abstract class MixinEntity { // Not relevant for GamePlay @Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onLanding()V")) public void revertOnLanding(Entity instance) { - if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) { instance.onLanding(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntityIndex.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntityIndex.java index a402c522..4ac46705 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntityIndex.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntityIndex.java @@ -25,12 +25,12 @@ public class MixinEntityIndex { @Redirect(method = "add", at = @At(value = "INVOKE", target = "Ljava/util/Map;containsKey(Ljava/lang/Object;)Z", remap = false)) private boolean allowDuplicateUuid(Map instance, Object o) { - return instance.containsKey(o) && ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_16_4); + return instance.containsKey(o) && ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_16_4); } @Inject(method = "size", at = @At("HEAD"), cancellable = true) private void returnRealSize(CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(this.idToEntity.size()); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntityPredicates.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntityPredicates.java index 041882ce..e4a8b4b8 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntityPredicates.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinEntityPredicates.java @@ -14,7 +14,7 @@ public class MixinEntityPredicates { @SuppressWarnings("target") @Redirect(method = "method_5915(Lnet/minecraft/entity/Entity;Lnet/minecraft/scoreboard/AbstractTeam;Lnet/minecraft/scoreboard/AbstractTeam$CollisionRule;Lnet/minecraft/entity/Entity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isMainPlayer()Z")) private static boolean makeMainPlayerUnpushable(PlayerEntity player) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return false; } return player.isMainPlayer(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinItemEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinItemEntity.java index 21a7a693..6986fc6c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinItemEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinItemEntity.java @@ -13,7 +13,7 @@ public class MixinItemEntity { @Inject(method = "applyWaterBuoyancy", at = @At("HEAD"), cancellable = true) public void injectApplyWaterBuoyancy(CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { ci.cancel(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinLivingEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinLivingEntity.java index 8501ce2f..f8f0b625 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinLivingEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinLivingEntity.java @@ -33,7 +33,7 @@ public abstract class MixinLivingEntity extends Entity { @Inject(method = "getPreferredEquipmentSlot", at = @At("HEAD"), cancellable = true) private static void removeShieldSlotPreference(ItemStack stack, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3) && stack.isOf(Items.SHIELD)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3) && stack.isOf(Items.SHIELD)) { cir.setReturnValue(EquipmentSlot.MAINHAND); } } @@ -43,7 +43,7 @@ public abstract class MixinLivingEntity extends Entity { @Redirect(method = "applyMovementInput", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;jumping:Z")) private boolean disableJumpOnLadder(LivingEntity self) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return false; } @@ -54,7 +54,7 @@ public abstract class MixinLivingEntity extends Entity { slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;DOLPHINS_GRACE:Lnet/minecraft/entity/effect/StatusEffect;")), at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;horizontalCollision:Z", ordinal = 0)) private boolean disableClimbing(LivingEntity self) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return false; } @@ -63,7 +63,7 @@ public abstract class MixinLivingEntity extends Entity { @ModifyVariable(method = "applyFluidMovingSpeed", ordinal = 0, at = @At("HEAD"), argsOnly = true) private boolean modifyMovingDown(boolean movingDown) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return true; } @@ -74,14 +74,14 @@ public abstract class MixinLivingEntity extends Entity { slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;LEVITATION:Lnet/minecraft/entity/effect/StatusEffect;", ordinal = 0)), at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;onLanding()V", ordinal = 0)) private void dontResetLevitationFallDistance(LivingEntity instance) { - if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) { instance.onLanding(); } } @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSprinting()Z", ordinal = 0)) private boolean modifySwimSprintSpeed(LivingEntity self) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return false; } return self.isSprinting(); @@ -89,7 +89,7 @@ public abstract class MixinLivingEntity extends Entity { @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getFluidHeight(Lnet/minecraft/registry/tag/TagKey;)D")) private double redirectFluidHeight(LivingEntity instance, TagKey tagKey) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && tagKey == FluidTags.WATER) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && tagKey == FluidTags.WATER) { if (instance.getFluidHeight(tagKey) > 0) { return 1; } @@ -99,14 +99,14 @@ public abstract class MixinLivingEntity extends Entity { @Inject(method = "applyFluidMovingSpeed", at = @At("HEAD"), cancellable = true) private void modifySwimSprintFallSpeed(double gravity, boolean movingDown, Vec3d velocity, CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && !hasNoGravity()) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && !hasNoGravity()) { ci.setReturnValue(new Vec3d(velocity.x, velocity.y - 0.02, velocity.z)); } } @ModifyConstant(method = "tickMovement", constant = @Constant(doubleValue = 0.003D)) public double modifyVelocityZero(final double constant) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return 0.005D; } return constant; @@ -114,14 +114,14 @@ public abstract class MixinLivingEntity extends Entity { @Inject(method = "canEnterTrapdoor", at = @At("HEAD"), cancellable = true) private void onCanEnterTrapdoor(CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.setReturnValue(false); } } @ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.9F)) private float changeEntitySpeed(float constant) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { //noinspection ConstantConditions if ((Entity) this instanceof SkeletonHorseEntity) { return this.getBaseMovementSpeedMultiplier(); // 0.96F @@ -133,7 +133,7 @@ public abstract class MixinLivingEntity extends Entity { @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Ljava/lang/Math;cos(D)D")) public double fixCosTable(double a) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { return MathHelper.cos((float) a); } return Math.cos(a); @@ -143,7 +143,7 @@ public abstract class MixinLivingEntity extends Entity { public double fixLavaMovement(LivingEntity instance, TagKey tagKey) { double height = instance.getFluidHeight(tagKey); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { height += getSwimHeight() + 4; } return height; @@ -151,7 +151,7 @@ public abstract class MixinLivingEntity extends Entity { @ModifyConstant(method = "isBlocking", constant = @Constant(intValue = 5)) public int shieldBlockCounter(int constant) { - if(ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if(ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return 0; } return constant; @@ -159,7 +159,7 @@ public abstract class MixinLivingEntity extends Entity { @Redirect(method = "tickCramming", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isClient()Z")) public boolean revertOnlyPlayerCramming(World instance) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { return false; } return instance.isClient(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinOtherClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinOtherClientPlayerEntity.java index 284a9ae4..3ed10c90 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinOtherClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinOtherClientPlayerEntity.java @@ -20,7 +20,7 @@ public class MixinOtherClientPlayerEntity extends AbstractClientPlayerEntity { @Inject(method = "updatePose", at = @At("HEAD")) public void injectUpdatePose(CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { super.updatePose(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPiglinEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPiglinEntity.java index 94e23f94..bf3f2184 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPiglinEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPiglinEntity.java @@ -18,7 +18,7 @@ public abstract class MixinPiglinEntity { @Inject(method = "getActiveEyeHeight", at = @At("HEAD"), cancellable = true) public void changeEyeHeight(EntityPose pose, EntityDimensions dimensions, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { cir.setReturnValue(this.isBaby() ? 0.93F : 1.74F); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPlayerEntity.java index e460e020..88af00fc 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPlayerEntity.java @@ -33,7 +33,7 @@ public abstract class MixinPlayerEntity extends LivingEntity { @Inject(method = "updatePose", at = @At("HEAD"), cancellable = true) private void onUpdatePose(CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { EntityPose pose; if (isFallFlying()) @@ -57,9 +57,9 @@ public abstract class MixinPlayerEntity extends LivingEntity { @Inject(method = "getDimensions", at = @At("HEAD"), cancellable = true) private void onGetDimensions(EntityPose pose, CallbackInfoReturnable ci) { if (pose == EntityPose.CROUCHING) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.setReturnValue(PlayerEntity.STANDING_DIMENSIONS); - } else if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + } else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { ci.setReturnValue(protocolhack_SNEAKING_DIMENSIONS_1_13_2); } } @@ -67,7 +67,7 @@ public abstract class MixinPlayerEntity extends LivingEntity { @ModifyConstant(method = "getActiveEyeHeight", constant = @Constant(floatValue = 1.27f)) private float modifySneakEyeHeight(float prevEyeHeight) { - if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_19_1)) { return prevEyeHeight; } else { return 1.54f; @@ -76,7 +76,7 @@ public abstract class MixinPlayerEntity extends LivingEntity { @Inject(method = "getAttackCooldownProgress", at = @At("HEAD"), cancellable = true) private void injectGetAttackCooldownProgress(CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.setReturnValue(1f); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinSquidEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinSquidEntity.java index 286cdf59..72afd3f2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinSquidEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinSquidEntity.java @@ -14,7 +14,7 @@ public class MixinSquidEntity { @Inject(method = "canBeLeashedBy", at = @At("HEAD"), cancellable = true) public void injectCanBeLeashedBy(PlayerEntity player, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(false); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinVexEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinVexEntity.java index 9d66bff1..916e07db 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinVexEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinVexEntity.java @@ -20,7 +20,7 @@ public class MixinVexEntity extends HostileEntity { @Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true) public void changeHeightOffset(CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { cir.setReturnValue(0.0); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinWolfEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinWolfEntity.java index 612b9b4c..61c633de 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinWolfEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinWolfEntity.java @@ -17,7 +17,7 @@ public class MixinWolfEntity { @Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;getHealth()F")) public float rewriteHealth(WolfEntity instance) { float health = instance.getHealth(); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { return MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get().get(Meta18Storage.class).getHealthDataMap().getOrDefault(instance.getId(), health); } return health; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboard.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboard.java index 502ea91f..40975c46 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboard.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboard.java @@ -26,7 +26,7 @@ public class MixinKeyboard { @Redirect(method = "processF3", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendCommand(Ljava/lang/String;)Z", ordinal = 0)) public boolean replaceSpectatorCommand(ClientPlayNetworkHandler instance, String command) { - if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { return false; } return instance.sendCommand(command); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboardInput.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboardInput.java index 15fe29ad..0db2b62c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboardInput.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboardInput.java @@ -14,9 +14,9 @@ public class MixinKeyboardInput extends Input { @ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true) private boolean injectTick(boolean slowDown) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return this.sneaking; - } else if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + } else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { return !MinecraftClient.getInstance().player.isSpectator() && (this.sneaking || slowDown); } return slowDown; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinAxeItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinAxeItem.java index 1335dbdf..2b2f1945 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinAxeItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinAxeItem.java @@ -15,7 +15,7 @@ public class MixinAxeItem { @Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true) public void injectUseOnBlock(ItemUsageContext context, CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(ActionResult.PASS); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinBlockItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinBlockItem.java index 81276ac9..e19e63bc 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinBlockItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinBlockItem.java @@ -23,7 +23,7 @@ public class MixinBlockItem { @Inject(method = "canPlace", at = @At("HEAD"), cancellable = true) private void injectCanPlace(ItemPlacementContext context, BlockState state, CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { Block block = state.getBlock(); if (block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST) { World world = context.getWorld(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinEnderPearlItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinEnderPearlItem.java index 6dbfc26c..fa71fa1c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinEnderPearlItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinEnderPearlItem.java @@ -18,7 +18,7 @@ public class MixinEnderPearlItem { @Inject(method = "use", at = @At("HEAD"), cancellable = true) private void injectUse(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable> ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && user.getAbilities().creativeMode) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && user.getAbilities().creativeMode) { ci.setReturnValue(TypedActionResult.pass(user.getStackInHand(hand))); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinFireworkRocketItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinFireworkRocketItem.java index 7cc79ecc..10ba3522 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinFireworkRocketItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinFireworkRocketItem.java @@ -13,7 +13,7 @@ public class MixinFireworkRocketItem { @Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isFallFlying()Z", ordinal = 0)) private boolean disableFireworkElytraBoost(PlayerEntity player) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11)) { return false; } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinHeldItemRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinHeldItemRenderer.java index 3f381e36..0d47b5ed 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinHeldItemRenderer.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinHeldItemRenderer.java @@ -31,7 +31,7 @@ public class MixinHeldItemRenderer { at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { //noinspection DataFlowIssue - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && client.player.isBlocking()) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && client.player.isBlocking()) { matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-102.25f)); matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(13.365f)); matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(78.05f)); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinHoeItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinHoeItem.java index ecf060d4..b85f88b2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinHoeItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinHoeItem.java @@ -43,7 +43,7 @@ public abstract class MixinHoeItem extends MiningToolItem { @Override public boolean isSuitableFor(BlockState state) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return false; } @@ -52,10 +52,10 @@ public abstract class MixinHoeItem extends MiningToolItem { @Override public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { return 1.0F; } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return protocolhack_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F; } return super.getMiningSpeedMultiplier(stack, state); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroups.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroups.java index 52b6273c..2599422f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroups.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroups.java @@ -23,12 +23,12 @@ public class MixinItemGroups { @Redirect(method = "displayParametersMatch", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/featuretoggle/FeatureSet;equals(Ljava/lang/Object;)Z")) private static boolean adjustLastVersionMatchCheck(FeatureSet instance, Object o) { - return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getTargetVersion() && viafabricplus_state == GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue(); + return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getClassWrapper().getTargetVersion() && viafabricplus_state == GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue(); } @Inject(method = "updateDisplayParameters", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroups;updateEntries(Lnet/minecraft/resource/featuretoggle/FeatureSet;Z)V", shift = At.Shift.BEFORE)) private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, CallbackInfoReturnable cir) { - viafabricplus_version = ViaLoadingBase.getTargetVersion(); + viafabricplus_version = ViaLoadingBase.getClassWrapper().getTargetVersion(); viafabricplus_state = GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemPlacementContext.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemPlacementContext.java index 0aca5130..37ed4122 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemPlacementContext.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemPlacementContext.java @@ -20,9 +20,9 @@ public class MixinItemPlacementContext { final ItemPlacementContext self = (ItemPlacementContext) (Object) this; final PlayerEntity player = self.getPlayer(); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && player != null) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && player != null) { final BlockPos placementPos = self.getBlockPos(); - final double blockPosCenterFactor = ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_10) ? 0.5 : 0; + final double blockPosCenterFactor = ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_10) ? 0.5 : 0; if (Math.abs(player.getX() - (placementPos.getX() + blockPosCenterFactor)) < 2 && Math.abs(player.getZ() - (placementPos.getZ() + blockPosCenterFactor)) < 2) { final double eyeY = player.getY() + player.getEyeHeight(player.getPose()); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemStack.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemStack.java index dffe06e9..3434331a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemStack.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemStack.java @@ -28,7 +28,7 @@ public abstract class MixinItemStack { private void modifyMiningSpeedMultiplier(BlockState state, CallbackInfoReturnable ci) { final Item toolItem = ((ItemStack) (Object) this).getItem(); - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && toolItem instanceof HoeItem) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && toolItem instanceof HoeItem) { ci.setReturnValue(1F); } } @@ -37,7 +37,7 @@ public abstract class MixinItemStack { slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/attribute/EntityAttributes;GENERIC_ATTACK_DAMAGE:Lnet/minecraft/entity/attribute/EntityAttribute;", ordinal = 0)), at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getAttributeBaseValue(Lnet/minecraft/entity/attribute/EntityAttribute;)D", ordinal = 0)) private double redirectGetTooltip(PlayerEntity player, EntityAttribute attribute) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return 0; } else { return player.getAttributeBaseValue(attribute); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinMiningToolItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinMiningToolItem.java index a2880614..081d62a4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinMiningToolItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinMiningToolItem.java @@ -17,7 +17,7 @@ public class MixinMiningToolItem { @Inject(method = "getMiningSpeedMultiplier", at = @At("RETURN"), cancellable = true) public void changeHoeEffectiveBlocks(ItemStack stack, BlockState state, CallbackInfoReturnable cir) { //noinspection ConstantValue - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && (Object) this instanceof HoeItem) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && (Object) this instanceof HoeItem) { cir.setReturnValue(1.0F); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinPickaxeItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinPickaxeItem.java index 483f9388..d9b1fb29 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinPickaxeItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinPickaxeItem.java @@ -35,7 +35,7 @@ public abstract class MixinPickaxeItem extends MiningToolItem { @Override public boolean isSuitableFor(BlockState state) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { Block block = state.getBlock(); int i = this.getMaterial().getMiningLevel(); if (block == Blocks.OBSIDIAN) { @@ -53,9 +53,9 @@ public abstract class MixinPickaxeItem extends MiningToolItem { @Override public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || protocolhack_EFFECTIVE_BLOCKS_1152.contains(state.getBlock()) ? this.miningSpeed : 1.0F; - } else if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + } else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || protocolhack_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F; } return super.getMiningSpeedMultiplier(stack, state); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinShovelItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinShovelItem.java index 9084cc87..2973db68 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinShovelItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinShovelItem.java @@ -17,7 +17,7 @@ public class MixinShovelItem { at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;", ordinal = 0), slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/item/ShovelItem;PATH_STATES:Ljava/util/Map;"))) private Object redirectUseOnBlock(Map map, Object grassBlock) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return null; } else { return map.get(grassBlock); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinSwordItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinSwordItem.java index 3ab3bd85..6cec9f63 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinSwordItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinSwordItem.java @@ -23,7 +23,7 @@ public class MixinSwordItem extends ToolItem { @Override public TypedActionResult use(World world, PlayerEntity user, Hand hand) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { ItemStack itemStack = user.getStackInHand(hand); user.setCurrentHand(hand); return TypedActionResult.consume(itemStack); @@ -33,7 +33,7 @@ public class MixinSwordItem extends ToolItem { @Override public UseAction getUseAction(ItemStack stack) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return UseAction.BLOCK; } return super.getUseAction(stack); @@ -41,7 +41,7 @@ public class MixinSwordItem extends ToolItem { @Override public int getMaxUseTime(ItemStack stack) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { return 72000; } return super.getMaxUseTime(stack); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/packet/MixinPacketByteBuf.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/packet/MixinPacketByteBuf.java index fc5b376b..1e556995 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/packet/MixinPacketByteBuf.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/packet/MixinPacketByteBuf.java @@ -14,7 +14,7 @@ public class MixinPacketByteBuf { @Inject(method = "readText", at = @At(value = "INVOKE", target = "Lio/netty/handler/codec/DecoderException;(Ljava/lang/String;)V", shift = At.Shift.BEFORE, remap = false), cancellable = true) public void injectReadText(CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18)) { cir.setReturnValue(null); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/packet/MixinUpdatePlayerAbilitiesC2SPacket.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/packet/MixinUpdatePlayerAbilitiesC2SPacket.java index 13925ef4..b76806a3 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/packet/MixinUpdatePlayerAbilitiesC2SPacket.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/packet/MixinUpdatePlayerAbilitiesC2SPacket.java @@ -27,7 +27,7 @@ public class MixinUpdatePlayerAbilitiesC2SPacket { byte b = 0; - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (this.flying) b = (byte) (b | 2); // Minecraft if (abilities.invulnerable) b |= 1; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinConnectScreen_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinConnectScreen_1.java index badb427e..3f5654b8 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinConnectScreen_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinConnectScreen_1.java @@ -38,14 +38,14 @@ public class MixinConnectScreen_1 { @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getHostName()Ljava/lang/String;", ordinal = 1)) public String replaceAddress(InetSocketAddress instance) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) return field_33737.getAddress(); + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) return field_33737.getAddress(); return instance.getHostString(); } @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getPort()I")) public int replacePort(InetSocketAddress instance) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) return field_33737.getPort(); + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) return field_33737.getPort(); return instance.getPort(); } @@ -59,11 +59,11 @@ public class MixinConnectScreen_1 { return; } - if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_19)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_19)) { return; // This disables the chat session emulation for all versions <= 1.18.2 } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { try { final PlayerKeyPair playerKeyPair = MinecraftClient.getInstance().getProfileKeys().fetchKeyPair().get().orElse(null); if (playerKeyPair != null) { @@ -72,7 +72,7 @@ public class MixinConnectScreen_1 { userConnection.put(new ChatSession1_19_2(userConnection, profileKey, playerKeyPair.privateKey())); - if (ViaLoadingBase.getTargetVersion() == ProtocolVersion.v1_19) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion() == ProtocolVersion.v1_19) { final byte[] legacyKey = ((IPublicKeyData) (Object) publicKeyData).viafabricplus_get1_19_0Key().array(); if (legacyKey != null) { userConnection.put(new ChatSession1_19_0(userConnection, profileKey, playerKeyPair.privateKey(), legacyKey)); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinDownloadingTerrainScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinDownloadingTerrainScreen.java index a407602c..39420933 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinDownloadingTerrainScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinDownloadingTerrainScreen.java @@ -31,14 +31,14 @@ public class MixinDownloadingTerrainScreen extends Screen { @Inject(method = "tick", at = @At("HEAD"), cancellable = true) public void injectTick(CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_1)) { protocolhack_tickCounter++; if (protocolhack_tickCounter % 20 == 0) { MinecraftClient.getInstance().getNetworkHandler().sendPacket(new KeepAliveC2SPacket(0)); } } - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { final boolean isTimeOver = this.closeOnNextTick || System.currentTimeMillis() > this.loadStartTime + 2000L; if (isTimeOver && this.client != null && this.client.player != null) { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinGameModeSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinGameModeSelectionScreen.java index 1bd8e92f..f768f3e0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinGameModeSelectionScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinGameModeSelectionScreen.java @@ -24,10 +24,10 @@ public class MixinGameModeSelectionScreen { @Inject(method = "", at = @At("RETURN")) public void fixUIWidth(CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { final List gameModeSelections = Arrays.stream(GameModeSelectionScreen.GameModeSelection.values()).toList(); - if (ViaLoadingBase.getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_3_1tor1_3_2)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE); - if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR); + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_3_1tor1_3_2)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE); + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR); protocolhack_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new); UI_WIDTH = protocolhack_unwrappedGameModes.length * 31 - 5; @@ -36,7 +36,7 @@ public class MixinGameModeSelectionScreen { @Redirect(method = "init", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;VALUES:[Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;")) public GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() { - if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { return protocolhack_unwrappedGameModes; } return GameModeSelectionScreen.GameModeSelection.values(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinGameModeSelectionScreen_GameModeSelection.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinGameModeSelectionScreen_GameModeSelection.java index 354574db..9c129ecb 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinGameModeSelectionScreen_GameModeSelection.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinGameModeSelectionScreen_GameModeSelection.java @@ -24,7 +24,7 @@ public class MixinGameModeSelectionScreen_GameModeSelection { @Inject(method = "getCommand", at = @At("HEAD"), cancellable = true) private void oldCommand(CallbackInfoReturnable cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { cir.setReturnValue( "gamemode " + MinecraftClient.getInstance().getSession().getUsername() + ' ' + switch (((Enum)(Object)this).ordinal()) { case 0, 3 -> 1; @@ -37,11 +37,11 @@ public class MixinGameModeSelectionScreen_GameModeSelection { @Inject(method = "next", at = @At("HEAD"), cancellable = true) public void unwrapGameModes(CallbackInfoReturnable> cir) { - if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { switch ((GameModeSelectionScreen.GameModeSelection)(Object)this) { case CREATIVE -> cir.setReturnValue(Optional.of(SURVIVAL)); case SURVIVAL -> { - if (ViaLoadingBase.getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_2_4tor1_2_5)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_2_4tor1_2_5)) { cir.setReturnValue(Optional.of(CREATIVE)); } else { cir.setReturnValue(Optional.of(GameModeSelectionScreen.GameModeSelection.ADVENTURE)); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinStructureBlockScreen_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinStructureBlockScreen_1.java index 9e5f9a6b..93c6edbf 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinStructureBlockScreen_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinStructureBlockScreen_1.java @@ -19,6 +19,6 @@ public class MixinStructureBlockScreen_1 extends TextFieldWidget { @Inject(method = "charTyped(CI)Z", at = @At("HEAD"), cancellable = true) private void onCharTyped(char chr, int keyCode, CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) ci.setReturnValue(super.charTyped(chr, keyCode)); + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) ci.setReturnValue(super.charTyped(chr, keyCode)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/hud/MixinBossBarHud_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/hud/MixinBossBarHud_1.java index a2d91fdf..a27509ab 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/hud/MixinBossBarHud_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/hud/MixinBossBarHud_1.java @@ -12,7 +12,7 @@ public class MixinBossBarHud_1 { @Redirect(method = "updateProgress", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ClientBossBar;setPercent(F)V")) public void nullSafety(ClientBossBar instance, float percent) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (instance != null) instance.setPercent(percent); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/merchant/MixinMerchantScreenHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/merchant/MixinMerchantScreenHandler.java index 450f3eb9..6ca23ee6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/merchant/MixinMerchantScreenHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/merchant/MixinMerchantScreenHandler.java @@ -13,7 +13,7 @@ public class MixinMerchantScreenHandler { @Inject(method = "switchTo", at = @At("HEAD"), cancellable = true) private void injectSwitchTo(int recipeId, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { ci.cancel(); // no lmao? } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinBrewingStandScreenHandler_FuelSlot.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinBrewingStandScreenHandler_FuelSlot.java index bc30c723..43f243be 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinBrewingStandScreenHandler_FuelSlot.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinBrewingStandScreenHandler_FuelSlot.java @@ -18,12 +18,12 @@ public class MixinBrewingStandScreenHandler_FuelSlot extends Slot { @Inject(method = "matches(Lnet/minecraft/item/ItemStack;)Z", at = @At("HEAD"), cancellable = true) private static void removeFuelSlot(CallbackInfoReturnable ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) ci.setReturnValue(false); } @Override public boolean isEnabled() { - return ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_8); + return ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_8); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinPlayerScreenHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinPlayerScreenHandler.java index aa98b2ca..85bb29bf 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinPlayerScreenHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinPlayerScreenHandler.java @@ -25,7 +25,7 @@ public abstract class MixinPlayerScreenHandler extends AbstractRecipeScreenHandl slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler$2;(Lnet/minecraft/screen/PlayerScreenHandler;Lnet/minecraft/inventory/Inventory;III)V")), at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler;addSlot(Lnet/minecraft/screen/slot/Slot;)Lnet/minecraft/screen/slot/Slot;", ordinal = 0)) private Slot redirectAddOffhandSlot(PlayerScreenHandler screenHandler, Slot slot) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) return null; return addSlot(slot); } @@ -33,7 +33,7 @@ public abstract class MixinPlayerScreenHandler extends AbstractRecipeScreenHandl @SuppressWarnings("InvalidInjectorMethodSignature") @ModifyVariable(method = "quickMove", ordinal = 0, at = @At(value = "STORE", ordinal = 0)) private EquipmentSlot injectTransferSlot(EquipmentSlot slot) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && slot == EquipmentSlot.OFFHAND) + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && slot == EquipmentSlot.OFFHAND) return EquipmentSlot.MAINHAND; else return slot; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinScreenHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinScreenHandler.java index a267ea54..c70b5264 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinScreenHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/screenhandler/MixinScreenHandler.java @@ -20,7 +20,7 @@ public class MixinScreenHandler implements IScreenHandler { @Inject(method = "internalOnSlotClick", at = @At("HEAD"), cancellable = true) private void injectInternalOnSlotClick(int slot, int clickData, SlotActionType actionType, PlayerEntity player, CallbackInfo ci) { - if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && actionType == SlotActionType.SWAP && clickData == 40) { + if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && actionType == SlotActionType.SWAP && clickData == 40) { ci.cancel(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinCustomViaConfig.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinVLBViaConfig.java similarity index 61% rename from src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinCustomViaConfig.java rename to src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinVLBViaConfig.java index dfe40b24..52628846 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinCustomViaConfig.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinVLBViaConfig.java @@ -1,15 +1,15 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.vialoadingbase; import com.viaversion.viaversion.configuration.AbstractViaConfig; -import de.florianmichael.vialoadingbase.defaults.viaversion.CustomViaConfig; +import de.florianmichael.vialoadingbase.defaults.viaversion.VLBViaConfig; import org.spongepowered.asm.mixin.Mixin; import java.io.File; -@Mixin(value = CustomViaConfig.class, remap = false) -public abstract class MixinCustomViaConfig extends AbstractViaConfig { +@Mixin(value = VLBViaConfig.class, remap = false) +public abstract class MixinVLBViaConfig extends AbstractViaConfig { - protected MixinCustomViaConfig(File configFile) { + protected MixinVLBViaConfig(File configFile) { super(configFile); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinAbstractFenceConnectionHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinAbstractFenceConnectionHandler.java index f2f5236a..0c9fcf34 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinAbstractFenceConnectionHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinAbstractFenceConnectionHandler.java @@ -24,7 +24,7 @@ public abstract class MixinAbstractFenceConnectionHandler { @Overwrite public byte getStates(UserConnection user, Position position, int blockState) { byte states = 0; - boolean pre1_12 = ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_12); + boolean pre1_12 = ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_12); if (connects(BlockFace.EAST, getBlockData(user, position.getRelative(BlockFace.EAST)), pre1_12)) states |= 1; if (connects(BlockFace.NORTH, getBlockData(user, position.getRelative(BlockFace.NORTH)), pre1_12)) states |= 2; if (connects(BlockFace.SOUTH, getBlockData(user, position.getRelative(BlockFace.SOUTH)), pre1_12)) states |= 4; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinGlassConnectionHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinGlassConnectionHandler.java index 66d17267..8d945ae2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinGlassConnectionHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinGlassConnectionHandler.java @@ -27,6 +27,6 @@ public abstract class MixinGlassConnectionHandler extends AbstractFenceConnectio if (states != 0) return states; ProtocolInfo protocolInfo = user.getProtocolInfo(); - return ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolInfo.getServerProtocolVersion() != -1 ? 0xF : states; + return ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolInfo.getServerProtocolVersion() != -1 ? 0xF : states; } } diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/ProtocolSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/ProtocolSelectionScreen.java index a9c4e70c..ff8aa81a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/ProtocolSelectionScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/ProtocolSelectionScreen.java @@ -83,7 +83,7 @@ public class ProtocolSelectionScreen extends Screen { @Override public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { - final boolean isSelected = ViaLoadingBase.getTargetVersion().getVersion() == protocolVersion.getVersion(); + final boolean isSelected = ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion() == protocolVersion.getVersion(); matrices.push(); matrices.translate(x, y - 1, 0); diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/impl/ProtocolSyncBooleanSetting.java b/src/main/java/de/florianmichael/viafabricplus/settings/impl/ProtocolSyncBooleanSetting.java index b8a65b14..eaffba8f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/settings/impl/ProtocolSyncBooleanSetting.java +++ b/src/main/java/de/florianmichael/viafabricplus/settings/impl/ProtocolSyncBooleanSetting.java @@ -29,7 +29,7 @@ public class ProtocolSyncBooleanSetting extends BooleanSetting { @Override public Boolean getValue() { - if (GeneralSettings.getClassWrapper().automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) return this.getProtocolRange().contains(ViaLoadingBase.getTargetVersion()); + if (GeneralSettings.getClassWrapper().automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) return this.getProtocolRange().contains(ViaLoadingBase.getClassWrapper().getTargetVersion()); return super.getValue(); } diff --git a/src/main/java/de/florianmichael/viafabricplus/util/SettingsSave.java b/src/main/java/de/florianmichael/viafabricplus/util/SettingsSave.java index 2c19c58c..882553fa 100644 --- a/src/main/java/de/florianmichael/viafabricplus/util/SettingsSave.java +++ b/src/main/java/de/florianmichael/viafabricplus/util/SettingsSave.java @@ -35,7 +35,7 @@ public class SettingsSave { try (final FileWriter fw = new FileWriter(CONFIG_FILE)) { final JsonObject parentNode = new JsonObject(); - parentNode.addProperty("protocol", ViaLoadingBase.getTargetVersion().getVersion()); + parentNode.addProperty("protocol", ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion()); for (SettingGroup group : viaFabricPlus.getSettingGroups()) { for (AbstractSetting setting : group.getSettings()) { setting.write(parentNode); diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index 4f08cbfd..0e6dbc20 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -98,7 +98,7 @@ "fixes.viaaprilfools.MixinProtocol1_16to20w14infinite", "fixes.vialegacy.MixinExtensionProtocolMetadataStorage", "fixes.vialegacy.MixinProtocol1_8to1_7_6_10", - "fixes.vialoadingbase.MixinCustomViaConfig", + "fixes.vialoadingbase.MixinVLBViaConfig", "fixes.viaversion.MixinCommonBoss", "fixes.viaversion.MixinPacketWrapperImpl", "fixes.viaversion.MixinProtocolVersion",