diff --git a/blocks.py b/blocks.py index eb66e5b..e920f0f 100644 --- a/blocks.py +++ b/blocks.py @@ -2,7 +2,6 @@ import json import importlib import mcdata -importlib.reload(mcdata) MCD_BLOCKS = {} for d in mcdata.mcd.blocks.values(): diff --git a/bot.py b/bot.py index 1cb84db..4ecd22d 100644 --- a/bot.py +++ b/bot.py @@ -15,7 +15,6 @@ PORT = int(os.environ.get('PORT', 25565)) 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 @@ -26,18 +25,30 @@ from protocol.managers import DataManager, ChunksManager, ChatManager, ChunkNotL from munch import Munch from vector import Point3D, Vector3D -import game -importlib.reload(game) import blocks -importlib.reload(blocks) -import utils -importlib.reload(utils) -import path -importlib.reload(path) +import game +import items import job -importlib.reload(job) import mcdata -importlib.reload(mcdata) +import mobs +import path +import print_help +import utils +import vector + +for module in [ + blocks, + game, + items, + job, + mcdata, + mobs, + path, + print_help, + utils, + vector, +]: + importlib.reload(module) last_tick = time.time() diff --git a/game.py b/game.py index cb92b70..1ad3784 100644 --- a/game.py +++ b/game.py @@ -28,19 +28,12 @@ from protocol.types import Slot import print_help import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) import bot -importlib.reload(bot) class MCWorld: def __init__(self, global_state): @@ -506,11 +499,12 @@ class Game: else: # for reply = 'command not found' else: + print() + print() for line in print_help.HELP_LINES: print(line) reply = 'check console' - ## !ping - replies with "pong" if command == 'ping': reply = 'pong' diff --git a/job.py b/job.py index 817a901..d35835c 100644 --- a/job.py +++ b/job.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) from jobs import ( cache_items, @@ -40,6 +34,7 @@ from jobs import ( sell_to_villager, sleep_with_bed, ) + for module in [ cache_items, check_threats, diff --git a/jobs/cache_items.py b/jobs/cache_items.py index ee7629e..67a415b 100644 --- a/jobs/cache_items.py +++ b/jobs/cache_items.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class CacheItemsStates: def idle(self): diff --git a/jobs/check_threats.py b/jobs/check_threats.py index dfe54c5..cbe162d 100644 --- a/jobs/check_threats.py +++ b/jobs/check_threats.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class CheckThreatsStates: def idle(self): diff --git a/jobs/clear_leaves.py b/jobs/clear_leaves.py index f7ed832..c0395d2 100644 --- a/jobs/clear_leaves.py +++ b/jobs/clear_leaves.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class ClearLeavesStates: def idle(self): diff --git a/jobs/eat_food.py b/jobs/eat_food.py index e41f7a4..880aedf 100644 --- a/jobs/eat_food.py +++ b/jobs/eat_food.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class EatFoodStates: def idle(self): diff --git a/jobs/fill_blocks.py b/jobs/fill_blocks.py index 00be475..1b8e032 100644 --- a/jobs/fill_blocks.py +++ b/jobs/fill_blocks.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class FillBlocksStates: def idle(self): diff --git a/jobs/find_gapple.py b/jobs/find_gapple.py index 5f88807..25ecadf 100644 --- a/jobs/find_gapple.py +++ b/jobs/find_gapple.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class FindGappleStates: def idle(self): diff --git a/jobs/gather_crop.py b/jobs/gather_crop.py index decd2eb..92cc48e 100644 --- a/jobs/gather_crop.py +++ b/jobs/gather_crop.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class GatherCropStates: def idle(self): diff --git a/jobs/gather_sand.py b/jobs/gather_sand.py index 6e3d783..7e0e769 100644 --- a/jobs/gather_sand.py +++ b/jobs/gather_sand.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class GatherSandStates: def bair(self, p): diff --git a/jobs/gather_wart.py b/jobs/gather_wart.py index f09f027..e9a3348 100644 --- a/jobs/gather_wart.py +++ b/jobs/gather_wart.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class GatherWartStates: def idle(self): diff --git a/jobs/gather_wood.py b/jobs/gather_wood.py index 8d51c32..fcf6780 100644 --- a/jobs/gather_wood.py +++ b/jobs/gather_wood.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class GatherWoodStates: def bair(self, p): diff --git a/jobs/grab_sand.py b/jobs/grab_sand.py index 323210b..cc5e6c4 100644 --- a/jobs/grab_sand.py +++ b/jobs/grab_sand.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class GrabSandStates: def idle(self): diff --git a/jobs/grab_sapling.py b/jobs/grab_sapling.py index 689cf32..ba25642 100644 --- a/jobs/grab_sapling.py +++ b/jobs/grab_sapling.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class GrabSaplingStates: def idle(self): diff --git a/jobs/grab_supplies.py b/jobs/grab_supplies.py index 1b6797a..d96034b 100644 --- a/jobs/grab_supplies.py +++ b/jobs/grab_supplies.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class GrabSuppliesStates: def idle(self): diff --git a/jobs/plant_tree.py b/jobs/plant_tree.py index 2f4cc28..d8e3634 100644 --- a/jobs/plant_tree.py +++ b/jobs/plant_tree.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class PlantTreeStates: def idle(self): diff --git a/jobs/sell_to_villager.py b/jobs/sell_to_villager.py index ba627b0..242dc16 100644 --- a/jobs/sell_to_villager.py +++ b/jobs/sell_to_villager.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class SellToVillagerStates: def idle(self): diff --git a/jobs/sleep_with_bed.py b/jobs/sleep_with_bed.py index a3c50ba..69facbe 100644 --- a/jobs/sleep_with_bed.py +++ b/jobs/sleep_with_bed.py @@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException import utils -importlib.reload(utils) import path -importlib.reload(path) import blocks -importlib.reload(blocks) import items -importlib.reload(items) import mcdata -importlib.reload(mcdata) import mobs -importlib.reload(mobs) class SleepWithBedStates: def idle(self): diff --git a/path.py b/path.py index 9513db5..3f11270 100644 --- a/path.py +++ b/path.py @@ -6,9 +6,7 @@ from math import hypot, sqrt from astar import AStar import blocks -importlib.reload(blocks) import utils -importlib.reload(utils) class AStarTimeout(Exception): pass diff --git a/utils.py b/utils.py index ba71b77..498c2bf 100644 --- a/utils.py +++ b/utils.py @@ -3,9 +3,7 @@ import collections from math import floor, ceil, sqrt, hypot import blocks -importlib.reload(blocks) import mcdata -importlib.reload(mcdata) TICK = 0.05