def setup(self) -> Generator[OperationYieldType, None, None]: """Set up objects that take a while to set up.""" yield 0.1, "Downloading vanilla resource pack" gen = get_java_vanilla_latest_iter() try: while True: yield next(gen) * 0.4 + 0.1 except StopIteration as e: latest_pack = e.value yield 0.5, "Loading resource packs" fix_pack = get_java_vanilla_fix() amulet_pack = minecraft_model_reader.JavaRP( os.path.join(os.path.dirname(__file__), "..", "amulet_resource_pack")) user_packs = [ minecraft_model_reader.JavaRP(rp) for rp in os.listdir("resource_packs") if os.path.isdir(rp) ] self._resource_pack = minecraft_model_reader.JavaRPHandler( (amulet_pack, latest_pack, *user_packs, fix_pack), load=False) for i in self._resource_pack.reload(): yield i / 4 + 0.5 yield 0.75, "Creating texture atlas" for i in self._create_atlas(): yield i / 4 + 0.75 yield 1.0, "Setting up renderer" self._resource_pack_translator = self.world.translation_manager.get_version( "java", (999, 0, 0)) self._render_world = RenderWorld( self.context_identifier, self.world, self._resource_pack, self._gl_texture_atlas, self._texture_bounds, self._resource_pack_translator, ) self._selection_group = EditProgramRenderSelectionGroup( self, self.context_identifier, self._texture_bounds, self._gl_texture_atlas) self._structure: StructureGroup = StructureGroup( self.context_identifier, self.world.palette, self._resource_pack, self._gl_texture_atlas, self._texture_bounds, self._resource_pack_translator, ) self._bind_base_events()
def _load_resource_pack(self, *resource_packs: minecraft_model_reader.JavaRP): self._resource_pack = minecraft_model_reader.JavaRPHandler(resource_packs) self._create_atlas()
import minecraft_model_reader try: from amulet.api.block import Block except: from minecraft_model_reader.api.block import Block vanilla_1_13_2 = minecraft_model_reader.JavaRP( './../test_packs/Vanilla 1.13.2') resource_pack = minecraft_model_reader.JavaRPHandler([vanilla_1_13_2]) air: Block = Block(namespace='minecraft', base_name='air') stone: Block = Block(namespace='minecraft', base_name='stone') fire: Block = Block(namespace='minecraft', base_name='fire', properties={ "age": "0", "east": "true", "north": "true", "south": "false", "up": "false", "west": "false" }) air_model = resource_pack.get_model(air) stone_model = resource_pack.get_model(stone) fire_model = resource_pack.get_model(fire) print('Read successfully')