Fix imports
This commit is contained in:
parent
d099ae6965
commit
38f3b0ed67
|
@ -5,7 +5,7 @@ set -eu
|
|||
VERSION="1.16.4"
|
||||
|
||||
wget -Omcdata.zip "https://apimon.de/mcdata/$VERSION/$VERSION.zip"
|
||||
rm -r mosfet/minecraft_data
|
||||
mkdir mosfet/minecraft_data
|
||||
unzip mcdata.zip -d mosfet/minecraft_data
|
||||
rm -r minecraft_data || true
|
||||
mkdir minecraft_data
|
||||
unzip mcdata.zip -d minecraft_data
|
||||
rm mcdata.zip
|
||||
|
|
|
@ -11,7 +11,7 @@ from munch import Munch
|
|||
from watchdog.observers import Observer
|
||||
from watchdog.events import PatternMatchingEventHandler
|
||||
|
||||
import bot
|
||||
from mosfet import bot
|
||||
|
||||
global_state = Munch()
|
||||
g = global_state
|
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
import importlib
|
||||
|
||||
import mcdata
|
||||
from mosfet import mcdata
|
||||
|
||||
MCD_BLOCKS = {}
|
||||
for d in mcdata.mcd.blocks.values():
|
||||
|
|
|
@ -13,28 +13,27 @@ PASSWORD = os.environ['PASSWORD']
|
|||
SERVER = os.environ['SERVER']
|
||||
PORT = int(os.environ.get('PORT', 25565))
|
||||
|
||||
import monkey_patch # must be before any possible pyCraft imports
|
||||
from . import monkey_patch # must be before any possible pyCraft imports
|
||||
|
||||
from minecraft import authentication
|
||||
from minecraft.exceptions import YggdrasilError
|
||||
from minecraft.networking.connection import Connection
|
||||
from minecraft.networking.packets import Packet, clientbound, serverbound
|
||||
|
||||
from protocol.managers import DataManager, ChunksManager, ChatManager, ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import DataManager, ChunksManager, ChatManager, ChunkNotLoadedException
|
||||
|
||||
from munch import Munch
|
||||
from vector import Point3D, Vector3D
|
||||
|
||||
import blocks
|
||||
import game
|
||||
import items
|
||||
import job
|
||||
import mcdata
|
||||
import mobs
|
||||
import path
|
||||
import print_help
|
||||
import utils
|
||||
import vector
|
||||
from mosfet import blocks
|
||||
from mosfet import game
|
||||
from mosfet import items
|
||||
from mosfet import job
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
from mosfet import path
|
||||
from mosfet import print_help
|
||||
from mosfet import utils
|
||||
from mosfet import vector
|
||||
|
||||
for module in [
|
||||
blocks,
|
||||
|
@ -52,9 +51,9 @@ for module in [
|
|||
|
||||
last_tick = time.time()
|
||||
|
||||
PITCH_ANGLE_DIR = Vector3D((0, 1, 0))
|
||||
YAW_ANGLE_DIR = Vector3D((0, 0, -1))
|
||||
YAW_ANGLE_REF = Vector3D((0, 1, 0))
|
||||
PITCH_ANGLE_DIR = vector.Vector3D((0, 1, 0))
|
||||
YAW_ANGLE_DIR = vector.Vector3D((0, 0, -1))
|
||||
YAW_ANGLE_REF = vector.Vector3D((0, 1, 0))
|
||||
YAW_LOOK_AHEAD = 4
|
||||
|
||||
|
||||
|
@ -116,7 +115,7 @@ def tick(global_state):
|
|||
########## player physics ##########
|
||||
|
||||
if g.path and len(g.path):
|
||||
target = Point3D(g.path[0])
|
||||
target = vector.Point3D(g.path[0])
|
||||
target.x += 0.5
|
||||
target.z += 0.5
|
||||
|
||||
|
@ -169,11 +168,11 @@ def tick(global_state):
|
|||
g.y_a = 0
|
||||
|
||||
if g.look_at:
|
||||
look_at = Point3D(g.look_at)
|
||||
look_at = vector.Point3D(g.look_at)
|
||||
elif g.path and len(g.path) > YAW_LOOK_AHEAD:
|
||||
look_at = Point3D(g.path[YAW_LOOK_AHEAD])
|
||||
look_at = vector.Point3D(g.path[YAW_LOOK_AHEAD])
|
||||
elif g.path and len(g.path):
|
||||
look_at = Point3D(g.path[-1])
|
||||
look_at = vector.Point3D(g.path[-1])
|
||||
else:
|
||||
look_at = None
|
||||
|
||||
|
|
|
@ -8,12 +8,10 @@ from itertools import count
|
|||
from munch import Munch
|
||||
from copy import copy
|
||||
|
||||
from vector import Point3D
|
||||
|
||||
from minecraft.networking.packets import Packet, clientbound, serverbound
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.packets import (
|
||||
from mosfet.protocol.packets import (
|
||||
SetSlotPacket, PlayerDiggingPacket,
|
||||
BlockBreakAnimationPacket, AcknowledgePlayerDiggingPacket,
|
||||
HeldItemChangePacket, PickItemPacket, OpenWindowPacket,
|
||||
|
@ -24,16 +22,17 @@ from protocol.packets import (
|
|||
SelectTradePacket, DisconnectPacket,
|
||||
)
|
||||
|
||||
from protocol.types import Slot
|
||||
import print_help
|
||||
from mosfet.protocol.types import Slot
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
import bot
|
||||
from mosfet import print_help
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
from mosfet import bot
|
||||
from mosfet import vector
|
||||
|
||||
class MCWorld:
|
||||
def __init__(self, global_state):
|
||||
|
@ -387,7 +386,7 @@ class Game:
|
|||
def handle_block_change(self, packet):
|
||||
if packet.block_state_id == blocks.SOUL_TORCH:
|
||||
try:
|
||||
self.g.goal = Point3D((packet.location[0], packet.location[1], packet.location[2]))
|
||||
self.g.goal = vector.Point3D((packet.location[0], packet.location[1], packet.location[2]))
|
||||
print('new waypoint:', self.g.goal)
|
||||
|
||||
start = time.time()
|
||||
|
@ -414,7 +413,7 @@ class Game:
|
|||
|
||||
def handle_position_and_look(self, packet):
|
||||
print(packet)
|
||||
p = Point3D((packet.x, packet.y, packet.z))
|
||||
p = vector.Point3D((packet.x, packet.y, packet.z))
|
||||
self.g.pos = p
|
||||
|
||||
confirm_packet = serverbound.play.TeleportConfirmPacket()
|
||||
|
|
|
@ -7,16 +7,16 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
from jobs import (
|
||||
from mosfet.jobs import (
|
||||
cache_items,
|
||||
check_threats,
|
||||
clear_leaves,
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class CacheItemsStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class CheckThreatsStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class ClearLeavesStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class EatFoodStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class FillBlocksStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class FindGappleStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class GatherCropStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class GatherSandStates:
|
||||
def bair(self, p):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class GatherWartStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class GatherWoodStates:
|
||||
def bair(self, p):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class GrabSandStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class GrabSaplingStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class GrabSuppliesStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class PlantTreeStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class SellToVillagerStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -7,14 +7,14 @@ from math import hypot, floor
|
|||
|
||||
from minecraft.networking.types import BlockFace
|
||||
|
||||
from protocol.managers import ChunkNotLoadedException
|
||||
from mosfet.protocol.managers import ChunkNotLoadedException
|
||||
|
||||
import utils
|
||||
import path
|
||||
import blocks
|
||||
import items
|
||||
import mcdata
|
||||
import mobs
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import blocks
|
||||
from mosfet import items
|
||||
from mosfet import mcdata
|
||||
from mosfet import mobs
|
||||
|
||||
class SleepWithBedStates:
|
||||
def idle(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import minecraft.networking.packets
|
||||
from protocol import packets
|
||||
from .protocol import packets
|
||||
|
||||
def get_packets(old_get_packets):
|
||||
def wrapper(func, context):
|
||||
|
|
|
@ -5,8 +5,8 @@ from math import hypot, sqrt
|
|||
|
||||
from astar import AStar
|
||||
|
||||
import blocks
|
||||
import utils
|
||||
from mosfet import blocks
|
||||
from mosfet import utils
|
||||
|
||||
class AStarTimeout(Exception):
|
||||
pass
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
HELP_LINES = []
|
||||
|
||||
with open('game.py', 'r') as f:
|
||||
with open('mosfet/game.py', 'r') as f:
|
||||
for line in f.readlines():
|
||||
if line.strip().startswith('## '):
|
||||
HELP_LINES.append(line.strip()[3:])
|
||||
|
|
|
@ -4,9 +4,9 @@ import json
|
|||
import time
|
||||
|
||||
from minecraft.networking.packets import clientbound, serverbound
|
||||
from protocol import packets
|
||||
from mosfet.protocol import packets
|
||||
|
||||
import utils
|
||||
from mosfet import utils
|
||||
|
||||
class DataManager:
|
||||
def __init__(self, directory):
|
||||
|
|
|
@ -8,9 +8,9 @@ from minecraft.networking.types import (
|
|||
Float, Direction, PositionAndLook
|
||||
)
|
||||
|
||||
from protocol.types import Nbt, Slot, Entry, Trade
|
||||
from .types import Nbt, Slot, Entry, Trade
|
||||
|
||||
import blocks
|
||||
from mosfet import blocks
|
||||
|
||||
|
||||
class ChunkDataPacket(Packet):
|
||||
|
|
|
@ -2,8 +2,8 @@ import importlib
|
|||
import collections
|
||||
from math import floor, ceil, sqrt, hypot
|
||||
|
||||
import blocks
|
||||
import mcdata
|
||||
from mosfet import blocks
|
||||
from mosfet import mcdata
|
||||
|
||||
TICK = 0.05
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user