Compare commits

..

2 Commits

Author SHA1 Message Date
2e635ecd2c Add setup.py 2021-04-22 00:47:16 +00:00
38f3b0ed67 Fix imports 2021-04-22 00:46:54 +00:00
29 changed files with 191 additions and 169 deletions

View File

@ -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

View File

@ -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

View File

@ -1,7 +1,7 @@
import json
import importlib
import mcdata
from mosfet import mcdata
MCD_BLOCKS = {}
for d in mcdata.mcd.blocks.values():

View File

@ -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

View File

@ -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()

View File

@ -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,

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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

View File

@ -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:])

View File

@ -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):

View File

@ -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):

View File

@ -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

24
setup.py Normal file
View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# DO NOT EDIT THIS FILE!
# This file has been autogenerated by dephell <3
# https://github.com/dephell/dephell
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = ''
setup(
long_description=readme,
name='mosfet',
version='0.0.0',
packages=['mosfet', 'mosfet.jobs', 'mosfet.protocol'],
package_dir={"": "."},
package_data={"mosfet": ["minecraft_data/*.json", "minecraft_data/*.txt", "minecraft_data/advancements/adventure/*.json", "minecraft_data/advancements/end/*.json", "minecraft_data/advancements/husbandry/*.json", "minecraft_data/advancements/nether/*.json", "minecraft_data/advancements/recipes/*.json", "minecraft_data/advancements/recipes/brewing/*.json", "minecraft_data/advancements/recipes/building_blocks/*.json", "minecraft_data/advancements/recipes/combat/*.json", "minecraft_data/advancements/recipes/decorations/*.json", "minecraft_data/advancements/recipes/food/*.json", "minecraft_data/advancements/recipes/misc/*.json", "minecraft_data/advancements/recipes/redstone/*.json", "minecraft_data/advancements/recipes/tools/*.json", "minecraft_data/advancements/recipes/transportation/*.json", "minecraft_data/advancements/story/*.json", "minecraft_data/biomes/*.json", "minecraft_data/loot_tables/blocks/*.json", "minecraft_data/loot_tables/chests/*.json", "minecraft_data/loot_tables/chests/village/*.json", "minecraft_data/loot_tables/entities/*.json", "minecraft_data/loot_tables/entities/sheep/*.json", "minecraft_data/loot_tables/gameplay/*.json", "minecraft_data/loot_tables/gameplay/fishing/*.json", "minecraft_data/loot_tables/gameplay/hero_of_the_village/*.json", "minecraft_data/recipes/*.json", "minecraft_data/tags/blocks/*.json", "minecraft_data/tags/entity_types/*.json", "minecraft_data/tags/fluids/*.json", "minecraft_data/tags/items/*.json"]},
install_requires=['appdirs==1.4.3', 'astar==0.93', 'cachecontrol==0.12.6', 'certifi==2019.11.28', 'cffi==1.14.5', 'chardet==3.0.4', 'click==7.1.2', 'colorama==0.4.3', 'contextlib2==0.6.0', 'cryptography==3.4.7', 'distlib==0.3.0', 'distro==1.4.0', 'flask==1.1.2', 'html5lib==1.0.1', 'idna==2.8', 'ipaddr==2.2.0', 'itsdangerous==1.1.0', 'jinja2==2.11.3', 'lockfile==0.12.2', 'markupsafe==1.1.1', 'minecraft-data==2.82.2', 'msgpack==0.6.2', 'munch==2.5.0', 'mutf8==1.0.3', 'packaging==20.3', 'pep517==0.8.2', 'progress==1.5', 'pycparser==2.20', 'pycraft.git@2813d02ae7fb8182c3e5227a73de2240b09878d9', 'pynbt==3.1.0', 'pyparsing==2.4.6', 'pytoml==0.1.21', 'requests==2.22.0', 'retrying==1.3.3', 'six==1.14.0', 'urllib3==1.25.8', 'watchdog==2.0.2', 'webencodings==0.5.1', 'werkzeug==1.0.1'],
dependency_links=['git+https://github.com/ammaraskar/pyCraft.git@2813d02ae7fb8182c3e5227a73de2240b09878d9#egg=pycraft-git@2813d02ae7fb8182c3e5227a73de2240b09878d9'],
)