mirror of
https://github.com/tanyaofei/minecraft-fakeplayer.git
synced 2025-07-13 04:42:24 +08:00
Revert fixing knockback on 1.20.x
This commit is contained in:
parent
1e1cf79513
commit
3d70e2e3c4
@ -6,7 +6,6 @@ import io.github.hello09x.fakeplayer.core.manager.FakeplayerManager;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
@ -35,21 +34,9 @@ public class FakeServerGamePacketListenerImpl extends ServerGamePacketListenerIm
|
||||
@Override
|
||||
public void send(Packet<?> packet) {
|
||||
if (packet instanceof ClientboundCustomPayloadPacket p) {
|
||||
// 接收到自定义的数据包,由于假人没有连接导致 BungeeCord 的插件消息无法正确通过 Proxy 发送
|
||||
// 因此将该数据包通过真实的玩家重新发送一份
|
||||
this.handleCustomPayloadPacket(p);
|
||||
} else if (packet instanceof ClientboundSetEntityMotionPacket p) {
|
||||
this.handleClientboundSetEntityMotionPacket(p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家被击退的动作由客户端完成, 假人没有客户端因此手动完成这个动作
|
||||
*/
|
||||
public void handleClientboundSetEntityMotionPacket(@NotNull ClientboundSetEntityMotionPacket packet) {
|
||||
if (packet.getId() == this.player.getId() && this.player.hurtMarked) {
|
||||
Bukkit.getScheduler().runTask(Main.getInstance(), () -> {
|
||||
this.player.hurtMarked = true;
|
||||
this.player.lerpMotion(packet.getXa(), packet.getYa(), packet.getZa());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.CommonListenerCookie;
|
||||
@ -40,20 +39,6 @@ public class FakeServerGamePacketListenerImpl extends ServerGamePacketListenerIm
|
||||
public void send(Packet<?> packet) {
|
||||
if (packet instanceof ClientboundCustomPayloadPacket p) {
|
||||
this.handleCustomPayloadPacket(p.payload());
|
||||
} else if (packet instanceof ClientboundSetEntityMotionPacket p) {
|
||||
this.handleClientboundSetEntityMotionPacket(p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家被击退的动作由客户端完成, 假人没有客户端因此手动完成这个动作
|
||||
*/
|
||||
public void handleClientboundSetEntityMotionPacket(@NotNull ClientboundSetEntityMotionPacket packet) {
|
||||
if (packet.getId() == this.player.getId() && this.player.hurtMarked) {
|
||||
Bukkit.getScheduler().runTask(Main.getInstance(), () -> {
|
||||
this.player.hurtMarked = true;
|
||||
this.player.lerpMotion(packet.getXa(), packet.getYa(), packet.getZa());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.CommonListenerCookie;
|
||||
@ -36,24 +35,10 @@ public class FakeServerGamePacketListenerImpl extends ServerGamePacketListenerIm
|
||||
.ifPresent(p -> p.addChannel(BUNGEE_CORD_CORRECTED_CHANNEL));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void send(Packet<?> packet) {
|
||||
if (packet instanceof ClientboundCustomPayloadPacket p) {
|
||||
this.handleCustomPayloadPacket(p.payload());
|
||||
} else if (packet instanceof ClientboundSetEntityMotionPacket p) {
|
||||
this.handleClientboundSetEntityMotionPacket(p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家被击退的动作由客户端完成, 假人没有客户端因此手动完成这个动作
|
||||
*/
|
||||
public void handleClientboundSetEntityMotionPacket(@NotNull ClientboundSetEntityMotionPacket packet) {
|
||||
if (packet.getId() == this.player.getId() && this.player.hurtMarked) {
|
||||
Bukkit.getScheduler().runTask(Main.getInstance(), () -> {
|
||||
this.player.hurtMarked = true;
|
||||
this.player.lerpMotion(packet.getXa(), packet.getYa(), packet.getZa());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
|
||||
import net.minecraft.network.protocol.common.custom.DiscardedPayload;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.CommonListenerCookie;
|
||||
@ -36,24 +35,10 @@ public class FakeServerGamePacketListenerImpl extends ServerGamePacketListenerIm
|
||||
.ifPresent(p -> p.addChannel(BUNGEE_CORD_CORRECTED_CHANNEL));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void send(Packet<?> packet) {
|
||||
if (packet instanceof ClientboundCustomPayloadPacket p) {
|
||||
this.handleCustomPayloadPacket(p);
|
||||
} else if (packet instanceof ClientboundSetEntityMotionPacket p) {
|
||||
this.handleClientboundSetEntityMotionPacket(p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家被击退的动作由客户端完成, 假人没有客户端因此手动完成这个动作
|
||||
*/
|
||||
public void handleClientboundSetEntityMotionPacket(@NotNull ClientboundSetEntityMotionPacket packet) {
|
||||
if (packet.getId() == this.player.getId() && this.player.hurtMarked) {
|
||||
Bukkit.getScheduler().runTask(Main.getInstance(), () -> {
|
||||
this.player.hurtMarked = true;
|
||||
this.player.lerpMotion(packet.getXa(), packet.getYa(), packet.getZa());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user