Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import multiprocessing
from functools import lru_cache
from typing import List, Tuple, Union
from PIL.Image import Image
from pip._internal.utils.deprecation import deprecated
from overviewer_core.asset_loader import AssetLoader
class AssetManager(multiprocessing.Manager):
def __init__(self, assets:Union[str, AssetLoader]):
if isinstance(assets, AssetLoader):
self.assetLoader = assets
else: self.assetLoader = AssetLoader(assets)
raise NotImplementedError
@lru_cache(1000) #cache 1000 most recent textures
def get_texture_as_image(self, fqdn:str)->Image:
""":returns PIL:Image object for minecraft texture"""
raise NotImplementedError
#simply wraps get_texture_as_image so doesnot require caching
def get_texture_as_bytes(self, fqdn:str, size:Tuple[int,int], mode:str)->bytes:
""":returns bytes object for minecraft texture"""
raise NotImplementedError
@lru_cache(1000) #Cache 1000 most recent textures
def get_block_texture_as_image(self, fqdn:str)->Image:
""":returns PIL:Image object for overviewer block texture"""
raise NotImplementedError
def get_block_texture_as_bytes(self, fqdn:str, size:Tuple[int,int], mode:str)->bytes:
""":returns bytes objec object for overviewer block texture"""
raise NotImplementedError
@lru_cache # should not be very big so no max size
def get_model(self, fqdn:str)->dict:
raise NotImplementedError
@lru_cache #Should not be very big so cache every one
def get_blockstates(self, fqdn:str)->dict:
raise NotImplementedError
@deprecated
def get_blocklist(self)->List[str]:
"""deprecated"""
return NotImplementedError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.