Remove redundant module reloads
This commit is contained in:
parent
87bb638270
commit
f88809af64
|
@ -2,7 +2,6 @@ import json
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
|
|
||||||
MCD_BLOCKS = {}
|
MCD_BLOCKS = {}
|
||||||
for d in mcdata.mcd.blocks.values():
|
for d in mcdata.mcd.blocks.values():
|
||||||
|
|
31
bot.py
31
bot.py
|
@ -15,7 +15,6 @@ PORT = int(os.environ.get('PORT', 25565))
|
||||||
|
|
||||||
import monkey_patch # must be before any possible pyCraft imports
|
import monkey_patch # must be before any possible pyCraft imports
|
||||||
|
|
||||||
|
|
||||||
from minecraft import authentication
|
from minecraft import authentication
|
||||||
from minecraft.exceptions import YggdrasilError
|
from minecraft.exceptions import YggdrasilError
|
||||||
from minecraft.networking.connection import Connection
|
from minecraft.networking.connection import Connection
|
||||||
|
@ -26,18 +25,30 @@ from protocol.managers import DataManager, ChunksManager, ChatManager, ChunkNotL
|
||||||
from munch import Munch
|
from munch import Munch
|
||||||
from vector import Point3D, Vector3D
|
from vector import Point3D, Vector3D
|
||||||
|
|
||||||
import game
|
|
||||||
importlib.reload(game)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
import game
|
||||||
import utils
|
import items
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
|
||||||
importlib.reload(path)
|
|
||||||
import job
|
import job
|
||||||
importlib.reload(job)
|
|
||||||
import mcdata
|
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()
|
last_tick = time.time()
|
||||||
|
|
||||||
|
|
10
game.py
10
game.py
|
@ -28,19 +28,12 @@ from protocol.types import Slot
|
||||||
import print_help
|
import print_help
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
import bot
|
import bot
|
||||||
importlib.reload(bot)
|
|
||||||
|
|
||||||
class MCWorld:
|
class MCWorld:
|
||||||
def __init__(self, global_state):
|
def __init__(self, global_state):
|
||||||
|
@ -506,11 +499,12 @@ class Game:
|
||||||
else: # for
|
else: # for
|
||||||
reply = 'command not found'
|
reply = 'command not found'
|
||||||
else:
|
else:
|
||||||
|
print()
|
||||||
|
print()
|
||||||
for line in print_help.HELP_LINES:
|
for line in print_help.HELP_LINES:
|
||||||
print(line)
|
print(line)
|
||||||
reply = 'check console'
|
reply = 'check console'
|
||||||
|
|
||||||
|
|
||||||
## !ping - replies with "pong"
|
## !ping - replies with "pong"
|
||||||
if command == 'ping':
|
if command == 'ping':
|
||||||
reply = 'pong'
|
reply = 'pong'
|
||||||
|
|
7
job.py
7
job.py
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
from jobs import (
|
from jobs import (
|
||||||
cache_items,
|
cache_items,
|
||||||
|
@ -40,6 +34,7 @@ from jobs import (
|
||||||
sell_to_villager,
|
sell_to_villager,
|
||||||
sleep_with_bed,
|
sleep_with_bed,
|
||||||
)
|
)
|
||||||
|
|
||||||
for module in [
|
for module in [
|
||||||
cache_items,
|
cache_items,
|
||||||
check_threats,
|
check_threats,
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class CacheItemsStates:
|
class CacheItemsStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class CheckThreatsStates:
|
class CheckThreatsStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class ClearLeavesStates:
|
class ClearLeavesStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class EatFoodStates:
|
class EatFoodStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class FillBlocksStates:
|
class FillBlocksStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class FindGappleStates:
|
class FindGappleStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class GatherCropStates:
|
class GatherCropStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class GatherSandStates:
|
class GatherSandStates:
|
||||||
def bair(self, p):
|
def bair(self, p):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class GatherWartStates:
|
class GatherWartStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class GatherWoodStates:
|
class GatherWoodStates:
|
||||||
def bair(self, p):
|
def bair(self, p):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class GrabSandStates:
|
class GrabSandStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class GrabSaplingStates:
|
class GrabSaplingStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class GrabSuppliesStates:
|
class GrabSuppliesStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class PlantTreeStates:
|
class PlantTreeStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class SellToVillagerStates:
|
class SellToVillagerStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
|
@ -10,17 +10,11 @@ from minecraft.networking.types import BlockFace
|
||||||
from protocol.managers import ChunkNotLoadedException
|
from protocol.managers import ChunkNotLoadedException
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import items
|
import items
|
||||||
importlib.reload(items)
|
|
||||||
import mcdata
|
import mcdata
|
||||||
importlib.reload(mcdata)
|
|
||||||
import mobs
|
import mobs
|
||||||
importlib.reload(mobs)
|
|
||||||
|
|
||||||
class SleepWithBedStates:
|
class SleepWithBedStates:
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
|
2
path.py
2
path.py
|
@ -6,9 +6,7 @@ from math import hypot, sqrt
|
||||||
from astar import AStar
|
from astar import AStar
|
||||||
|
|
||||||
import blocks
|
import blocks
|
||||||
importlib.reload(blocks)
|
|
||||||
import utils
|
import utils
|
||||||
importlib.reload(utils)
|
|
||||||
|
|
||||||
class AStarTimeout(Exception):
|
class AStarTimeout(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user