Files
Grinch-AP/worlds/minecraft/test/__init__.py
KonoTyran c010c8c938 Minecraft: Update to new options system. (#3765)
* Move to new options system.
switch to using self.random
reformat rules file.

* further reformats

* fix tests to use new options system.

* fix slot data to not use self.multiworld

* I hate python

* new starting_items docstring to prepare for 1.20.5+ item components.
fix invalid json being output to starting_items

* more typing fixes.

* stupid quotes around type declarations

* removed unused variable in ItemPool.py
change null check in Structures.py

* update rules "self" variable to a "world: MinecraftWorld" variable

* get key, and not value for required bosses.
2024-08-20 00:58:30 +02:00

34 lines
1.1 KiB
Python

from test.bases import TestBase, WorldTestBase
from .. import MinecraftWorld, MinecraftOptions
class MCTestBase(WorldTestBase, TestBase):
game = "Minecraft"
player: int = 1
def _create_items(self, items, player):
singleton = False
if isinstance(items, str):
items = [items]
singleton = True
ret = [self.multiworld.worlds[player].create_item(item) for item in items]
if singleton:
return ret[0]
return ret
def _get_items(self, item_pool, all_except):
if all_except and len(all_except) > 0:
items = self.multiworld.itempool[:]
items = [item for item in items if item.name not in all_except]
items.extend(self._create_items(item_pool[0], 1))
else:
items = self._create_items(item_pool[0], 1)
return self.get_state(items)
def _get_items_partial(self, item_pool, missing_item):
new_items = item_pool[0].copy()
new_items.remove(missing_item)
items = self._create_items(new_items, 1)
return self.get_state(items)