Remove redundant module reloads
This commit is contained in:
parent
87bb638270
commit
f88809af64
|
@ -2,7 +2,6 @@ import json
|
|||
import importlib
|
||||
|
||||
import mcdata
|
||||
importlib.reload(mcdata)
|
||||
|
||||
MCD_BLOCKS = {}
|
||||
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
|
||||
|
||||
|
||||
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()
|
||||
|
||||
|
|
10
game.py
10
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'
|
||||
|
|
7
job.py
7
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,
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
2
path.py
2
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user