-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Context: The bug occurs when using the Python-JavaScript bridge and the mineflayer module.
Replay conditions: The crash occurs when methods are called in a chain, e.g. playerEntity.position.offset(...).
from javascript import require, On
mineflayer = require('mineflayer')
bot = mineflayer.createBot({
'host': 'localhost',
'port': 30034,
'username': 'lookAt_Bot'
})
def lookAtNearestPlayer():
playerEntity = bot.nearestEntity()
if not playerEntity:
return
pos = playerEntity.position.offset(0, playerEntity.height, 0)
bot.lookAt(pos)
@On(bot, 'chat')
def chathandle(this, username, message, *args):
if username == "sffkjsdfsfd" and message == "asdkasdjkadjskajsdj":
bot.chat('asjdkjasdkasjd')
@On(bot, 'physicsTick')
def handle(*args):
lookAtNearestPlayer()
Workaround: Assigning an intermediate value to a variable before calling a method prevents a crash.
pos = playerEntity.position
pos = pos.offset(0, playerEntity.height, 0)
bot.lookAt(pos)
- Funny enough, "@on(bot, 'chat')" also affects the bug. If you remove this event, the script will not crash.
- The script crashes on chat messages (even though the event should not affect anything), but I don't think this applies to JSPyBridge.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels