Begin port to 26.3: movement
This commit is contained in:
+11
-30
@@ -1,42 +1,23 @@
|
||||
import os
|
||||
from math import floor
|
||||
import json
|
||||
import time
|
||||
from math import floor
|
||||
|
||||
from minecraft.networking.packets import clientbound, serverbound
|
||||
from mosfet.protocol import packets
|
||||
from mosfet.info import blocks, mcdata, mobs
|
||||
|
||||
from mosfet import utils
|
||||
from mosfet.info import blocks
|
||||
|
||||
class DataManager:
|
||||
def __init__(self, directory):
|
||||
self.blocks = {}
|
||||
self.blocks_states = {}
|
||||
self.blocks_properties = {}
|
||||
"""Compatibility facade over the checked-in Minecraft 26.3 data."""
|
||||
def __init__(self, directory=None):
|
||||
self.blocks = mcdata.mcd.blocks
|
||||
self.blocks_states = dict(blocks.BLOCKS)
|
||||
self.blocks_properties = dict(blocks.PROPS)
|
||||
self.registries = {}
|
||||
self.biomes = {}
|
||||
self.entity_type = {}
|
||||
|
||||
if not os.path.isdir(directory):
|
||||
raise FileNotFoundError("%s is not a valid directory")
|
||||
|
||||
if not os.path.isfile("%s/registries.json"%(directory)):
|
||||
raise FileNotFoundError("%s is not a valid minecraft data directory")
|
||||
|
||||
with open("%s/blocks.json"%(directory)) as f:
|
||||
blocks = json.loads(f.read())
|
||||
for x in blocks:
|
||||
for s in blocks[x]['states']:
|
||||
self.blocks_states[s['id']] = x
|
||||
self.blocks_properties[s['id']] = s.get('properties', {})
|
||||
|
||||
with open("%s/registries.json"%(directory)) as f:
|
||||
registries = json.loads(f.read())
|
||||
#for x in registries["minecraft:biome"]["entries"]:
|
||||
# self.biomes[registries["minecraft:biome"]["entries"][x]["protocol_id"]] = x
|
||||
for x in registries["minecraft:entity_type"]["entries"]:
|
||||
self.entity_type[registries["minecraft:entity_type"]["entries"][x]["protocol_id"]] = x
|
||||
self.entity_type = {
|
||||
data['protocol_id']: name
|
||||
for name, data in mobs.MOBS.items()
|
||||
}
|
||||
|
||||
|
||||
class ChunksManager:
|
||||
|
||||
Reference in New Issue
Block a user