JuliaBerry / PiCraft.jl

Manipulate Minecraft on the Raspberry Pi from Julia
https://juliaberry.github.io/PiCraft.jl/
Other
38 stars 11 forks source link

Unable to connect to Minecraft #48

Open Kevin-Mattheus-Moerman opened 1 year ago

Kevin-Mattheus-Moerman commented 1 year ago

I get the following when trying to connect to Minecraft when I execute connectToWorld(), can you help troubleshoot this? @aviks @Ellipse0934 Thanks!

ERROR: Unable to connect to the Minecraft World.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] connectToWorld(address::String, port::Int32)
   @ PiCraft ~/.julia/packages/PiCraft/aYw5Z/src/api.jl:34
 [3] connectToWorld()
   @ PiCraft ~/.julia/packages/PiCraft/aYw5Z/src/api.jl:31
 [4] top-level scope
   @ REPL[2]:1

caused by: IOError: connect: connection refused (ECONNREFUSED)
Stacktrace:
 [1] wait_connected(x::Sockets.TCPSocket)
   @ Sockets /buildworker/worker/package_linuxarmv7l/build/usr/share/julia/stdlib/v1.6/Sockets/src/Sockets.jl:532
 [2] connect(::Sockets.TCPSocket, ::String, ::Int32)
   @ Sockets /buildworker/worker/package_linuxarmv7l/build/usr/share/julia/stdlib/v1.6/Sockets/src/Sockets.jl:567
 [3] connect
   @ /buildworker/worker/package_linuxarmv7l/build/usr/share/julia/stdlib/v1.6/Sockets/src/Sockets.jl:552 [inlined]
 [4] connectToWorld(address::String, port::Int32)
   @ PiCraft ~/.julia/packages/PiCraft/aYw5Z/src/api.jl:32
 [5] connectToWorld()
   @ PiCraft ~/.julia/packages/PiCraft/aYw5Z/src/api.jl:31
 [6] top-level scope
   @ REPL[2]:1

I am using a RaspberryPi 4, 8Gb RAM with:

Julia Version 1.6.3 (2021-09-23) Output of cat /etc/os-release:

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Kevin-Mattheus-Moerman commented 1 year ago

Note that I can connect when I use Python, by simply using:

from mcpi.minecraft import Minecraft
mc = Minecraft.create()
Kevin-Mattheus-Moerman commented 1 year ago

@Ellipse0934 @aviks do you have any suggestions? Is this repository still maintained? Thanks

aviks commented 1 year ago

This is basic functionality that does work for me, so I'm not sure what could be up. It's very strange that python connects, which Julia does not. By default, it tires to connect to localhost port 4711. Can you check if minecraft is actually listening on that port on your machine? Can you telnet to that host/port combination? The code is simply running Sockets.connect("localhost", 4711) -- maybe you can run this from the REPL and see what's up?