2021-07-22 01:08:44 +02:00
|
|
|
import os
|
2021-08-05 13:17:01 -05:00
|
|
|
import json
|
|
|
|
from base64 import b64encode, b64decode
|
2021-08-04 16:12:33 -05:00
|
|
|
from math import ceil
|
2021-07-12 13:54:47 +02:00
|
|
|
|
2021-07-31 02:41:58 -05:00
|
|
|
from .Items import MinecraftItem, item_table, required_items, junk_weights
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
from .Locations import MinecraftAdvancement, advancement_table, exclusion_table, get_postgame_advancements
|
2021-07-23 19:28:16 -04:00
|
|
|
from .Regions import mc_regions, link_minecraft_structures, default_connections
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
from .Rules import set_advancement_rules, set_completion_rules
|
2021-07-14 08:42:55 -05:00
|
|
|
from worlds.generic.Rules import exclusion_rules
|
Minecraft Randomizer
Squash merge, original Commits:
* Minecraft locations, items, and generation without logic
* added id lookup for minecraft
* typing import fix in minecraft/Items.py
* fix 2
* implementing Minecraft options and hard/postgame advancement exclusion
* first logic pass (75/80)
* logic pass 2 and proper completion conditions
* added insane difficulty pool, modified method of excluding item pools for easier extension
* bump network_data_package version
* minecraft testing framework
* switch Ancient Debris to Netherite Scrap to avoid advancement triggering on receiving that item
* Testing now functions, split tests up by advancement pane, added some story tests
* Newer testing framework: every advancement gets its own function, for ease of testing
* fixed logic for The End... Again...
* changed option names to "include_hard_advancements" etc.
* village/pillager-related advancements now require can_adventure: weapon + food
* a few minecraft tests
* rename "Flint & Steel" to "Flint and Steel" for parity with in-game name
* additional MC tests
* more tests, mostly nether-related tests
* more tests, removed anvil path for Two Birds One Arrow
* include Minecraft slot data, and a world seed for each Minecraft player slot
* Added new items: ender pearls, lapis, porkchops
* All remaining Minecraft tests
* formatting of Minecraft tests and logic for better readability
* require Wither kill for Monsters Hunted
* properly removed 8 Emeralds item from item pool
* enchanting required for wither; fishing rod required for water breathing; water breathing required for elder guardian kill
* Added 12 new advancements (ported from old achievement system)
* renamed "On a Rail" for consistency with modern advancements
* tests for the new advancements
* moved slot_data generation for minecraft into worlds/minecraft/__init__.py, added logic_version to slot_data
* output minecraft options in the spoiler log
* modified advancement goal values for new advancements
* make non-native Minecraft items appear as Shovel in ALttP, and unknown-game items as Power Stars
* fixed glowstone block logic for Not Quite Nine Lives
* setup for shuffling MC structures: building ER world and shuffling regions/entrances
* ensured Nether Fortresses can't be placed in the End
* finished logic for structure randomization
* fixed nonnative items always showing up as Hammers in ALttP shops
* output minecraft structure info in the spoiler
* generate .apmc file for communication with MC client
* fixed structure rando always using the same seed
* move stuff to worlds/minecraft/Regions.py
* make output apmc file have consistent name with other files
* added minecraft bottle macro; fixed tests imports
* generalizing MC region generation
* restructured structure shuffling in preparation for structure plando
* only output structure rando info in spoiler if they are shuffled
* Force structure rando to always be off, for the stable release
* added Minecraft options to player settings
* formally added combat_difficulty as an option
* Added Ender Dragon into playthrough, cleaned up goal map
* Added new difficulties: Easy, Normal, Hard combat
* moved .apmc generation time to prevent outputs on failed generation
* updated tests for new combat logic
* Fixed bug causing generation to fail; removed Nether Fortress event since it should no longer be needed with the fix
* moved all MC-specific functions into gen_minecraft
* renamed "logic_version" to "client_version"
* bug fixes
properly flagged event locations/items with id None
moved generation back to Main.py to fix mysterious generation failures
* moved link_minecraft_regions into minecraft init, left create_regions in Main for caching
* added seed_name, player_name, client_version to apmc file
* reenabled structure shuffle
* added entrance tests for minecraft
Co-authored-by: achuang <alexander.w.chuang@gmail.com>
2021-05-08 07:38:57 -04:00
|
|
|
|
2022-05-11 13:05:53 -05:00
|
|
|
from BaseClasses import Region, Entrance, Item, Tutorial
|
2021-06-25 23:32:13 +02:00
|
|
|
from .Options import minecraft_options
|
2022-04-12 14:37:05 -07:00
|
|
|
from ..AutoWorld import World, WebWorld
|
2021-06-11 14:22:44 +02:00
|
|
|
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
client_version = 7
|
2022-04-12 14:37:05 -07:00
|
|
|
|
|
|
|
class MinecraftWebWorld(WebWorld):
|
|
|
|
theme = "jungle"
|
|
|
|
bug_report_page = "https://github.com/KonoTyran/Minecraft_AP_Randomizer/issues/new?assignees=&labels=bug&template=bug_report.yaml&title=%5BBug%5D%3A+Brief+Description+of+bug+here"
|
|
|
|
|
2022-05-11 13:05:53 -05:00
|
|
|
setup = Tutorial(
|
|
|
|
"Multiworld Setup Tutorial",
|
|
|
|
"A guide to setting up the Archipelago Minecraft software on your computer. This guide covers"
|
|
|
|
"single-player, multiworkd, and related software.",
|
|
|
|
"English",
|
|
|
|
"minecraft_en.md",
|
|
|
|
"minecraft/en",
|
|
|
|
["Kono Tyran"]
|
|
|
|
)
|
|
|
|
|
|
|
|
setup_es = Tutorial(
|
|
|
|
setup.tutorial_name,
|
|
|
|
setup.description,
|
|
|
|
"Español",
|
|
|
|
"minecraft_es.md",
|
|
|
|
"minecraft/es",
|
|
|
|
["Edos"]
|
|
|
|
)
|
|
|
|
|
|
|
|
setup_sv = Tutorial(
|
|
|
|
setup.tutorial_name,
|
|
|
|
setup.description,
|
|
|
|
"Swedish",
|
|
|
|
"minecraft_sv.md",
|
|
|
|
"minecraft/sv",
|
|
|
|
["Albinum"]
|
|
|
|
)
|
|
|
|
|
|
|
|
tutorials = [setup, setup_es, setup_sv]
|
|
|
|
|
2022-04-12 14:37:05 -07:00
|
|
|
|
2021-06-11 14:22:44 +02:00
|
|
|
class MinecraftWorld(World):
|
2021-08-31 17:28:46 -04:00
|
|
|
"""
|
|
|
|
Minecraft is a game about creativity. In a world made entirely of cubes, you explore, discover, mine,
|
|
|
|
craft, and try not to explode. Delve deep into the earth and discover abandoned mines, ancient
|
|
|
|
structures, and materials to create a portal to another world. Defeat the Ender Dragon, and claim
|
|
|
|
victory!
|
|
|
|
"""
|
2021-06-11 14:22:44 +02:00
|
|
|
game: str = "Minecraft"
|
2021-06-25 23:32:13 +02:00
|
|
|
options = minecraft_options
|
2021-07-08 11:07:41 +02:00
|
|
|
topology_present = True
|
2022-04-12 14:37:05 -07:00
|
|
|
web = MinecraftWebWorld()
|
Minecraft Randomizer
Squash merge, original Commits:
* Minecraft locations, items, and generation without logic
* added id lookup for minecraft
* typing import fix in minecraft/Items.py
* fix 2
* implementing Minecraft options and hard/postgame advancement exclusion
* first logic pass (75/80)
* logic pass 2 and proper completion conditions
* added insane difficulty pool, modified method of excluding item pools for easier extension
* bump network_data_package version
* minecraft testing framework
* switch Ancient Debris to Netherite Scrap to avoid advancement triggering on receiving that item
* Testing now functions, split tests up by advancement pane, added some story tests
* Newer testing framework: every advancement gets its own function, for ease of testing
* fixed logic for The End... Again...
* changed option names to "include_hard_advancements" etc.
* village/pillager-related advancements now require can_adventure: weapon + food
* a few minecraft tests
* rename "Flint & Steel" to "Flint and Steel" for parity with in-game name
* additional MC tests
* more tests, mostly nether-related tests
* more tests, removed anvil path for Two Birds One Arrow
* include Minecraft slot data, and a world seed for each Minecraft player slot
* Added new items: ender pearls, lapis, porkchops
* All remaining Minecraft tests
* formatting of Minecraft tests and logic for better readability
* require Wither kill for Monsters Hunted
* properly removed 8 Emeralds item from item pool
* enchanting required for wither; fishing rod required for water breathing; water breathing required for elder guardian kill
* Added 12 new advancements (ported from old achievement system)
* renamed "On a Rail" for consistency with modern advancements
* tests for the new advancements
* moved slot_data generation for minecraft into worlds/minecraft/__init__.py, added logic_version to slot_data
* output minecraft options in the spoiler log
* modified advancement goal values for new advancements
* make non-native Minecraft items appear as Shovel in ALttP, and unknown-game items as Power Stars
* fixed glowstone block logic for Not Quite Nine Lives
* setup for shuffling MC structures: building ER world and shuffling regions/entrances
* ensured Nether Fortresses can't be placed in the End
* finished logic for structure randomization
* fixed nonnative items always showing up as Hammers in ALttP shops
* output minecraft structure info in the spoiler
* generate .apmc file for communication with MC client
* fixed structure rando always using the same seed
* move stuff to worlds/minecraft/Regions.py
* make output apmc file have consistent name with other files
* added minecraft bottle macro; fixed tests imports
* generalizing MC region generation
* restructured structure shuffling in preparation for structure plando
* only output structure rando info in spoiler if they are shuffled
* Force structure rando to always be off, for the stable release
* added Minecraft options to player settings
* formally added combat_difficulty as an option
* Added Ender Dragon into playthrough, cleaned up goal map
* Added new difficulties: Easy, Normal, Hard combat
* moved .apmc generation time to prevent outputs on failed generation
* updated tests for new combat logic
* Fixed bug causing generation to fail; removed Nether Fortress event since it should no longer be needed with the fix
* moved all MC-specific functions into gen_minecraft
* renamed "logic_version" to "client_version"
* bug fixes
properly flagged event locations/items with id None
moved generation back to Main.py to fix mysterious generation failures
* moved link_minecraft_regions into minecraft init, left create_regions in Main for caching
* added seed_name, player_name, client_version to apmc file
* reenabled structure shuffle
* added entrance tests for minecraft
Co-authored-by: achuang <alexander.w.chuang@gmail.com>
2021-05-08 07:38:57 -04:00
|
|
|
|
2021-07-12 18:05:46 +02:00
|
|
|
item_name_to_id = {name: data.code for name, data in item_table.items()}
|
|
|
|
location_name_to_id = {name: data.id for name, data in advancement_table.items()}
|
|
|
|
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
data_version = 4
|
2021-07-23 19:28:16 -04:00
|
|
|
|
2021-06-15 18:15:05 -05:00
|
|
|
def _get_mc_data(self):
|
2021-07-23 19:28:16 -04:00
|
|
|
exits = [connection[0] for connection in default_connections]
|
2021-06-15 18:15:05 -05:00
|
|
|
return {
|
|
|
|
'world_seed': self.world.slot_seeds[self.player].getrandbits(32),
|
|
|
|
'seed_name': self.world.seed_name,
|
2021-08-09 09:15:41 +02:00
|
|
|
'player_name': self.world.get_player_name(self.player),
|
2021-06-15 18:15:05 -05:00
|
|
|
'player_id': self.player,
|
|
|
|
'client_version': client_version,
|
2021-07-20 14:16:40 -04:00
|
|
|
'structures': {exit: self.world.get_entrance(exit, self.player).connected_region.name for exit in exits},
|
2022-04-08 21:15:39 +02:00
|
|
|
'advancement_goal': self.world.advancement_goal[self.player].value,
|
|
|
|
'egg_shards_required': min(self.world.egg_shards_required[self.player].value,
|
|
|
|
self.world.egg_shards_available[self.player].value),
|
|
|
|
'egg_shards_available': self.world.egg_shards_available[self.player].value,
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
'required_bosses': self.world.required_bosses[self.player].current_key,
|
2022-04-08 21:15:39 +02:00
|
|
|
'MC35': bool(self.world.send_defeated_mobs[self.player].value),
|
|
|
|
'death_link': bool(self.world.death_link[self.player].value),
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
'starting_items': str(self.world.starting_items[self.player].value),
|
|
|
|
'race': self.world.is_race,
|
2021-06-15 18:15:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
def generate_basic(self):
|
|
|
|
|
2021-07-14 08:42:55 -05:00
|
|
|
# Generate item pool
|
|
|
|
itempool = []
|
2021-08-04 16:12:33 -05:00
|
|
|
junk_pool = junk_weights.copy()
|
2021-07-31 02:41:58 -05:00
|
|
|
# Add all required progression items
|
2021-08-31 17:28:46 -04:00
|
|
|
for (name, num) in required_items.items():
|
2021-07-31 02:41:58 -05:00
|
|
|
itempool += [name] * num
|
|
|
|
# Add structure compasses if desired
|
2021-07-23 19:28:16 -04:00
|
|
|
if self.world.structure_compasses[self.player]:
|
|
|
|
structures = [connection[1] for connection in default_connections]
|
|
|
|
for struct_name in structures:
|
2021-07-31 02:41:58 -05:00
|
|
|
itempool.append(f"Structure Compass ({struct_name})")
|
2021-08-06 17:18:28 -05:00
|
|
|
# Add dragon egg shards
|
2022-02-20 12:30:04 -06:00
|
|
|
if self.world.egg_shards_required[self.player] > 0:
|
|
|
|
itempool += ["Dragon Egg Shard"] * self.world.egg_shards_available[self.player]
|
2021-07-31 02:41:58 -05:00
|
|
|
# Add bee traps if desired
|
2021-08-04 16:12:33 -05:00
|
|
|
bee_trap_quantity = ceil(self.world.bee_traps[self.player] * (len(self.location_names)-len(itempool)) * 0.01)
|
|
|
|
itempool += ["Bee Trap (Minecraft)"] * bee_trap_quantity
|
2021-07-31 02:41:58 -05:00
|
|
|
# Fill remaining items with randomly generated junk
|
2021-08-04 16:12:33 -05:00
|
|
|
itempool += self.world.random.choices(list(junk_pool.keys()), weights=list(junk_pool.values()), k=len(self.location_names)-len(itempool))
|
2021-07-31 02:41:58 -05:00
|
|
|
# Convert itempool into real items
|
|
|
|
itempool = [item for item in map(lambda name: self.create_item(name), itempool)]
|
2021-06-15 18:15:05 -05:00
|
|
|
|
2021-07-14 08:42:55 -05:00
|
|
|
# Choose locations to automatically exclude based on settings
|
|
|
|
exclusion_pool = set()
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
exclusion_types = ['hard', 'unreasonable']
|
2021-07-14 08:42:55 -05:00
|
|
|
for key in exclusion_types:
|
2021-07-02 20:27:41 -05:00
|
|
|
if not getattr(self.world, f"include_{key}_advancements")[self.player]:
|
2021-07-14 08:42:55 -05:00
|
|
|
exclusion_pool.update(exclusion_table[key])
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
# For postgame advancements, check with the boss goal
|
|
|
|
exclusion_pool.update(get_postgame_advancements(self.world.required_bosses[self.player].current_key))
|
2021-07-14 08:42:55 -05:00
|
|
|
exclusion_rules(self.world, self.player, exclusion_pool)
|
2021-06-15 18:15:05 -05:00
|
|
|
|
2021-08-28 16:44:48 -05:00
|
|
|
# Prefill event locations with their events
|
|
|
|
self.world.get_location("Blaze Spawner", self.player).place_locked_item(self.create_item("Blaze Rods"))
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
self.world.get_location("Ender Dragon", self.player).place_locked_item(self.create_item("Defeat Ender Dragon"))
|
|
|
|
self.world.get_location("Wither", self.player).place_locked_item(self.create_item("Defeat Wither"))
|
2021-07-31 02:41:58 -05:00
|
|
|
|
2021-07-14 08:42:55 -05:00
|
|
|
self.world.itempool += itempool
|
2021-06-15 18:15:05 -05:00
|
|
|
|
2022-05-19 09:37:26 -04:00
|
|
|
def get_filler_item_name(self) -> str:
|
|
|
|
return self.world.random.choices(list(junk_weights.keys()), weights=list(junk_weights.values()))[0]
|
|
|
|
|
2021-06-15 18:15:05 -05:00
|
|
|
def set_rules(self):
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
set_advancement_rules(self.world, self.player)
|
|
|
|
set_completion_rules(self.world, self.player)
|
2021-06-15 18:15:05 -05:00
|
|
|
|
|
|
|
def create_regions(self):
|
|
|
|
def MCRegion(region_name: str, exits=[]):
|
2021-07-16 12:23:05 +02:00
|
|
|
ret = Region(region_name, None, region_name, self.player, self.world)
|
|
|
|
ret.locations = [MinecraftAdvancement(self.player, loc_name, loc_data.id, ret)
|
2021-08-31 17:28:46 -04:00
|
|
|
for loc_name, loc_data in advancement_table.items()
|
2021-07-16 12:23:05 +02:00
|
|
|
if loc_data.region == region_name]
|
2021-08-31 17:28:46 -04:00
|
|
|
for exit in exits:
|
2021-06-15 18:15:05 -05:00
|
|
|
ret.exits.append(Entrance(self.player, exit, ret))
|
|
|
|
return ret
|
|
|
|
|
|
|
|
self.world.regions += [MCRegion(*r) for r in mc_regions]
|
2021-07-14 19:13:25 -05:00
|
|
|
link_minecraft_structures(self.world, self.player)
|
2021-06-15 18:15:05 -05:00
|
|
|
|
2021-07-21 18:08:15 +02:00
|
|
|
def generate_output(self, output_directory: str):
|
2021-06-15 18:15:05 -05:00
|
|
|
data = self._get_mc_data()
|
2022-04-02 22:47:42 -05:00
|
|
|
filename = f"AP_{self.world.seed_name}_P{self.player}_{self.world.get_file_safe_player_name(self.player)}.apmc"
|
2021-07-22 01:08:44 +02:00
|
|
|
with open(os.path.join(output_directory, filename), 'wb') as f:
|
2021-06-15 18:22:12 -05:00
|
|
|
f.write(b64encode(bytes(json.dumps(data), 'utf-8')))
|
2021-06-15 18:15:05 -05:00
|
|
|
|
2021-08-31 17:28:46 -04:00
|
|
|
def fill_slot_data(self):
|
2021-06-15 18:15:05 -05:00
|
|
|
slot_data = self._get_mc_data()
|
|
|
|
for option_name in minecraft_options:
|
|
|
|
option = getattr(self.world, option_name)[self.player]
|
MC: 1.17 support (#120)
* MC: add death_link option
* Minecraft: 1.17 advancements and logic support
* Update Minecraft tracker to 1.17
* Minecraft: add tests for new advancements
* removed jdk/forge download install out of iss and into MinecraftClient.py using flag --install
* Add required_bosses option
choices are none, ender_dragon, wither, both
postgame advancements are set according to the required boss for completion
* fix docstring for PostgameAdvancements
* Minecraft: add starting_items
List of dicts: item, amount, nbt
* Update descriptions for AdvancementGoal and EggShardsRequired
* Minecraft: fix tests for required_bosses attribute
* Minecraft: updated logic for various dragon-related advancements
Split the logic into can_respawn and can_kill dragon
Free the End, Monsters Hunted, The End Again still require both respawn and kill, since the player needs to kill and be credited with the kill
You Need a Mint and Is It a Plane now require only respawn, since the dragon need only be alive; if killed out of logic, it's ok
The Next Generation only requires kill, since the egg spawns regardless of whether the player was credited with the kill or not
* Minecraft client: ignore prereleases unless --prerelease flag is on
* explicitly state all defaults
change structure shuffle and structure compass defaults to true
update install tutorial to point to player-settings page, as well as removing instructions for manual install
* Minecraft client: add Minecraft version check
Adds a minecraft_version field in the apmc, and downloads only mods which contain that version in the name of the .jar file.
This ensures that the client remains compatible even if new mods are released for later versions, since they won't download a mod for a later version than the apmc says.
Co-authored-by: Kono Tyran <Kono.Tyran@gmail.com>
2021-11-30 20:37:11 -05:00
|
|
|
if slot_data.get(option_name, None) is None and type(option.value) in {str, int}:
|
|
|
|
slot_data[option_name] = int(option.value)
|
2021-06-15 18:15:05 -05:00
|
|
|
return slot_data
|
2021-07-12 13:54:47 +02:00
|
|
|
|
|
|
|
def create_item(self, name: str) -> Item:
|
|
|
|
item_data = item_table[name]
|
2021-07-15 08:46:07 -05:00
|
|
|
item = MinecraftItem(name, item_data.progression, item_data.code, self.player)
|
2021-07-23 19:28:16 -04:00
|
|
|
nonexcluded_items = ["Sharpness III Book", "Infinity Book", "Looting III Book"]
|
|
|
|
if name in nonexcluded_items: # prevent books from going on excluded locations
|
2021-07-23 08:55:44 -05:00
|
|
|
item.never_exclude = True
|
2021-07-15 08:46:07 -05:00
|
|
|
return item
|
2021-08-05 13:17:01 -05:00
|
|
|
|
2021-08-31 17:28:46 -04:00
|
|
|
def mc_update_output(raw_data, server, port):
|
2021-08-05 13:17:01 -05:00
|
|
|
data = json.loads(b64decode(raw_data))
|
|
|
|
data['server'] = server
|
|
|
|
data['port'] = port
|
|
|
|
return b64encode(bytes(json.dumps(data), 'utf-8'))
|