diff --git a/build.gradle b/build.gradle index 1094efa..353a7eb 100644 --- a/build.gradle +++ b/build.gradle @@ -65,7 +65,7 @@ dependencies { modImplementation("net.fabricmc:fabric-loader:${project.loader_version}") modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}") - modImplementation("top.hendrixshen.magiclib:magiclib-1_20_1:${project.magiclib_version}") { + modImplementation("top.hendrixshen.magiclib:magiclib-${project.minecraft_version.replace(".", "_")}:${project.magiclib_version}") { exclude(group: "carpet", module: "fabric-carpet") } diff --git a/src/main/java/top/infsky/cheatdetector/impl/utils/packet/PacketUtils.java b/src/main/java/top/infsky/cheatdetector/impl/utils/packet/PacketUtils.java index 93cc47d..97fca90 100644 --- a/src/main/java/top/infsky/cheatdetector/impl/utils/packet/PacketUtils.java +++ b/src/main/java/top/infsky/cheatdetector/impl/utils/packet/PacketUtils.java @@ -1,6 +1,7 @@ package top.infsky.cheatdetector.impl.utils.packet; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.common.*; import net.minecraft.network.protocol.game.*; import top.hendrixshen.magiclib.impl.carpet.MagicLibSettings; diff --git a/src/main/java/top/infsky/cheatdetector/impl/utils/world/EntityUtils.java b/src/main/java/top/infsky/cheatdetector/impl/utils/world/EntityUtils.java index 3999bf1..1c9cf6d 100644 --- a/src/main/java/top/infsky/cheatdetector/impl/utils/world/EntityUtils.java +++ b/src/main/java/top/infsky/cheatdetector/impl/utils/world/EntityUtils.java @@ -21,7 +21,7 @@ public static AttributeMap getAttributes(LivingEntity entity) { // Status effects for (var statusEffect : entity.getActiveEffectsMap().values()) { - statusEffect.getEffect().addAttributeModifiers(entity, attributes, statusEffect.getAmplifier()); + statusEffect.getEffect().addAttributeModifiers(attributes, statusEffect.getAmplifier()); } return attributes; diff --git a/src/main/java/top/infsky/cheatdetector/impl/utils/world/FakePlayer.java b/src/main/java/top/infsky/cheatdetector/impl/utils/world/FakePlayer.java index 0836917..be09f71 100644 --- a/src/main/java/top/infsky/cheatdetector/impl/utils/world/FakePlayer.java +++ b/src/main/java/top/infsky/cheatdetector/impl/utils/world/FakePlayer.java @@ -52,7 +52,7 @@ public FakePlayer(Player player) { public void show() { if (!isRemoved) return; - LevelUtils.getClientLevel().addPlayer(getId(), this); + LevelUtils.getClientLevel().addEntity(this); isRemoved = false; } diff --git a/src/main/java/top/infsky/cheatdetector/impl/utils/world/PlayerRotation.java b/src/main/java/top/infsky/cheatdetector/impl/utils/world/PlayerRotation.java index 74a95ce..1932f18 100644 --- a/src/main/java/top/infsky/cheatdetector/impl/utils/world/PlayerRotation.java +++ b/src/main/java/top/infsky/cheatdetector/impl/utils/world/PlayerRotation.java @@ -45,7 +45,7 @@ public static double getPitch(@NotNull Vec3 pos) { public static void silentRotate(double yaw, double pitch, boolean onGround) { Connection connection = Objects.requireNonNull(TRPlayer.CLIENT.getConnection()).getConnection(); - ((ConnectionInvoker) connection).sendPacket(new ServerboundMovePlayerPacket.Rot((float) yaw, (float) pitch, onGround), null); + ((ConnectionInvoker) connection).sendPacket(new ServerboundMovePlayerPacket.Rot((float) yaw, (float) pitch, onGround), null, true); } public static void rotate(double yaw, double pitch) { @@ -67,7 +67,7 @@ public static boolean cancelRotationPacket(@NotNull ServerboundMovePlayerPacket if (packet.hasPosition()) { // PosRot if (connection != null) ((ConnectionInvoker) connection).sendPacket( - new ServerboundMovePlayerPacket.Pos(packet.getX(0), packet.getY(0), packet.getZ(0), packet.isOnGround()), listener + new ServerboundMovePlayerPacket.Pos(packet.getX(0), packet.getY(0), packet.getZ(0), packet.isOnGround()), listener, true ); } return true; diff --git a/src/main/java/top/infsky/cheatdetector/mixins/ConnectionInvoker.java b/src/main/java/top/infsky/cheatdetector/mixins/ConnectionInvoker.java index 67db2f3..9a1d53d 100644 --- a/src/main/java/top/infsky/cheatdetector/mixins/ConnectionInvoker.java +++ b/src/main/java/top/infsky/cheatdetector/mixins/ConnectionInvoker.java @@ -11,7 +11,7 @@ @Mixin(Connection.class) public interface ConnectionInvoker { @Invoker("sendPacket") - void sendPacket(Packet basePacket, PacketSendListener listener); + void sendPacket(Packet basePacket, PacketSendListener listener, boolean bl); @Invoker("channelRead0") void channelRead0(ChannelHandlerContext channelHandlerContext, Packet packet); }