Closed DefinitlyEvil closed 8 years ago
@nickelpro sounds like it wasn't such a good idea to remove that line bf7002f89e349abcb70db871cc9deba51e054b37
@Gjum Thx for rapid respond, so it can be fixed now?
Btw it also says list indicies must be integer
at line 50:
return self.data[x + ((y * 16) + z) * 16]
@DefinitlyEvil if you want it to work right now, convert the position to int yourself before calling the get_block function
@rom1504 I was playing around with example.py. xD And TONs of errors messed me up.
I'm not sure if we will "fix" that, because you are supposed to only supply integer (block) coordinates.
So instead of get_block(floaty_pos)
, it should be get_block(floaty_pos.floor())
.
The examples are quite outdated, see also #188.
@Gjum Okay. ;P Thanks for making this awesome project and thanks for noticing me about that example script. xD
@Gjum Btw I didn't call get_block()
in example.py, it seems that some other script invoked it. xD
I dislike having to do that conversion there. Rightfully if we do it there we should do it for all the get
and set
functions in smpmap.
Really I'd like to just track down everywhere we're passing floats to smpmap, fix them, and then just ban passing floats when you really should pass an integer
I agree. Although the error message can be a bit misleading.
So we're agreed this is not an error in smpmap then. This is a problem with our horribly outdated examples. I'll put it on my "high priority" ToDo list along with vehicle Physics and auth tokens
@nickelpro Thx so much. Muah!
fixed in c09dbfaf85f936dce8ce99e6f99be057e51167b0
This appears to still be an issue...
In offline mode, the bot crashes after joining the game on
TypeError: list indices must be integers, not float
Full stack trace:
[INFO]: My position: PlayerPosition(0, 0, 0) pitch: 0.0 yaw: 0.0
[DEBUG]: EVENTCORE: Exception while emitting physics_tick None
[DEBUG]: EVENTCORE: Exception while emitting event_tick None
Traceback (most recent call last):
File "example.py", line 56, in <module>
client.start(SERVER, 25565)
File "build/bdist.linux-x86_64/egg/spockbot/plugins/helpers/start.py", line 34, in start
File "build/bdist.linux-x86_64/egg/spockbot/plugins/core/event.py", line 29, in event_loop
File "build/bdist.linux-x86_64/egg/spockbot/plugins/core/event.py", line 36, in run_continuous
File "build/bdist.linux-x86_64/egg/spockbot/plugins/core/event.py", line 62, in emit
File "build/bdist.linux-x86_64/egg/spockbot/plugins/core/timers.py", line 132, in tick
File "build/bdist.linux-x86_64/egg/spockbot/plugins/core/timers.py", line 28, in update
File "build/bdist.linux-x86_64/egg/spockbot/plugins/core/timers.py", line 31, in fire
File "build/bdist.linux-x86_64/egg/spockbot/plugins/core/ticker.py", line 19, in client_tick
File "build/bdist.linux-x86_64/egg/spockbot/plugins/core/event.py", line 62, in emit
File "build/bdist.linux-x86_64/egg/spockbot/plugins/helpers/physics.py", line 109, in physics_tick
File "build/bdist.linux-x86_64/egg/spockbot/plugins/helpers/physics.py", line 152, in get_mtv
File "build/bdist.linux-x86_64/egg/spockbot/plugins/tools/collision.py", line 43, in check_collision
File "build/bdist.linux-x86_64/egg/spockbot/plugins/tools/collision.py", line 51, in block_collision
File "build/bdist.linux-x86_64/egg/spockbot/plugins/tools/smpmap.py", line 230, in get_block
TypeError: list indices must be integers, not float
I checked, and my code does have the fix applied in commit c09dbfa.
@suBDavis you are flooring the position before passing it to get_block, right ?
@rom1504 I'm using the example plugin, which is indeed performing the floor on line 100
block_pos = self.clientinfo.position.floor()
Apparently Physics is generating floating point block positions which I don't understand
Are you able to reproduce?
I was trying to document my entire configuration (python version, steps to install, etc) and I started over. I'm now unable to reproduce that error.
I just said that based on the stack trace. That sort of thing should be impossible with the current code base. Old version?
Definitely not. both came from a git clone https://github.com/SpockBotMC/SpockBot
However, I could have had some outdated packages... or... something. I originally installed SpockBot at the system level, and then tried to repro it in a virtual environment, which would have installed the dependencies fresh from pip.
Dependencies don't enter into it. The offending get_block
call is here:
https://github.com/SpockBotMC/SpockBot/blob/master/spockbot/plugins/tools/collision.py#L51
Which takes a block position from a generator that clearly floors its base position: https://github.com/SpockBotMC/SpockBot/blob/master/spockbot/plugins/tools/collision.py#L15-L20
If this can't be reproduced I'm not sure how to fix