Skip to content

Commit 7f5160d

Browse files
committed
Fix vector calculations
1 parent 7747f01 commit 7f5160d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

spockbot/plugins/helpers/clientinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __init__(self):
9797

9898
@property
9999
def eye_pos(self):
100-
return self.position + (0, const.PLAYER_EYE_HEIGHT, 0)
100+
return self.position + Vector3(0, const.PLAYER_EYE_HEIGHT, 0)
101101

102102
def reset(self):
103103
"""Resets the information in ClientInfo"""

spockbot/plugins/helpers/interact.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def look_at(self, pos):
9696

9797
def _send_dig_block(self, status, pos=None, face=constants.FACE_Y_POS):
9898
if status == constants.DIG_START:
99-
self.dig_pos_dict = pos.get_dict().copy()
99+
self.dig_pos_dict = pos.floor().get_dict().copy()
100100
self.net.push_packet('PLAY>Player Digging', {
101101
'status': status,
102102
'location': self.dig_pos_dict,
@@ -105,7 +105,7 @@ def _send_dig_block(self, status, pos=None, face=constants.FACE_Y_POS):
105105

106106
def start_digging(self, pos):
107107
if self.auto_look:
108-
self.look_at(pos.floor().iadd(0.5, 0.5, 0.5))
108+
self.look_at(pos.floor() + Vector3(0.5, 0.5, 0.5))
109109
self._send_dig_block(constants.DIG_START, pos)
110110
if self.auto_swing:
111111
self.swing_arm()
@@ -126,7 +126,7 @@ def dig_block(self, pos):
126126

127127
def _send_click_block(self, pos, face=1, cursor_pos=Vector3(8, 8, 8)):
128128
self.net.push_packet('PLAY>Player Block Placement', {
129-
'location': pos.get_dict(),
129+
'location': pos.floor().get_dict(),
130130
'direction': face,
131131
'held_item': self.inventory.active_slot.get_dict(),
132132
'cur_pos_x': int(cursor_pos.x),
@@ -147,7 +147,7 @@ def click_block(self, pos, face=1, cursor_pos=Vector3(8, 8, 8),
147147
"""
148148
if look_at_block and self.auto_look:
149149
# TODO look at cursor_pos
150-
self.look_at(pos.floor().iadd(0.5, 0.5, 0.5))
150+
self.look_at(pos.floor() + Vector3(0.5, 0.5, 0.5))
151151
self._send_click_block(pos, face, cursor_pos)
152152
if swing and self.auto_swing:
153153
self.swing_arm()

0 commit comments

Comments
 (0)