Fake player portal fix (#1724)
* fake-player-portal-fix: * Fix the teleport fix, so it doesn't crash when bots go through nether portals (Fixes #1712) * fake-player-portal-fix: * Re-implement fix for #1190 * Without causing #1712 * Just move the bot on the chunkmap directly.
This commit is contained in:
1 parent
f75e3d77a2
commit
aeb68e9ba0
3 files changed
+3
-27
No files matched your search
@@ -1,11 +0,0 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(ServerGamePacketListenerImpl.class)
|
||||
public interface ServerGamePacketListenerImplAccessor {
|
||||
@Accessor("awaitingTeleport")
|
||||
public int getAwaitingTeleport();
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
package carpet.patches;
|
||||
|
||||
import carpet.mixins.ServerGamePacketListenerImplAccessor;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ServerboundAcceptTeleportationPacket;
|
||||
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.world.entity.RelativeMovement;
|
||||
@@ -32,23 +29,14 @@ public class NetHandlerPlayServerFake extends ServerGamePacketListenerImpl
|
||||
((EntityPlayerMPFake) player).kill(message);
|
||||
}
|
||||
}
|
||||
private boolean hasSpawned = false;
|
||||
|
||||
@Override
|
||||
public void teleport(double d, double e, double f, float g, float h, Set<RelativeMovement> set)
|
||||
{
|
||||
super.teleport(d, e, f, g, h, set);
|
||||
|
||||
handleAcceptTeleportPacket(
|
||||
new ServerboundAcceptTeleportationPacket( ((ServerGamePacketListenerImplAccessor)this).getAwaitingTeleport() )
|
||||
);
|
||||
|
||||
if (!hasSpawned) {
|
||||
hasSpawned = true;
|
||||
} else {
|
||||
handleMovePlayer(
|
||||
new ServerboundMovePlayerPacket.PosRot(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot(), false)
|
||||
);
|
||||
if (player.serverLevel().getPlayerByUUID(player.getUUID()) != null) {
|
||||
resetPosition();
|
||||
player.serverLevel().getChunkSource().move(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user