PondWader / Mineflayer-Spectator

Spectate your Mineflayer bot in-game.
MIT License
9 stars 1 forks source link

BedrockClient->Geyser->Spectator->JavaServer #2

Open takeru opened 10 months ago

takeru commented 10 months ago

I tried to use bedrock's client, hoping it would work, but it didn't. I get a lot of errors like the one below in the "Geyser" log.

[17:38:23 WARN] Downstream packet error! Invalid packet id: 66
java.lang.IllegalArgumentException: Invalid packet id: 66
    at com.github.steveice10.packetlib.packet.PacketProtocol.createClientboundPacket(PacketProtocol.java:156)
    at com.github.steveice10.mc.protocol.MinecraftProtocol.createClientboundPacket(MinecraftProtocol.java:207)
    at com.github.steveice10.packetlib.tcp.TcpPacketCodec.decode(TcpPacketCodec.java:62)
    at io.netty.handler.codec.ByteToMessageCodec$1.decode(ByteToMessageCodec.java:42)
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
    at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
    at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
    at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.channel.kqueue.AbstractKQueueStreamChannel$KQueueStreamUnsafe.readReady(AbstractKQueueStreamChannel.java:544)
    at io.netty.channel.kqueue.AbstractKQueueChannel$AbstractKQueueUnsafe.readReady(AbstractKQueueChannel.java:383)
    at io.netty.channel.kqueue.KQueueEventLoop.processReady(KQueueEventLoop.java:213)
    at io.netty.channel.kqueue.KQueueEventLoop.run(KQueueEventLoop.java:291)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:1583)

https://github.com/GeyserMC/PacketLib/blob/e21e6c4e86bd9755afaa2dda9fd0f2a52eae7f7e/src/main/java/com/github/steveice10/packetlib/packet/PacketProtocol.java#L156

What should I do?

It didn't work.

------------------------------------------
- Bedrock Client
  - Android/iPhone
  - Connect to mymacbook:19132
    - select from LAN game list

- mymacbook
  - Bedrock-to-Java Proxy
    - Geyser-Standalone.jar
      - config.yml
        - bedrock
          - 0.0.0.0:19132
        - remote
          - 127.0.0.1:25566 (port changed)
          - auth-type: offline

  - Mineflayer-Spectator
    const mineflayer = require('mineflayer')
    const { startSpectatorServer } = require('mineflayer-spectator')

    const bot = mineflayer.createBot({
        host: 'localhost',
        port: 25565,
        username: 'MyBot',
        version: '1.20.1'
    })
    startSpectatorServer(bot, { port: 25566 })

  - Java Server
    - paper-1.20.1
      - 0.0.0.0:25565
      - server.properties
        - online-mode=false
      - plugins
        - ViaVersion.jar v4.8.1
------------------------------------------

It worked. (w/o Mineflayer-Spectator)

------------------------------------------
- Bedrock Client
  - Android/iPhone
  - Connect to mymacbook:19132
    - select from LAN game list

- mymacbook
  - Bedrock-to-Java Proxy
    - Geyser-Standalone.jar
      - config.yml
        - bedrock
          - 0.0.0.0:19132
        - remote
          - 127.0.0.1:25565
          - auth-type: offline

  - Java Server
    - paper-1.20.1
      - 0.0.0.0:25565
      - server.properties
        - online-mode=false
      - plugins
        - ViaVersion.jar v4.8.1
------------------------------------------
PondWader commented 10 months ago

Hi, what version of Java edition is your geyser server setup for?

takeru commented 10 months ago

JavaServer = paper-1.20.1 https://papermc.io/downloads/paper

Ah, Should I try it in VANILLA? https://www.minecraft.net/en-us/download/server