Compare commits

..

No commits in common. "2e635ecd2c05acd244ce2408a68a5f3ab10fa680" and "d099ae6965d5c456cf6ed6f2038e70d3d30c99e8" have entirely different histories.

29 changed files with 169 additions and 191 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 minecraft_data || true
mkdir minecraft_data
unzip mcdata.zip -d minecraft_data
rm -r mosfet/minecraft_data
mkdir mosfet/minecraft_data
unzip mcdata.zip -d mosfet/minecraft_data
rm mcdata.zip

View File

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

View File

@ -13,27 +13,28 @@ PASSWORD = os.environ['PASSWORD']
SERVER = os.environ['SERVER']
PORT = int(os.environ.get('PORT', 25565))
from . 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.exceptions import YggdrasilError
from minecraft.networking.connection import Connection
from minecraft.networking.packets import Packet, clientbound, serverbound
from mosfet.protocol.managers import DataManager, ChunksManager, ChatManager, ChunkNotLoadedException
from protocol.managers import DataManager, ChunksManager, ChatManager, ChunkNotLoadedException
from munch import Munch
from vector import Point3D, Vector3D
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
import blocks
import game
import items
import job
import mcdata
import mobs
import path
import print_help
import utils
import vector
for module in [
blocks,
@ -51,9 +52,9 @@ for module in [
last_tick = time.time()
PITCH_ANGLE_DIR = vector.Vector3D((0, 1, 0))
YAW_ANGLE_DIR = vector.Vector3D((0, 0, -1))
YAW_ANGLE_REF = vector.Vector3D((0, 1, 0))
PITCH_ANGLE_DIR = Vector3D((0, 1, 0))
YAW_ANGLE_DIR = Vector3D((0, 0, -1))
YAW_ANGLE_REF = Vector3D((0, 1, 0))
YAW_LOOK_AHEAD = 4
@ -115,7 +116,7 @@ def tick(global_state):
########## player physics ##########
if g.path and len(g.path):
target = vector.Point3D(g.path[0])
target = Point3D(g.path[0])
target.x += 0.5
target.z += 0.5
@ -168,11 +169,11 @@ def tick(global_state):
g.y_a = 0
if g.look_at:
look_at = vector.Point3D(g.look_at)
look_at = Point3D(g.look_at)
elif g.path and len(g.path) > YAW_LOOK_AHEAD:
look_at = vector.Point3D(g.path[YAW_LOOK_AHEAD])
look_at = Point3D(g.path[YAW_LOOK_AHEAD])
elif g.path and len(g.path):
look_at = vector.Point3D(g.path[-1])
look_at = Point3D(g.path[-1])
else:
look_at = None

View File

@ -8,10 +8,12 @@ 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 mosfet.protocol.packets import (
from protocol.packets import (
SetSlotPacket, PlayerDiggingPacket,
BlockBreakAnimationPacket, AcknowledgePlayerDiggingPacket,
HeldItemChangePacket, PickItemPacket, OpenWindowPacket,
@ -22,17 +24,16 @@ from mosfet.protocol.packets import (
SelectTradePacket, DisconnectPacket,
)
from mosfet.protocol.types import Slot
from protocol.types import Slot
import print_help
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
import utils
import path
import blocks
import items
import mcdata
import mobs
import bot
class MCWorld:
def __init__(self, global_state):
@ -386,7 +387,7 @@ class Game:
def handle_block_change(self, packet):
if packet.block_state_id == blocks.SOUL_TORCH:
try:
self.g.goal = vector.Point3D((packet.location[0], packet.location[1], packet.location[2]))
self.g.goal = Point3D((packet.location[0], packet.location[1], packet.location[2]))
print('new waypoint:', self.g.goal)
start = time.time()
@ -413,7 +414,7 @@ class Game:
def handle_position_and_look(self, packet):
print(packet)
p = vector.Point3D((packet.x, packet.y, packet.z))
p = 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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
import mobs
from mosfet.jobs import (
from 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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
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 mosfet.protocol.managers import ChunkNotLoadedException
from protocol.managers import ChunkNotLoadedException
from mosfet import utils
from mosfet import path
from mosfet import blocks
from mosfet import items
from mosfet import mcdata
from mosfet import mobs
import utils
import path
import blocks
import items
import mcdata
import mobs
class SleepWithBedStates:
def idle(self):

View File

@ -11,7 +11,7 @@ from munch import Munch
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from mosfet import bot
import bot
global_state = Munch()
g = global_state

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
from mosfet import blocks
from mosfet import utils
import blocks
import utils
class AStarTimeout(Exception):
pass

View File

@ -1,6 +1,6 @@
HELP_LINES = []
with open('mosfet/game.py', 'r') as f:
with open('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 mosfet.protocol import packets
from protocol import packets
from mosfet import utils
import utils
class DataManager:
def __init__(self, directory):

View File

@ -8,9 +8,9 @@ from minecraft.networking.types import (
Float, Direction, PositionAndLook
)
from .types import Nbt, Slot, Entry, Trade
from protocol.types import Nbt, Slot, Entry, Trade
from mosfet import blocks
import blocks
class ChunkDataPacket(Packet):

View File

@ -2,8 +2,8 @@ import importlib
import collections
from math import floor, ceil, sqrt, hypot
from mosfet import blocks
from mosfet import mcdata
import blocks
import mcdata
TICK = 0.05

View File

@ -1,24 +0,0 @@
# -*- 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'],
)