feat: add pk_waystones
This commit is contained in:
parent
75c54ab0cd
commit
c3ed27a7c3
364 changed files with 6374 additions and 66 deletions
|
|
@ -1 +1 @@
|
|||
password=e1637a19da349b620842aa85
|
||||
password=6f6e93a2445dee80621daca9
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
password: "e1637a19da349b620842aa85"
|
||||
password: "6f6e93a2445dee80621daca9"
|
||||
|
|
|
|||
|
|
@ -3,3 +3,7 @@ ignore-vanilla-permissions: false
|
|||
aliases:
|
||||
icanhasbukkit:
|
||||
- version $1-
|
||||
tp:
|
||||
- minecraft:tp $1-
|
||||
xp:
|
||||
- minecraft:xp $1-
|
||||
|
|
|
|||
BIN
datapacks/PK_Waystones_V.3.4.0_MC_1.20.6.zip
Normal file
BIN
datapacks/PK_Waystones_V.3.4.0_MC_1.20.6.zip
Normal file
Binary file not shown.
29
datapacks/PK_Waystones_V.3.4.0_MC_1.20.6/README.txt
Normal file
29
datapacks/PK_Waystones_V.3.4.0_MC_1.20.6/README.txt
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
―――――――――――――――――――――――――――――――――――――――――
|
||||
This data pack has been made by KawaMood
|
||||
―――――――――――――――――――――――――――――――――――――――――
|
||||
|
||||
Only websites I currently use to upload my content are Modrinth (modrinth.com), Planet Minecraft (planetminecraft.com) and my own host (kawamood.com).
|
||||
If this data pack has been downloaded from another website, that means my content has been stolen, so be careful with its content: this data pack can be outdated, or potentially even contains malicious files. Please be sure to download it from one of the websites/platforms stated in the "Links & Contact" section bellow and nowhere else.
|
||||
|
||||
―――――――――――――――――――――――――――――――――――――――――
|
||||
LICENCE
|
||||
―――――――――――――――――――――――――――――――――――――――――
|
||||
|
||||
This data pack follows the CC BY-NC-SA 4.0 licence: https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
|
||||
|
||||
You're free to share and adapt this content under the following terms:
|
||||
• Attribution (BY) — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
|
||||
• NonCommercial (NC) — You may not use the material for commercial purposes.
|
||||
• ShareAlike (SA) — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
|
||||
|
||||
―――――――――――――――――――――――――――――――――――――――――
|
||||
LINKS & CONTACT
|
||||
―――――――――――――――――――――――――――――――――――――――――
|
||||
|
||||
Mail: contact@kawamood.com
|
||||
Discord: https://discord.com/invite/w8s9XWgN6v
|
||||
Website: https://www.kawamood.com
|
||||
Modrinth: https://modrinth.com/user/KawaMood
|
||||
Planet Minecraft: https://www.planetminecraft.com/member/kawamood/
|
||||
Youtube: https://www.youtube.com/@KawaMood
|
||||
X (Twitter): https://twitter.com/KawaMood
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [{ "required": false, "id": "pk_waystones:_main/load" }]
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [{ "required": false, "id": "pk_waystones:_main/tick" }]
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:entity_hurt_player",
|
||||
"conditions": {
|
||||
"damage": {
|
||||
"source_entity": {
|
||||
"type": "#pk_waystones:fighting"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/entity_hurt_player/fighting"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"player": [
|
||||
{
|
||||
"condition": "minecraft:entity_properties",
|
||||
"entity": "this",
|
||||
"predicate": {
|
||||
"equipment": {
|
||||
"head": {
|
||||
"count": {
|
||||
"min": 1
|
||||
},
|
||||
"predicates": {
|
||||
"minecraft:custom_data": "{pk_data:{custom_block:1b,from:\"waystones\"}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/inventory_changed/equiped_custom_block"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": "minecraft:player_head",
|
||||
"predicates": {
|
||||
"minecraft:custom_data": "{pk_data:{custom_block:1b,id:\"waystone\",from:\"waystones\"}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/inventory_changed/has_waystone"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:any_block_use",
|
||||
"conditions": {
|
||||
"location": [
|
||||
{
|
||||
"condition": "minecraft:location_check",
|
||||
"predicate": {
|
||||
"block": {
|
||||
"nbt": "{Items:[{components:{\"minecraft:custom_data\":{pk_data:{gui:1b,custom_block:1b,id:\"waystone\",from:\"waystones\",in_use:0b}}}}]}"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/item_used_on_block/any_on_waystone_container"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:player_interacted_with_entity",
|
||||
"conditions": {
|
||||
"entity": [
|
||||
{
|
||||
"condition": "minecraft:entity_properties",
|
||||
"entity": "this",
|
||||
"predicate": {
|
||||
"type": "minecraft:interaction",
|
||||
"nbt": "{Tags:[\"pk.waystones.waystone.lock\"]}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/item_used_on_block/any_on_waystone_lock/run"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:tick"
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/once/run"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:placed_block",
|
||||
"conditions": {
|
||||
"location": [
|
||||
{
|
||||
"condition": "minecraft:location_check",
|
||||
"predicate": {
|
||||
"block": {
|
||||
"blocks": ["minecraft:dropper"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/placed_block/dropper"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:placed_block",
|
||||
"conditions": {
|
||||
"location": [
|
||||
{
|
||||
"condition": "minecraft:location_check",
|
||||
"predicate": {
|
||||
"block": {
|
||||
"blocks": ["minecraft:hopper"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/placed_block/hopper"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"criteria": {
|
||||
"requirement": {
|
||||
"trigger": "minecraft:placed_block",
|
||||
"conditions": {
|
||||
"location": [
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:custom_data": "{pk_data:{custom_block:1b,id:\"waystone\",from:\"waystones\"}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rewards": {
|
||||
"function": "pk_waystones:events/player/placed_block/waystone"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"criteria": {
|
||||
"has_an_ingredient": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": ["minecraft:amethyst_shard", "minecraft:ender_eye", "minecraft:lodestone", "minecraft:polished_andesite"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "pk_waystones:waystone/andesite"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [["has_the_recipe", "has_an_ingredient"]],
|
||||
"rewards": {
|
||||
"recipes": ["pk_waystones:waystone/andesite"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"criteria": {
|
||||
"has_an_ingredient": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": ["minecraft:amethyst_shard", "minecraft:ender_eye", "minecraft:lodestone", "minecraft:deepslate_bricks"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "pk_waystones:waystone/deepslate"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [["has_the_recipe", "has_an_ingredient"]],
|
||||
"rewards": {
|
||||
"recipes": ["pk_waystones:waystone/deepslate"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"criteria": {
|
||||
"has_an_ingredient": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": ["minecraft:amethyst_shard", "minecraft:ender_eye", "minecraft:lodestone", "minecraft:mossy_stone_bricks"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "pk_waystones:waystone/mossy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [["has_the_recipe", "has_an_ingredient"]],
|
||||
"rewards": {
|
||||
"recipes": ["pk_waystones:waystone/mossy"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"criteria": {
|
||||
"has_an_ingredient": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": ["minecraft:amethyst_shard", "minecraft:ender_eye", "minecraft:lodestone", "minecraft:nether_brick"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "pk_waystones:waystone/nether"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [["has_the_recipe", "has_an_ingredient"]],
|
||||
"rewards": {
|
||||
"recipes": ["pk_waystones:waystone/nether"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"criteria": {
|
||||
"has_an_ingredient": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": ["minecraft:amethyst_shard", "minecraft:ender_eye", "minecraft:lodestone", "minecraft:cut_sandstone"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "pk_waystones:waystone/sand"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [["has_the_recipe", "has_an_ingredient"]],
|
||||
"rewards": {
|
||||
"recipes": ["pk_waystones:waystone/sand"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Scores :
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Common to all PK data packs:
|
||||
# Informations
|
||||
# $gametime pk.value | used to store the current gametime
|
||||
# Logs
|
||||
# $logs.load pk.value | default: (undefined) | <=0 = mask load logs | (undefined) or >=1 = show load logs
|
||||
# $logs.tick pk.value | default: (undefined) | (undefined) or <=0 = mask tick logs | >=1 = show tick logs
|
||||
#
|
||||
# Concerning this specific datapack:
|
||||
# Logs (allow you to mask/show logs specific to this data pack
|
||||
# $logs.datapack.waystones pk.value | default: (undefined) | (undefined) or <=0 = masks | >=1 = show Waystones logs
|
||||
# Settings:
|
||||
# $pk.waystones.settings.limit_per_player pk.value | default: (undefined) | if set, defines the maximal amount of waystones a player can place
|
||||
# $pk.waystones.settings.limit_per_server pk.value | default: (undefined) | if set, defines the maximal amount of waystones the server can contain
|
||||
# $pk.waystones.settings.ignore_monsters pk.value | default: (undefined) | <=0 = disallow Waystones use if a monster is nearby | (undefined) or >=1 = ignore
|
||||
# $pk.waystones.settings.legacy_textures pk.value | default: (undefined) | (undefined) or <=0 = disable | >=1 = use legacy waystone textures
|
||||
# $pk.waystones.settings.display_nameplates pk.value | default: (undefined) | (undefined) or <=0 = hide | >=1 = show waystones names above themselves
|
||||
# $pk.waystones.settings.show_same_dimension_only pk.value | default: (undefined) | >=1 show only Waystones of same the dimension in a Waystone's menu
|
||||
# $pk.waystones.settings.default_visibility pk.value | default: (undefined) | (undefined) or 0 : discover | 1 : private | 2 : public
|
||||
# $pk.waystones.settings.xp_consumption.value pk.value | default: (undefined) | (undefined) or <=0 = disable | >=1 = blocks distance for consumption of a level / levels
|
||||
# $pk.waystones.settings.xp_consumption.mode pk.value | default: (undefined) | distance calculation method between two waystones | 0: "euclidian" | 1: "manhattan"
|
||||
# $pk.waystones.settings.hide_coordinates pk.value | default: (undefined) | (undefined) or 0 : show | 1 : hide coordinates for all players
|
||||
# $pk.waystones.settings.gui.extra_clear_delay pk.value | default: 2 | delay before running an extra command that clears all players waystones gui items
|
||||
# $pk.waystones.settings.lootable_delay pk.value | default: (undefined) | >=1 minimal age of existence for the waystone to loot when removed
|
||||
# $pk.waystones.settings.tick_clear_gui_items pk.value | default: (undefined) | (undefined) or 0 : disable | 1 : clear players waystones GUI items each tick
|
||||
# Permissions
|
||||
# $pk.waystones.permissions.change.visibility.discover pk.value | default: (undefined) | 0 = disable | (undefined) or 1 allow visibility change to "discover"
|
||||
# $pk.waystones.permissions.change.visibility.private pk.value | default: (undefined) | 0 = disable | (undefined) or 1 allow visibility change to "private"
|
||||
# $pk.waystones.permissions.change.visibility.public pk.value | default: (undefined) | 0 = disable | (undefined) or 1 allow visibility change to "public"
|
||||
# $pk.waystones.permissions.change.protection pk.value | default: (undefined) | 0 = disable | (undefined) or 1 allow protection change
|
||||
# $pk.waystones.permissions.change.shared_with pk.value | default: (undefined) | 0 = disable | (undefined) or 1 allow shared_with change
|
||||
# GUI settings:
|
||||
# Players settings:
|
||||
# pk.waystones.hide_coordinates : (undefined) or 0 = show | 1 = hide coordinates from the Waystones GUI (safety for video makers):
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Tags:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# pk.dev: Allow player to see data packs specific logs
|
||||
tag @s add pk.dev
|
||||
# pk.waystones.manager Allow player to bypass restrictions and manage other players Waystones
|
||||
tag @s add pk.waystones.manager
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#> pk_waystones:_main/install/initialize_blacklisted_dimensions
|
||||
# Initialize default blacklisted dimensions
|
||||
|
||||
data modify storage pk:waystones database.blacklist.dimensions set value [{id:"pk_creative_dimension:creative_superflat"},{id:"pk_cr_di:creative_superflat"}]
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
#> pk_waystones:_main/load
|
||||
# Main load
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Storage:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Define storage
|
||||
# pk:common | Used to store installed PK Datapacks names and version and for temp data manipulation
|
||||
# pk:waystones database | Database of Waystones
|
||||
#declare storage pk:common
|
||||
#declare storage pk:waystones
|
||||
|
||||
# Initialize PK data packs storage if needed
|
||||
execute unless data storage pk:common installed_datapacks[{}] run data modify storage pk:common installed_datapacks set value []
|
||||
|
||||
# Add current data pack into the PK data packs storage if needed
|
||||
execute unless data storage pk:common installed_datapacks[{id:"waystones"}] run data modify storage pk:common installed_datapacks append value {name:"Waystones",id:"waystones"}
|
||||
|
||||
# Initialize the storage used to store Waystones data
|
||||
execute unless data storage pk:waystones database.waystones[{}] run data modify storage pk:waystones database.waystones set value []
|
||||
execute unless data storage pk:waystones database.players[{}] run data modify storage pk:waystones database.players set value []
|
||||
execute unless data storage pk:waystones database.blacklist.dimensions[{}] run function pk_waystones:_main/install/initialize_blacklisted_dimensions
|
||||
|
||||
# Clear temp
|
||||
data remove storage pk:common temp
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Scores:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Define objectives that are common to each PK data pack:
|
||||
# pk.temp only concerns temp values that can be cleared at any time without risks.
|
||||
# pk.value is used for fixed values and variable settings, and won't be cleared on uninstallation until there is no PK data pack anymore.
|
||||
scoreboard objectives add pk.temp dummy
|
||||
scoreboard objectives add pk.value dummy
|
||||
scoreboard objectives add pk.custom_block.component.id dummy
|
||||
scoreboard objectives add pk.custom_block.interaction.id dummy
|
||||
|
||||
# Define objective that are specific to the current data pack
|
||||
# Tracking players actions:
|
||||
scoreboard objectives add pk.waystones.mined.barrel mined:barrel
|
||||
scoreboard objectives add pk.waystones.leave_game custom:leave_game
|
||||
scoreboard objectives add pk.waystones.in_fight dummy
|
||||
# Used for Waystones functioning:
|
||||
scoreboard objectives add pk.waystones.page dummy
|
||||
scoreboard objectives add pk.waystones.animations.timer dummy
|
||||
# Used to link players with their vehicle or pets
|
||||
scoreboard objectives add pk.waystones.group.id dummy
|
||||
# Used to allow a player to change its ability to see coordinates from the Waystones GUI (safety for video makers):
|
||||
scoreboard objectives add pk.waystones.hide_coordinates trigger
|
||||
# Used to store cooldown before a player can tp to another waystone
|
||||
scoreboard objectives add pk.waystones.tp_cooldown dummy
|
||||
# Used to store gametime to some entities to know when they were loaded last time
|
||||
scoreboard objectives add pk.waystones.gametime dummy
|
||||
|
||||
# Consts
|
||||
scoreboard players set $-1 pk.value -1
|
||||
scoreboard players set $18 pk.value 18
|
||||
scoreboard players set $20 pk.value 20
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Packages:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Air toggling
|
||||
function pk_waystones:packages/air_toggling/load
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Updates:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
function pk_waystones:_main/update/start
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Logs:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
execute unless score $logs.load pk.value matches ..0 run tellraw @a [{"text": "Loaded ","color": "yellow"},{"text": "KawaMood's Waystones ","color": "aqua","bold": true},{"text": "(V.","color": "aqua"},{"nbt":"installed_datapacks[{id:\"waystones\"}].version", "storage": "pk:common","color": "aqua"},{"text": ")","color": "aqua"},{"text": " successfully"}]
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#> pk_waystones:_main/tick
|
||||
# Main tick
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Utilities:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Store the current gametime
|
||||
execute store result score $gametime pk.value run time query gametime
|
||||
# Allow players to change their own waystones-related settings
|
||||
scoreboard players enable @a pk.waystones.hide_coordinates
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Settings:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Tp cooldown
|
||||
scoreboard players remove @a[scores={pk.waystones.tp_cooldown=1..}] pk.waystones.tp_cooldown 1
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Events:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Player joined back
|
||||
execute as @a[scores={pk.waystones.leave_game=1..}] at @s run function pk_waystones:events/player/joined_back/run
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Custom blocks:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Waystones
|
||||
execute as @e[type=marker,tag=pk.waystones.waystone.controller] at @s run function pk_waystones:blocks/waystone/main/tick
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Flags:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Player mined barrel
|
||||
scoreboard players set @a[scores={pk.waystones.mined.barrel=1..}] pk.waystones.mined.barrel 0
|
||||
# Player is in fight
|
||||
scoreboard players remove @a[scores={pk.waystones.in_fight=1..}] pk.waystones.in_fight 1
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Safety:
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
execute if score $pk.waystones.settings.tick_clear_gui_items pk.value matches 1.. run clear @a *[custom_data~{pk_data:{gui:1b,from:"waystones"}}]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#> pk_waystones:_main/uninstall/1
|
||||
|
||||
data modify storage pk:waystones uninstall.waystone set from storage pk:waystones uninstall.waystones[-1]
|
||||
function pk_waystones:_main/uninstall/2 with storage pk:waystones uninstall.waystone.location
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#> pk_waystones:_main/uninstall/2
|
||||
|
||||
# Check if the chunk is already forceloaded and forceload it if needed
|
||||
$execute in $(dimension) store result score $pk.waystones.uninstall.chunk.already_forceload pk.value run forceload query $(x) $(z)
|
||||
$execute in $(dimension) if score $pk.waystones.uninstall.chunk.already_forceload pk.value matches 0 run forceload add $(x) $(z)
|
||||
|
||||
# Wait one second and check if the chunk is fully loaded
|
||||
schedule function pk_waystones:_main/uninstall/3 1s
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:_main/uninstall/3
|
||||
|
||||
function pk_waystones:_main/uninstall/4 with storage pk:waystones uninstall.waystone.location
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#> pk_waystones:_main/uninstall/4
|
||||
|
||||
# Check if the chunk of the waystone to remove is loaded
|
||||
scoreboard players set $is_loaded pk.temp 0
|
||||
$execute in $(dimension) if loaded $(x) $(y) $(z) run scoreboard players set $is_loaded pk.temp 1
|
||||
|
||||
# If yes, remove all waystones entities and blocks from the chunk
|
||||
execute unless score $is_loaded pk.temp matches 0 run function pk_waystones:_main/uninstall/5 with storage pk:waystones uninstall.waystone.location
|
||||
|
||||
# If not, wait 1 second and retry
|
||||
execute if score $is_loaded pk.temp matches 0 run schedule function pk_waystones:_main/uninstall/3 1s
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#> pk_waystones:_main/uninstall/5
|
||||
# @context any at the waystone to remove (chunk loaded)
|
||||
|
||||
# Logs
|
||||
tellraw @a[tag=pk.waystones.uninstaller] [{"text": "Removed Waystone at [","color": "gray"},{"nbt":"uninstall.waystone.location.x","storage":"pk:waystones"},{"text": ","},{"nbt":"uninstall.waystone.location.y","storage":"pk:waystones"},{"text": ","},{"nbt":"uninstall.waystone.location.z","storage":"pk:waystones"},{"text": "] in "},{"nbt":"uninstall.waystone.location.dimension","storage":"pk:waystones"}]
|
||||
|
||||
# Remove waystones blocks and entities
|
||||
execute at @e[type=marker,tag=pk.waystones.waystone.controller] run fill ~ ~-1 ~ ~ ~ ~ air
|
||||
kill @e[type=#pk_waystones:custom_block/components,tag=pk.waystones.waystone.component]
|
||||
|
||||
# Unload the chunk if needed
|
||||
execute if score $pk.waystones.uninstall.chunk.already_forceload pk.value matches 0 run forceload remove ~ ~
|
||||
|
||||
# Continue process with next waystone to remove, or stop it if there are no waystones anymore
|
||||
data remove storage pk:waystones uninstall.waystones[-1]
|
||||
scoreboard players remove $pk.waystones.uninstall.waystones.length pk.value 1
|
||||
execute if score $pk.waystones.uninstall.waystones.length pk.value matches 0 as @a[tag=pk.waystones.uninstaller] run function pk_waystones:_main/uninstall/stop
|
||||
execute unless score $pk.waystones.uninstall.waystones.length pk.value matches 0 run function pk_waystones:_main/uninstall/1
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#> pk_waystones:_main/uninstall/remove_all_features
|
||||
|
||||
# Clear scores
|
||||
scoreboard objectives remove pk.value
|
||||
scoreboard objectives remove pk.temp
|
||||
scoreboard objectives remove pk.custom_block.component.id
|
||||
scoreboard objectives remove pk.custom_block.interaction.id
|
||||
scoreboard objectives remove pk.custom_block.facing
|
||||
scoreboard objectives remove pk.custom_block.move.timer
|
||||
scoreboard objectives remove pk.crafted.knowledge_book
|
||||
|
||||
# Clear storage
|
||||
data remove storage pk:common temp
|
||||
data remove storage pk:common installed_datapack
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#> pk_waystones:_main/uninstall/remove_specific_features
|
||||
|
||||
# Clear scores
|
||||
scoreboard objectives remove pk.waystones.mined.barrel
|
||||
scoreboard objectives remove pk.waystones.leave_game
|
||||
scoreboard objectives remove pk.waystones.in_fight
|
||||
scoreboard objectives remove pk.waystones.page
|
||||
scoreboard objectives remove pk.waystones.animations.timer
|
||||
scoreboard objectives remove pk.waystones.group.id
|
||||
scoreboard objectives remove pk.waystones.hide_coordinates
|
||||
scoreboard objectives remove pk.waystones.gametime
|
||||
|
||||
# Clear storage
|
||||
data remove storage pk:waystones database
|
||||
data remove storage pk:waystones uninstall
|
||||
data remove storage pk:common installed_datapack[{id:"waystones"}]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#> pk_waystones:_main/uninstall/start
|
||||
|
||||
tag @s add pk.waystones.uninstaller
|
||||
tellraw @s [{"text": "Starting ","color": "gray"},{"text": "KawaMood's Waystones","color": "aqua","bold": true},{"text": " uninstallation...","color": "gray"}]
|
||||
execute store result score $pk.waystones.uninstall.waystones.length pk.value run data get storage pk:waystones database.waystones
|
||||
data modify storage pk:waystones uninstall.waystones set from storage pk:waystones database.waystones
|
||||
execute if score $pk.waystones.uninstall.waystones.length pk.value matches 0 run function pk_waystones:_main/uninstall/stop
|
||||
execute if score $pk.waystones.uninstall.waystones.length pk.value matches 1.. run function pk_waystones:_main/uninstall/1
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#> pk_waystones:_main/uninstall/stop
|
||||
# @context the player who had run the uninstallation
|
||||
|
||||
# Unmark uninstaller
|
||||
tag @s remove pk.waystones.uninstaller
|
||||
|
||||
# Clear the current data pack's specific scores and storage
|
||||
function pk_waystones:_main/uninstall/remove_specific_features
|
||||
|
||||
# Clear all KawaMood's data packs scores and storage if no more KawaMood's data packs are installed
|
||||
execute unless data storage pk:common installed_datapack[{}] unless data storage pk.common:data Datapacks[{}] run function pk_waystones:_main/uninstall/remove_all_features
|
||||
|
||||
# Logs
|
||||
tellraw @s [{"text": "Uninstalled ","color": "yellow"},{"text": "KawaMood's Waystones ","color": "aqua","bold": true},{"text": " successfully"},{"text": "\nYou can now safely remove this data pack from the folder of your world","color": "yellow"}]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#> pk_waystones:_main/update/from_v2/after_recreated_all_blocks
|
||||
|
||||
# Update players in database
|
||||
function pk_waystones:tools/debug/update_players/start {source:"pk:waystones database.players", fallback: "function pk_waystones:_main/update/from_v2/stop"}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#> pk_waystones:_main/update/from_v2/blocks/id/waystone
|
||||
# @input
|
||||
# storage pk:common update.old_entry: The current entry from the blocks list to update
|
||||
|
||||
# Prepare new entry
|
||||
data modify storage pk:common update.new_entry set value {discovered_by:[],shared_with:[],visibility:"public"}
|
||||
|
||||
# Set data from old to new entries
|
||||
# Id
|
||||
data modify storage pk:common update.new_entry.id set from storage pk:common update.old_entry.id
|
||||
# Owner
|
||||
data modify storage pk:common update.new_entry.owner set from storage pk:common update.old_entry.Owner.UUID
|
||||
# Variant
|
||||
data modify storage pk:common update.new_entry.variant set from storage pk:common update.old_entry.Type
|
||||
execute if data storage pk:common update.old_entry{Type:"regular"} run data modify storage pk:common update.new_entry.variant set value "andesite"
|
||||
# Name
|
||||
data modify storage pk:common update.new_entry.name set from storage pk:common update.old_entry.Name
|
||||
# Location
|
||||
data modify storage pk:common update.new_entry.location.x set from storage pk:common update.old_entry.x
|
||||
data modify storage pk:common update.new_entry.location.y set from storage pk:common update.old_entry.y
|
||||
data modify storage pk:common update.new_entry.location.z set from storage pk:common update.old_entry.z
|
||||
data modify storage pk:common update.new_entry.location.dimension set from storage pk:common update.old_entry.Dimension
|
||||
# Protection
|
||||
data modify storage pk:common update.new_entry.protected set from storage pk:common update.old_entry.Waypoint.tag.pkData.Protected
|
||||
# Visibility
|
||||
execute if data storage pk:common update.old_entry.Waypoint.tag.pkData{Private:1b} run data modify storage pk:common update.new_entry.visibility set value "private"
|
||||
# Render item
|
||||
# will be redefined during the creation, from the block the waystone should be replaced on
|
||||
# @within function pk_waystones:blocks/waystone/place/replace/run
|
||||
# Created at gametime
|
||||
execute store result storage pk:common update.new_entry.created_at_gametime int 1 run time query gametime
|
||||
|
||||
# Append owner to the database if it doesn't exist yet
|
||||
data modify storage pk:common update.new_player set value {name:""}
|
||||
data modify storage pk:common update.new_player.uuid set from storage pk:common update.new_entry.owner
|
||||
data modify storage pk:common temp.args set value {p1:"execute unless data storage pk:waystones database.players[{uuid:",p2:"}] run data modify storage pk:waystones database.players prepend from storage pk:common update.new_player"}
|
||||
data modify storage pk:common temp.args.v1 set from storage pk:common update.new_player.uuid
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
|
||||
# Append new entry to the database if the id doesn't exist yet
|
||||
data modify storage pk:common temp.args set value {p1:"execute unless data storage pk:waystones database.waystones[{id:",p2:"}] run data modify storage pk:waystones database.waystones prepend from storage pk:common update.new_entry"}
|
||||
data modify storage pk:common temp.args.v1 set from storage pk:common update.new_entry.id
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#> pk_waystones:_main/update/from_v2/blocks/recursive
|
||||
|
||||
# Migration of the entry
|
||||
data modify storage pk:common update.old_entry set from storage pk:common update.blocks[-1]
|
||||
$function pk_waystones:_main/update/from_v2/blocks/id/$(block_id)
|
||||
|
||||
# Recursive call
|
||||
data remove storage pk:common update.blocks[-1]
|
||||
scoreboard players remove $pk.update.blocks.length pk.value 1
|
||||
execute if score $pk.update.blocks.length pk.value matches 1.. run function pk_waystones:_main/update/from_v2/blocks/recursive with storage pk:common update.params
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#> pk_waystones:_main/update/from_v2/blocks/start
|
||||
# @input
|
||||
# $source (string): storage path to the list of blocks to recreate
|
||||
# $block_id (string): id of the block to udpate
|
||||
|
||||
# Prepare data
|
||||
$data modify storage pk:common update.blocks set from storage $(source)
|
||||
$data modify storage pk:common update.params.block_id set value "$(block_id)"
|
||||
scoreboard players set $pk.update.blocks.length pk.value 0
|
||||
execute store result score $pk.update.blocks.length pk.value run data get storage pk:common update.blocks
|
||||
|
||||
# Stop if no there is block to update
|
||||
execute if score $pk.update.blocks.length pk.value matches 0 run return fail
|
||||
# @continue Start update
|
||||
execute if score $pk.update.blocks.length pk.value matches 1.. run function pk_waystones:_main/update/from_v2/blocks/recursive with storage pk:common update.params
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#> pk_waystones:_main/update/from_v2/start
|
||||
|
||||
# Check if an update is in progress
|
||||
execute if score $update pk.value matches 1 run tellraw @s {"text": "Error: Another update is already in progress.","color": "red"}
|
||||
execute if score $update pk.value matches 1 run return fail
|
||||
|
||||
# Mark updater
|
||||
tag @s add pk.update_from_v2
|
||||
|
||||
# Starting the process
|
||||
tellraw @s [{"text": "Starting to update all features from ","color": "gray"},{"text": "KawaMood's Waystones (V.2)","color": "aqua","bold": true},{"text": "...","color": "gray"}]
|
||||
scoreboard players set $update pk.value 1
|
||||
data remove storage pk:common update
|
||||
|
||||
# Update stored blocks in database
|
||||
# Waystones
|
||||
function pk_waystones:_main/update/from_v2/blocks/start {source:"pk.waystones:data Blocks.Waystones",block_id:"waystone"}
|
||||
|
||||
# Recreate all blocks
|
||||
function pk_waystones:tools/debug/recreate_all_blocks/start {source:"pk:waystones database.waystones", block_id:"waystone", fallback: "function pk_waystones:_main/update/from_v2/after_recreated_all_blocks"}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#> pk_waystones:_main/update/from_v2/stop
|
||||
|
||||
# Reset score
|
||||
scoreboard players reset $update pk.value
|
||||
|
||||
# Logs
|
||||
tellraw @a[tag=pk.update_from_v2,limit=1] [{"text": "Updated all Waystones from ","color": "yellow"},{"text": "KawaMood's Waystones (V.2)","color": "aqua","bold": true},{"text": " successfully."}]
|
||||
|
||||
# Unmark updater
|
||||
tag @a[tag=pk.update_from_v2,limit=1] remove pk.update_from_v2
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#> pk_waystones:_main/update/start
|
||||
# Update the current data pack if needed
|
||||
|
||||
# V.3.1.0
|
||||
execute unless score $pk.waystones.version pk.value matches 1.. run function pk_waystones:_main/update/versions/3_1_0
|
||||
# V.3.3.0
|
||||
execute unless score $pk.waystones.version pk.value matches 9.. run function pk_waystones:_main/update/versions/3_3_0
|
||||
# V.3.3.2
|
||||
execute unless score $pk.waystones.version pk.value matches 30302.. run function pk_waystones:_main/update/versions/3_3_2/start
|
||||
# V.3.4.0
|
||||
execute unless score $pk.waystones.version pk.value matches 30400.. run function pk_waystones:_main/update/versions/3_4_0
|
||||
|
||||
# Set the data pack current version score
|
||||
scoreboard players set $pk.waystones.version pk.value 30400
|
||||
data modify storage pk:common installed_datapacks[{id:"waystones"}].version set value "3.4.0"
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#> pk_waystones:blocks/waystone/environment/blocks/verify_droppers
|
||||
# Prevent droppers to face the container block
|
||||
|
||||
execute if block ~-1 ~ ~ dropper[facing=east] run setblock ~-1 ~ ~ dropper[facing=up]
|
||||
execute if block ~1 ~ ~ dropper[facing=west] run setblock ~1 ~ ~ dropper[facing=up]
|
||||
execute if block ~ ~ ~-1 dropper[facing=south] run setblock ~ ~ ~-1 dropper[facing=up]
|
||||
execute if block ~ ~ ~1 dropper[facing=north] run setblock ~ ~ ~1 dropper[facing=up]
|
||||
execute if block ~ ~1 ~ dropper[facing=down] run setblock ~ ~1 ~ dropper[facing=up]
|
||||
execute if block ~ ~-1 ~ dropper[facing=up] run setblock ~ ~1 ~ dropper[facing=down]
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#> pk_waystones:blocks/waystone/environment/blocks/verify_hoppers
|
||||
# Prevent hoppers to face the container block or be set bellow it
|
||||
|
||||
# Change adjacent hoppers facing state
|
||||
execute if block ~-1 ~ ~ hopper[facing=east] run setblock ~-1 ~ ~ hopper[facing=down]
|
||||
execute if block ~1 ~ ~ hopper[facing=west] run setblock ~1 ~ ~ hopper[facing=down]
|
||||
execute if block ~ ~ ~-1 hopper[facing=south] run setblock ~ ~ ~-1 hopper[facing=down]
|
||||
execute if block ~ ~ ~1 hopper[facing=north] run setblock ~ ~ ~1 hopper[facing=down]
|
||||
execute if block ~ ~1 ~ hopper[facing=down] run setblock ~ ~1 ~ hopper[facing=south]
|
||||
|
||||
# Remove hopper placed bellow the block
|
||||
execute if block ~ ~-1 ~ hopper run setblock ~ ~-1 ~ air destroy
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#> pk_waystones:blocks/waystone/environment/entities/hopper_minecart_remove
|
||||
|
||||
summon item ~ ~ ~ {Item:{id:"minecraft:hopper_minecart",count:1}}
|
||||
kill @s
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#> pk_waystones:blocks/waystone/environment/entities/monsters_nearby/check
|
||||
|
||||
# Check if there is at least a hostile mob nearby
|
||||
execute store result score $monsters_nearby pk.temp align xyz positioned ~-8 ~-5 ~-8 if entity @e[type=#pk_waystones:boss_and_hostile,dx=15,dy=9,dz=15,limit=1]
|
||||
|
||||
# If it is the case and if the current Waystone isn't in use, lock it
|
||||
execute if score $monsters_nearby pk.temp matches 1.. if entity @s[tag=!pk.custom_block.locked.monsters_nearby] run function pk_waystones:blocks/waystone/environment/entities/monsters_nearby/start
|
||||
|
||||
# Otherwise and if the waystone is currently locked, unlock it
|
||||
execute if score $monsters_nearby pk.temp matches 0 if entity @s[tag=pk.custom_block.locked.monsters_nearby] run function pk_waystones:blocks/waystone/environment/entities/monsters_nearby/stop
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#> pk_waystones:blocks/waystone/environment/entities/monsters_nearby/lock_interaction_prepare
|
||||
# Prepare the lock interaction
|
||||
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
tag @s add pk.waystones.waystone.lock
|
||||
tag @s add pk.custom_block.lock
|
||||
tag @s add pk.custom_block.lock.monsters_nearby
|
||||
data merge entity @s {width:1.002f,height:1.002f,response:1b}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#> pk_waystones:blocks/waystone/environment/entities/monsters_nearby/start
|
||||
# @context the current waystone controller, at @s
|
||||
|
||||
# Store component-id score from controller
|
||||
scoreboard players operation $temp pk.custom_block.component.id = @s pk.custom_block.component.id
|
||||
|
||||
# Mark as currently locked
|
||||
tag @s add pk.custom_block.locked.monsters_nearby
|
||||
|
||||
# Summon lock interaction entity
|
||||
execute align xyz positioned ~0.4995 ~-0.0005 ~0.4995 summon interaction run function pk_waystones:blocks/waystone/environment/entities/monsters_nearby/lock_interaction_prepare
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#> pk_waystones:blocks/waystone/environment/entities/monsters_nearby/stop
|
||||
# @context the current waystone controller, at @s
|
||||
|
||||
# Store component-id score from controller
|
||||
scoreboard players operation $temp pk.custom_block.component.id = @s pk.custom_block.component.id
|
||||
|
||||
# Unmark controller
|
||||
tag @s remove pk.custom_block.locked.monsters_nearby
|
||||
|
||||
# Remove the lock interaction
|
||||
execute align xyz run kill @e[type=interaction,tag=pk.custom_block.lock.monsters_nearby,dx=0,predicate=pk_waystones:scores/custom_block/component_id/match_temp,limit=1]
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#> pk_waystones:blocks/waystone/environment/tick
|
||||
# Monitor adjacent/current block(s) and near entities
|
||||
# Adjacent hoppers and droppers are checked when a player place one within advancements
|
||||
# @context the waystone controller at @s
|
||||
|
||||
# Set scores
|
||||
scoreboard players set $env.stop pk.temp 0
|
||||
|
||||
# Check if a block of the Waystone has been destroyed
|
||||
execute unless predicate pk_waystones:block_sets/waystone/is_complete run function pk_waystones:blocks/waystone/remove/try/start
|
||||
execute if score $env.stop pk.temp matches 1 run return 1
|
||||
|
||||
# Remove hopper minecarts being at range to draw items from the container block
|
||||
execute positioned ~-0.5 ~-2.01 ~-0.5 as @e[type=hopper_minecart,dy=1.01] at @s run function pk_waystones:blocks/waystone/environment/entities/hopper_minecart_remove
|
||||
|
||||
# Check if there are hostile mobs nearby
|
||||
execute if score $pk.waystones.settings.ignore_monsters pk.value matches ..0 run function pk_waystones:blocks/waystone/environment/entities/monsters_nearby/check
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#> pk_waystones:blocks/waystone/main/on_entity_load
|
||||
# Trigger once when the waystone is placed and every time it is loaded from an unloaded area
|
||||
# @context current waystone's controller (tag=pk.current.controller) at @s
|
||||
|
||||
# Prepare score
|
||||
scoreboard players operation $temp pk.custom_block.component.id = @s pk.custom_block.component.id
|
||||
scoreboard players operation @s pk.waystones.gametime = $gametime pk.value
|
||||
|
||||
# Store the current waystone's data in pk:common temp.waystone
|
||||
data remove storage pk:common temp.waystone
|
||||
data modify storage pk:common temp.args set value {p1:"data modify storage pk:common temp.waystone set from storage pk:waystones database.waystones[{id:",p2:"}]"}
|
||||
data modify storage pk:common temp.args.v1 set from entity @s data.waystone.id
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
|
||||
# Check if the data pack's version updated
|
||||
scoreboard players set $controller.version pk.temp 0
|
||||
execute store result score $controller.version pk.temp run data get entity @s data.waystone.version
|
||||
execute if score $controller.version pk.temp < $pk.waystones.version pk.value run function pk_waystones:blocks/waystone/main/versions/on_update
|
||||
|
||||
# Check if settings have been updated
|
||||
function pk_waystones:blocks/waystone/main/settings/check
|
||||
|
||||
# Debug logs
|
||||
execute if score $logs.datapack.waystones pk.value matches 1 run tellraw @a[tag=pk.dev] [{"text": "Waystone loaded at [","color": "gray"},{"nbt":"temp.waystone.location.x","storage":"pk:common"},{"text": ","},{"nbt":"temp.waystone.location.y","storage":"pk:common"},{"text": ","},{"nbt":"temp.waystone.location.z","storage":"pk:common"},{"text": "] in "},{"nbt":"temp.waystone.location.dimension","storage":"pk:common"}]
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#> pk_waystones:blocks/waystone/main/settings/check
|
||||
# Trigger once when the waystone is placed and every time it is loaded from an unloaded area
|
||||
# Update the waystone if any setting have been changed in the meantime
|
||||
# @context current waystone's controller (tag=pk.current.controller) at @s
|
||||
|
||||
# Name Above
|
||||
execute unless score $pk.waystones.settings.display_nameplates pk.value matches 1 unless entity @s[tag=pk.waystones.settings.display_nameplates.0] run function pk_waystones:blocks/waystone/main/settings/display_nameplates/0
|
||||
execute if score $pk.waystones.settings.display_nameplates pk.value matches 1 unless entity @s[tag=pk.waystones.settings.display_nameplates.1] run function pk_waystones:blocks/waystone/main/settings/display_nameplates/1
|
||||
|
||||
# Legacy Textures
|
||||
execute unless score $pk.waystones.settings.legacy_textures pk.value matches 1 unless entity @s[tag=pk.waystones.settings.legacy_textures.0] run function pk_waystones:blocks/waystone/main/settings/legacy_textures/0
|
||||
execute if score $pk.waystones.settings.legacy_textures pk.value matches 1 unless entity @s[tag=pk.waystones.settings.legacy_textures.1] run function pk_waystones:blocks/waystone/main/settings/legacy_textures/1
|
||||
|
||||
# Monster Nearby
|
||||
execute if score $pk.waystones.settings.ignore_monsters pk.value matches ..0 run function pk_waystones:blocks/waystone/environment/entities/monsters_nearby/stop
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#> pk_waystones:blocks/waystone/main/settings/display_nameplates/0
|
||||
# @context current waystone's controller (tag=pk.current.controller) at @s
|
||||
|
||||
# Update tags
|
||||
tag @s remove pk.waystones.settings.display_nameplates.1
|
||||
tag @s add pk.waystones.settings.display_nameplates.0
|
||||
|
||||
# Remove visible name
|
||||
kill @e[type=#pk_waystones:custom_block/components,tag=pk.waystones.waystone.component,tag=pk.waystones.waystone.name,predicate=pk_waystones:scores/custom_block/component_id/match_temp,distance=..1,limit=1]
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#> pk_waystones:blocks/waystone/main/settings/display_nameplates/1
|
||||
# @context current waystone's controller (tag=pk.current.controller) at @s
|
||||
|
||||
# Update tags
|
||||
tag @s remove pk.waystones.settings.display_nameplates.0
|
||||
tag @s add pk.waystones.settings.display_nameplates.1
|
||||
|
||||
# Place visible name
|
||||
execute store result score $has_default_name pk.temp if data storage pk:common temp.waystone{name:'{"text":"Waystone","italic": false,"color": "yellow"}'}
|
||||
execute if score $has_default_name pk.temp matches 0 positioned ~ ~0.8 ~ summon text_display run function pk_waystones:blocks/waystone/place/components/visible_name_prepare
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#> pk_waystones:blocks/waystone/main/settings/legacy_textures/0
|
||||
# @context current waystone's controller (tag=pk.current.controller) at @s
|
||||
|
||||
# Update tags
|
||||
tag @s remove pk.waystones.settings.legacy_textures.1
|
||||
tag @s add pk.waystones.settings.legacy_textures.0
|
||||
|
||||
# Remove middle part skin if needed
|
||||
kill @e[type=#pk_waystones:custom_block/components,tag=pk.waystones.waystone.component,tag=pk.part.middle,predicate=pk_waystones:scores/custom_block/component_id/match_temp,distance=..2]
|
||||
|
||||
# Place middle part
|
||||
data modify storage pk:common temp.args.variant set from storage pk:common temp.waystone.variant
|
||||
execute align xyz positioned ~ ~-1 ~ run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_start with storage pk:common temp.args
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#> pk_waystones:blocks/waystone/main/settings/legacy_textures/1
|
||||
# @context current waystone's controller (tag=pk.current.controller) at @s
|
||||
|
||||
# Update tags
|
||||
tag @s remove pk.waystones.settings.legacy_textures.0
|
||||
tag @s add pk.waystones.settings.legacy_textures.1
|
||||
|
||||
# Remove middle part skin if needed
|
||||
kill @e[type=#pk_waystones:custom_block/components,tag=pk.waystones.waystone.component,tag=pk.part.middle,predicate=pk_waystones:scores/custom_block/component_id/match_temp,distance=..2]
|
||||
|
||||
# Place middle part
|
||||
data modify storage pk:common temp.args.variant set from storage pk:common temp.waystone.variant
|
||||
execute align xyz positioned ~ ~-1 ~ run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/legacy_start with storage pk:common temp.args
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#> pk_waystones:blocks/waystone/main/tick
|
||||
# Ticking waystones
|
||||
# @context marker with the tag "pk.waystones.waystone.controller" at @s
|
||||
|
||||
# Mark the current controller
|
||||
tag @s add pk.current.controller
|
||||
|
||||
# Each time the entity is loaded
|
||||
scoreboard players add @s pk.waystones.gametime 1
|
||||
execute unless score $gametime pk.value = @s pk.waystones.gametime run function pk_waystones:blocks/waystone/main/on_entity_load
|
||||
|
||||
# When being used by a player
|
||||
execute if entity @s[tag=pk.custom_block.in_use] run function pk_waystones:blocks/waystone/use/tick
|
||||
|
||||
# Watch environnement (blocks, entities and light)
|
||||
function pk_waystones:blocks/waystone/environment/tick
|
||||
|
||||
# Animations
|
||||
scoreboard players add @s pk.waystones.animations.timer 1
|
||||
execute if entity @s[scores={pk.waystones.animations.timer=5}] run particle enchant ~ ~1 ~ 0.5 0.5 0.5 0.001 1
|
||||
scoreboard players set @s[scores={pk.waystones.animations.timer=5}] pk.waystones.animations.timer 0
|
||||
|
||||
# Unmark the current controller
|
||||
tag @s remove pk.current.controller
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#> pk_waystones:blocks/waystone/place/available_container
|
||||
# @context should be set at container
|
||||
|
||||
# Set container
|
||||
setblock ~ ~ ~ air
|
||||
setblock ~ ~ ~ barrel[facing=down]{CustomName:'{"text":"Waystone"}',Items:[{id:"minecraft:light_gray_stained_glass_pane",count:1,components:{"minecraft:custom_data":{pk_data:{custom_block:1b,id:"waystone",from:"waystones",gui:1b,in_use:0b}}},Slot:0b}]}
|
||||
|
||||
# Prepare container custom name
|
||||
data modify storage pk:common temp.args set value {p1:"data modify storage pk:common temp.custom_name set from storage pk:waystones database.waystones[{id:",p2:"}].name"}
|
||||
execute align xyz run data modify storage pk:common temp.args.v1 set from entity @e[type=marker,tag=pk.waystones.waystone.controller,dx=0,limit=1] data.waystone.id
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
execute unless data storage pk:common temp{custom_name:'{"text":"Waystone","italic": false,"color": "yellow"}'} run data modify block ~ ~ ~ CustomName set from storage pk:common temp.custom_name
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/controller_prepare
|
||||
|
||||
# Prepare scores
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Set tags
|
||||
data modify entity @s Tags set value ["pk.custom_block","pk.custom_block.container","pk.waystones.waystone","pk.waystones.waystone.component","pk.waystones.waystone.controller"]
|
||||
|
||||
# Store version
|
||||
execute store result storage pk:common temp.waystone.version int 1 run scoreboard players get $pk.waystones.version pk.value
|
||||
|
||||
# Store information to the controller
|
||||
data modify entity @s data.waystone.id set from storage pk:common temp.waystone.id
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/_example
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"andesite",base2:"polished_andesite_slab",base3:"polished_andesite_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjYzZDhiODhjYjgxMzQxY2Y5ODllYTI0MWRmM2EyZDlhYzRkZTJiZjExNDhiY2Q1ODY4ZDNhZjUzOGExODQzNCJ9fX0=",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTJlN2VlNjhiN2Y2OGY4MGZhZTMwNDU1ZWRkOTUxZmI2ZmQ4ZjViMGFiOWIyZjYwMDQzN2NhYjdkNzIwMWYwOCJ9fX0=",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTQ1ZmZiMTQxNWY1MzRmZjUxMzAzMzM5NTgzYTQwOThlYmIxNTE1OGU2NzllNWM2MWJmZjFjYjBhY2YyNjBkOCJ9fX0=",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2JhODk3ZmM1Y2E0OGY2NmE5NTk1ZmRmZGEyMmRiZGYyZDE0ODU1OTgzMzcwYTBhMmRiOWFjMzkyNzg2Njk0NiJ9fX0=",middle_legacy:"lodestone",top1:"polished_andesite_slab"}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/andesite
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"andesite",base2:"polished_andesite_slab",base3:"polished_andesite_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg2YTgyN2U5Yjg0YWVkNDllY2UyY2NkN2I0NjE1ZTFlNGMwNDNlYTg0MTkwZDhhYmY0NjUyMmM0NzNlMWY0ZSJ9fX0=",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzM2ZTNiNDY5M2M5ODIwMTA3YjcwNTc0ZjJlNzEzMzAyYmVhNWY5NTBjNDgxOGQ4MWRjY2U1N2RlM2I0N2Y3MyJ9fX0=",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGEwZmViZGY1YjZmNDU1MGFlMmFhNTdlZjFiMWM1NzlkYzlhMWI1MTk0YTZkMzk5ZDhiMDU3OTU0OWFlNDE1In19fQ==",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmEzMzYxNTM1YWM5ZTlkMDhjZGEzYjZmNDk5ZmM0YjU4N2ZlMzViNmNiODE4Njc2ODc0ZGU1ODk3YmU5MzU5OCJ9fX0=",middle_legacy:"lodestone",top1:"polished_andesite_slab"}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/copper
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"copper_block",base2:"cut_copper_slab",base3:"cut_copper_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2ZhOTJjMzI5YTA0NDEzZjk2MDk2MTBlZGFlNGZiZDlmNzhjZjAzNDBhMjAzNDIyMmM2NTNiMWZkZGMzZjg0MCJ9fX0=",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmNDI3Mzc3MTQ3OWEyMDAzOWRjNmUzYWNhOWU1ZTkxOGRkNzRjYzVmMzAyMWY3MjJhMjQ3NzU0ZWU1YjRiMjUifX19",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzhiZDYxZTdmNTkwODU0Yzk4OWE0YWEyNzEwM2EwNWUzYjExZDEzMGIwZDNlZGE3NzFhMmMwMmI4MjhlNjU3YWIifX19",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzY2MmE4M2M4NjI0OGY0N2M4MWQ3ZDY1ZDAxYzFiMGYxYTVkYTVmOTBhZGE4MmNhYmY4MWY2ZTc5ZmU5NmM1NGMifX19",middle_legacy:"chiseled_copper",top1:"cut_copper_slab"}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/deepslate
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"deepslate",base2:"deepslate_brick_slab",base3:"deepslate_brick_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGJlZThlYjNjNWM4NTYwYzg0YzcwYzA1OWE1MWM2ZWU4YjdiODkwYzNjMjk3ZWYwNzBmZjU1ZTM1M2JhYTliMiJ9fX0=",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTJkM2UzYWRjNWY4MWM4ZTA1MzM1NTZiYzhiYTMwN2U2ZGU0ZDRmZmNkZjdiY2M3NzEzMDIxMDUzYWQxZGZjIn19fQ==",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDViNDVkYjM3MzczZGIwOTU0YWU1ZDAwOTgxMzgyZTM5MmJjYmUzMjVhYWFiMGYwMzgyMTU4YzFiZWM5ZTcwMCJ9fX0=",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGMxZGVmMzVhMDVmOGU4NWFkNDc4YTkzN2NhMjY2YjRiOTRhYTViOWU2YTNjZTljMjIwMWIyNGY2MTQ0MjZmMiJ9fX0=",middle_legacy:"chiseled_deepslate",top1:"deepslate_brick_slab"}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/mossy
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"mossy_cobblestone",base2:"mossy_stone_brick_slab",base3:"mossy_stone_brick_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzhkNTYyOTAyNzUxMzM5Y2ZiOTIwYWIwMDk0NmViODFjYTllZWFhODQzYzA1ZjQ2OWY5M2Y5MmYyOTk5YjUxYzYifX19",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2VmMDNjN2I3Yzg2ZjkwYzZiOWEwYjY2MzdmOTEwMDQ4NGU2N2M5Y2ZhZjViYTEwYjNlY2U2N2FlOTU1OTI5YzkifX19",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2Q0NzE3YjkxNWZkYjk4MmMwOTljYjA5M2UzZWE4MTU5YjM5ZGJhMmNjNGQ5YjFjZTU5MGVkNzg2NmVhNzhlMjMifX19",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ5NWE4ZDQ3ZDA3MmJhZDBlYWU3YWEwOTI1MGNmZDc4NjYwOTA4NzhmZWU3NjY2OGQyZmIxNzJmYzUzNTc4ZTgifX19",middle_legacy:"chiseled_stone_bricks",top1:"mossy_stone_brick_slab"}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/nether
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"nether_bricks",base2:"nether_brick_slab",base3:"nether_brick_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWQ0MmM5ODc1NDZmOWY5YWQ1MDlkM2Q3ODFiOGE4YjI2ZjQ0OGYxN2UzOTY3ZGE0YWM0YzE3NjllMTliMjE3NiJ9fX0=",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA5ZmJjOWFkYzg0ZDczZTg0MDQzNWUwZjUxMTJlZDVmZjA0ZmFlMmY4ZjI4M2RmMjM2MWU4ZjY0YjllMTZkMyJ9fX0=",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzEzM2JiYjVhZmQ0M2IwYjk1M2IzNzJlZDE3ZDc4ODU3ZTFmMTg5OTM0ZmRhNWMzNDhhN2EzZmVlNDdkOTI5YSJ9fX0=",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNWNhNzBiNzViMzIyYTE4OGUxYWMzNjJlMzMzMDEwODZkNzIyYzkwODBjY2FiM2NhODEyMmZjMmYxYmMxYjM0NSJ9fX0=",middle_legacy:"chiseled_nether_bricks",top1:"nether_brick_slab"}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/prismarine
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"prismarine_bricks",base2:"prismarine_brick_slab",base3:"prismarine_brick_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IzMGRhYjc2NGRlOGRhOTI1NGQxOWJkNjEyZmY1NjVkZmE2NTFjNTFhNjFmOGIxNmJmNGI5YzEzNmRiODhiZTkifX19",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzNjJiZmRhMzQyMjA4OWEzZjg1Y2E2NDZjODViYzYwYWI4YzMwNWE2ZmUxZjI2NWU2OTYxOWM4MTEzMGM4NTQifX19",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzNjMjZjYmMxZDMxOWRiNzllYjJhNmRlYTBmOTk1YmNjMDdkZDk1OGQ4YmQ3NmZlNzA4NGQxNjE4MjY4OWYyMjMifX19",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2NmYWJkM2M0OWIyYjdmM2U0ZWRjYTI4MzQyNmQ2NTAzMGEzYzVjMmUzOTY2M2EwNmEyM2M1OTgzOTgwOWNiZTEifX19",middle_legacy:"prismarine_bricks",top1:"prismarine_brick_slab"}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/sand
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"sandstone",base2:"cut_sandstone_slab",base3:"cut_sandstone_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTAwM2E1NGQyNTUyN2ZkYmI0Y2M3MTExZmJiNjhiZDZkOWIxNTVhY2QyMmIyYTY3NzE0NmEzZjhlMGUyM2IzMyJ9fX0=",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDhmOGYzZGZjZjY5Yjk5Y2Q4MDcxMjMyYTU3YzBkYzNlYmZmYzY1NWMxZTJiNGY0NDA2OWQ0M2Y3Nzc4YjE0NiJ9fX0=",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjI2YzZjZmVhZTBlYzAzMzlmNjA4ZTA3NWYyNTc3ZDJiY2NlYjM4ZTYzZTRiNDg1N2MwYzg4Nzg2Nzg1YTkwMCJ9fX0=",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYmI0ZWFiNmVlMzJiOTAwYzliMmUxMDVjNTYwZThmYTE5NmU5NDgyOTE4MDIzZWQwOTZjMjEwZmE4NjY1Yzg1ZiJ9fX0=",middle_legacy:"chiseled_sandstone",top1:"cut_sandstone_slab"}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/attributes/copper
|
||||
|
||||
data modify storage pk:common temp.attributes set value {base1:"tuff",base2:"polished_tuff_slab",base3:"polished_tuff_slab",middle_s1:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzUyN2JlMTE2YTc5ZjIzMmRmYmNhMjFkMGVhZDI0Nzk3ZmMzNmM4MjBkYmRmY2E1ZGM2YWUxMjExZjc4NGJlZTUifX19",middle_s2:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIwNTNmNWEwMmEzNjRhYTgwYTI3ZmYzN2ViOWE4N2Q1NmM2MTk2MWFiMzJlOWFjZTA2MGFmZmZiOTYwYWY2OWEifX19",middle_s3:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzYzMDJkZjM1ZTRlNGJiYTA2YzhjODc4NmQ4MjgwOTk2ZDFhYjFmN2MyNzlmYjgyMDJhZjI2ZDI3NjE5ZWY5M2IifX19",middle_s4:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzZmYmVjYzhmM2M3MDliM2MxMjBhZmQ0MzBiNDNjYjc4ODBhMzAyZjk0Y2I2OGYzMDczZTMyYzZjOGRiZGZmOTgifX19",middle_legacy:"chiseled_tuff_bricks",top1:"polished_tuff_slab"}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/base/1
|
||||
|
||||
# Set component id score to link entities
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Set data
|
||||
$data merge entity @s {Tags:["pk.custom_block","pk.waystones.waystone","pk.waystones.waystone.component","pk.part.base","pk.part.base.1"],item:{id:$(base1),count:1},transformation:{scale:[0.6875f,0.6875f,0.6875f],translation:[0.5f,0.755f,0.5f]}}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/base/2
|
||||
|
||||
# Set component id score to link entities
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Set data
|
||||
$data merge entity @s {Tags:["pk.custom_block","pk.waystones.waystone","pk.waystones.waystone.component","pk.part.base","pk.part.base.2"],item:{id:$(base2),count:1},transformation:{translation:[0.5f,0.5f,0.5f]}}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/base/3
|
||||
|
||||
# Set component id score to link entities
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Set data
|
||||
$data merge entity @s {Tags:["pk.custom_block","pk.waystones.waystone","pk.waystones.waystone.component","pk.part.base","pk.part.base.3"],item:{id:$(base3),count:1},transformation:{scale:[0.9375f,0.9375f,0.9375f],translation:[0.5f,1.235f,0.5f]}}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/common
|
||||
# Create skin parts that don't depends on settings
|
||||
# Other skins part are set from settings
|
||||
# @within function pk_waystones:blocks/waystone/main/settings/watch
|
||||
|
||||
# Prepare data depending on the Waystone variant
|
||||
$function pk_waystones:blocks/waystone/place/components/skins/attributes/$(variant)
|
||||
data modify storage pk:common temp.args merge from storage pk:common temp.attributes
|
||||
|
||||
# Base parts
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/base/1 with storage pk:common temp.args
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/base/2 with storage pk:common temp.args
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/base/3 with storage pk:common temp.args
|
||||
|
||||
# Top parts
|
||||
execute positioned ~ ~2 ~ summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/top/1 with storage pk:common temp.args
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set
|
||||
|
||||
# Set component id score to link entities
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Set data
|
||||
$data merge entity @s {Tags:["pk.custom_block","pk.waystones.waystone","pk.waystones.waystone.component","pk.part.middle","pk.part.middle.$(i)"],item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{properties:[{name:"textures",value:"$(value)"}]}}},transformation:{translation:$(translation),scale:[1.002f,1.002f,1.002f]}}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_start
|
||||
|
||||
# Prepare data depending on the Waystone variant
|
||||
$function pk_waystones:blocks/waystone/place/components/skins/attributes/$(variant)
|
||||
data modify storage pk:common temp.args merge from storage pk:common temp.attributes
|
||||
|
||||
# Parts 1-8
|
||||
data modify storage pk:common temp.args.value set from storage pk:common temp.args.middle_s1
|
||||
data modify storage pk:common temp.args merge value {i:1,translation:[0.7505f,2.0005f,0.2495f]}
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set with storage pk:common temp.args
|
||||
data modify storage pk:common temp.args merge value {i:8,translation:[0.2495f,1.4995f,0.7505f]}
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set with storage pk:common temp.args
|
||||
|
||||
# Parts 2-7
|
||||
data modify storage pk:common temp.args.value set from storage pk:common temp.args.middle_s2
|
||||
data modify storage pk:common temp.args merge value {i:2,translation:[0.2495f,2.0005f,0.2495f],left_rotation:[0f,0f,0f]}
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set with storage pk:common temp.args
|
||||
data modify storage pk:common temp.args merge value {i:7,translation:[0.7505f,1.4995f,0.7505f],left_rotation:[0f,0f,0f]}
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set with storage pk:common temp.args
|
||||
|
||||
# Parts 3-6
|
||||
data modify storage pk:common temp.args.value set from storage pk:common temp.args.middle_s3
|
||||
data modify storage pk:common temp.args merge value {i:3,translation:[0.7505f,2.0005f,0.7505f],left_rotation:[0f,0f,0f]}
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set with storage pk:common temp.args
|
||||
data modify storage pk:common temp.args merge value {i:6,translation:[0.2495f,1.4995f,0.2495f],left_rotation:[0f,0f,0f]}
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set with storage pk:common temp.args
|
||||
|
||||
# Parts 4-5
|
||||
data modify storage pk:common temp.args.value set from storage pk:common temp.args.middle_s4
|
||||
data modify storage pk:common temp.args merge value {i:4,translation:[0.2495f,2.0005f,0.7505f],left_rotation:[0f,0f,0f]}
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set with storage pk:common temp.args
|
||||
data modify storage pk:common temp.args merge value {i:5,translation:[0.7505f,1.4995f,0.2495f],left_rotation:[0f,0f,0f]}
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/default_set with storage pk:common temp.args
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/middle/legacy_set
|
||||
|
||||
# Set component id score to link entities
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Set data
|
||||
$data merge entity @s {Tags:["pk.custom_block","pk.waystones.waystone","pk.waystones.waystone.component","pk.part.middle","pk.part.middle.legacy"],block_state:{Name:$(middle_legacy),count:1},transformation:{translation:[-0.001f,0.999f,-0.001f],scale:[1.002f,1.002f,1.002f]}}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/middle/legacy_start
|
||||
|
||||
# Prepare data depending on the Waystone variant
|
||||
$function pk_waystones:blocks/waystone/place/components/skins/attributes/$(variant)
|
||||
data modify storage pk:common temp.args merge from storage pk:common temp.attributes
|
||||
|
||||
# Create the middle part
|
||||
execute summon block_display run function pk_waystones:blocks/waystone/place/components/skins/parts/middle/legacy_set with storage pk:common temp.args
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/skins/parts/top/1
|
||||
|
||||
# Set component id score to link entities
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Set data
|
||||
$data merge entity @s {Tags:["pk.custom_block","pk.waystones.waystone","pk.waystones.waystone.component","pk.part.top","pk.part.top.1)"],item:{id:$(top1),count:1},transformation:{scale:[0.9375f,0.9375f,0.9375f],translation:[0.5f,0.1770f,0.5f]}}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#> pk_waystones:blocks/waystone/place/components/visible_name_prepare
|
||||
|
||||
# Set component id score to link entities
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Add tags
|
||||
data modify entity @s Tags set value ["pk.custom_block","pk.waystones.waystone","pk.waystones.waystone.component","pk.waystones.waystone.name"]
|
||||
|
||||
# Set data
|
||||
execute unless data storage pk:common temp.waystone{name:'{"text":"Waystone"}'} run data modify entity @s text set from storage pk:common temp.waystone.name
|
||||
data modify entity @s billboard set value "center"
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Data structure:
|
||||
# id (int): The id of the Waystone
|
||||
# variant (string): The variant of the Waystone (regular, sand, deepslate, nether...)
|
||||
# name (text component): The name of the Waystone
|
||||
# owner (4 int array): The UUID of the owner
|
||||
# location (entry): Location of the Waystone
|
||||
# x (int): x coordinate
|
||||
# y (int): y coordinate
|
||||
# z (int): z coordinate
|
||||
# dimension (string): dimension id
|
||||
# discovered_by (list of entries): list of players having interacted with this Waystone
|
||||
# (entry)
|
||||
# uuid (4 int array): UUID of a player
|
||||
# shared_with (list of entries): list of players that can use this Waystone if the visibility is on "private"
|
||||
# (entry)
|
||||
# uuid (4 int array): UUID of a player
|
||||
# name (string): If the player isn't in the database yet, store its name instead
|
||||
# protected (boolean): Can be broken by any event if true, or removed only by the owner or a manager if false, false by default
|
||||
# visibility (string): "public", "private" or "discover"
|
||||
# render_item (entry):
|
||||
# id (string): id of item to render the Waystone in the Waystones list
|
||||
# tag (entry): optional tags of item
|
||||
# created_at_gametime (integer): the gametime the waystone has been placed on
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#> pk_waystones:blocks/waystone/place/data/render_item
|
||||
|
||||
# Try to get the item form of the block bellow the Waystone, if it fails, use a grass block instead
|
||||
loot replace entity @s container.0 mine ~ ~-1 ~ minecraft:netherite_pickaxe[minecraft:enchantments={levels:{"minecraft:silk_touch":1}}]
|
||||
execute unless data entity @s item.id run item replace entity @s container.0 with grass_block
|
||||
data remove storage pk:common temp.waystone.render_item
|
||||
data modify storage pk:common temp.waystone.render_item.id set from entity @s item.id
|
||||
data modify storage pk:common temp.waystone.render_item.components set from entity @s item.components
|
||||
|
||||
# Remove entity
|
||||
kill @s
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#> pk_waystones:blocks/waystone/place/data/store_from_command_placement/run
|
||||
# @require
|
||||
# pk:common temp.command.params.waystone
|
||||
# contains all data of the waystone to place
|
||||
# @within function pk_waystones:cmd/blocks/waystone/place
|
||||
|
||||
# Data with default values: visibility, discovered_by, shared_with, protected, render_item
|
||||
data modify storage pk:common temp.waystone set value {variant:"andesite",visibility:"discover",discovered_by:[],shared_with:[],protected:0b,render_item:{id:"minecraft:grass_block"},name:'{"text":"Waystone"}',location:{dimension:"minecraft:overworld"}}
|
||||
# Id
|
||||
data modify storage pk:common temp.waystone.id set from storage pk:common temp.command.params.waystone.id
|
||||
execute unless data storage pk:common temp.waystone.id store result storage pk:common temp.waystone.id int 1 run scoreboard players get $temp pk.custom_block.component.id
|
||||
# Variant
|
||||
data modify storage pk:common temp.waystone.variant set from storage pk:common temp.command.params.waystone.variant
|
||||
# Name
|
||||
data modify storage pk:common temp.waystone.name set from storage pk:common temp.command.params.waystone.name
|
||||
# Protection
|
||||
data modify storage pk:common temp.waystone.protected set from storage pk:common temp.command.params.waystone.protected
|
||||
# Visibility
|
||||
data modify storage pk:common temp.waystone.visibility set from storage pk:common temp.command.params.waystone.visibility
|
||||
# Owner
|
||||
data modify storage pk:common temp.waystone.owner set from storage pk:common temp.command.params.waystone.owner
|
||||
# Location
|
||||
data modify storage pk:common temp.waystone.location.dimension set from storage pk:common temp.command.params.waystone.location.dimension
|
||||
execute summon marker run function pk_waystones:blocks/waystone/place/data/store_from_command_placement/set_location
|
||||
# Discovered by
|
||||
execute if data storage pk:common temp.command.params.waystone.discovered_by[{}] run data modify storage pk:common temp.waystone.discovered_by set from storage pk:common temp.command.params.waystone.discovered_by
|
||||
# Shared with
|
||||
execute if data storage pk:common temp.command.params.waystone.shared_with[{}] run data modify storage pk:common temp.waystone.shared_with set from storage pk:common temp.command.params.waystone.shared_with
|
||||
# Render item
|
||||
execute if data storage pk:common temp.command.params.waystone.location.render_item run data modify storage pk:common temp.waystone.location.render_item set from storage pk:common temp.command.params.waystone.location.render_item
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/data/render_item
|
||||
# Created at gametime
|
||||
execute if data storage pk:common temp.command.params.waystone.created_at_gametime run data modify storage pk:common temp.waystone.created_at_gametime set from storage pk:common temp.command.params.waystone.created_at_gametime
|
||||
execute unless data storage pk:common temp.waystone.created_at_gametime store result storage pk:common temp.waystone.created_at_gametime int 1 run time query gametime
|
||||
|
||||
# Add to database
|
||||
data modify storage pk:waystones database.waystones append from storage pk:common temp.waystone
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#> pk_waystones:blocks/waystone/place/data/store_from_command_placement/set_location
|
||||
|
||||
execute store result storage pk:common temp.waystone.location.x int 1 run data get entity @s Pos[0]
|
||||
execute store result storage pk:common temp.waystone.location.y int 1 run data get entity @s Pos[1]
|
||||
execute store result storage pk:common temp.waystone.location.z int 1 run data get entity @s Pos[2]
|
||||
kill @s
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#> pk_waystones:blocks/waystone/place/data/store_from_player_placement
|
||||
|
||||
# Data with default values: visibility, discovered_by, shared_with, protected, render_item
|
||||
data modify storage pk:common temp.waystone set value {visibility:"discover",discovered_by:[],shared_with:[],protected:0b,render_item:{id:"minecraft:grass_block"}}
|
||||
# Id
|
||||
execute store result storage pk:common temp.waystone.id int 1 run scoreboard players get $temp pk.custom_block.component.id
|
||||
# Variant
|
||||
data modify storage pk:common temp.waystone.variant set from storage pk:common temp.block.components."minecraft:custom_data".pk_data.variant
|
||||
# Name
|
||||
data modify storage pk:common temp.waystone.name set value '{"text":"Waystone"}'
|
||||
data modify storage pk:common temp.waystone.name set from storage pk:common temp.item.components."minecraft:custom_name"
|
||||
# Protection
|
||||
execute if score $pk.waystones.settings.default_protection pk.value matches 1 run data modify storage pk:common temp.waystone.protected set value 1b
|
||||
# Visibility
|
||||
execute if score $pk.waystones.settings.default_visibility pk.value matches 1 run data modify storage pk:common temp.waystone.visibility set value "private"
|
||||
execute if score $pk.waystones.settings.default_visibility pk.value matches 2 run data modify storage pk:common temp.waystone.visibility set value "public"
|
||||
# Owner
|
||||
data modify storage pk:common temp.waystone.owner set from entity @s UUID
|
||||
# Location
|
||||
data modify storage pk:common temp.waystone.location.dimension set from entity @s Dimension
|
||||
data modify storage pk:common temp.waystone.location.x set from storage pk:common temp.block.x
|
||||
data modify storage pk:common temp.waystone.location.y set from storage pk:common temp.block.y
|
||||
data modify storage pk:common temp.waystone.location.z set from storage pk:common temp.block.z
|
||||
# Discovered by
|
||||
data remove storage pk:common temp.entry
|
||||
data modify storage pk:common temp.entry.uuid set from entity @s UUID
|
||||
data modify storage pk:common temp.waystone.discovered_by append from storage pk:common temp.entry
|
||||
# Render item
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/data/render_item
|
||||
# Created at gametime
|
||||
execute store result storage pk:common temp.waystone.created_at_gametime int 1 run time query gametime
|
||||
|
||||
# Add to database
|
||||
data modify storage pk:waystones database.waystones append from storage pk:common temp.waystone
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#> pk_waystones:blocks/waystone/place/replace/render_item
|
||||
|
||||
execute summon item_display run function pk_waystones:blocks/waystone/place/data/render_item
|
||||
data modify storage pk:common temp.args set value {p1:"data modify storage pk:waystones database.waystones[{id:",p2:"}].render_item set from storage pk:common temp.waystone.render_item"}
|
||||
data modify storage pk:common temp.args.v1 set from storage pk:common temp.waystone.id
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#> pk_waystones:blocks/waystone/place/replace/run
|
||||
# @context any at the waystone to replace
|
||||
# @requires
|
||||
# storage pk:common temp.waystone
|
||||
# data of waystone to replace
|
||||
|
||||
# Scores
|
||||
execute store result score $temp pk.custom_block.component.id run data get storage pk:common temp.waystone.id
|
||||
|
||||
# Define a render item if needed
|
||||
execute unless data storage pk:common temp.waystone.render_item run function pk_waystones:blocks/waystone/place/replace/render_item
|
||||
|
||||
# Remove waystone's blocks and entities
|
||||
setblock ~ ~ ~ air
|
||||
setblock ~ ~1 ~ air
|
||||
kill @e[type=#pk_waystones:custom_block/components,tag=pk.waystones.waystone.component,predicate=pk_waystones:scores/custom_block/component_id/match_temp,distance=..20]
|
||||
kill @e[type=interaction,tag=pk.waystones.waystone.lock,predicate=pk_waystones:scores/custom_block/component_id/match_temp,distance=..20]
|
||||
|
||||
# Create controller
|
||||
execute positioned ~0.5 ~1.5 ~0.5 summon marker run function pk_waystones:blocks/waystone/place/components/controller_prepare
|
||||
|
||||
# Create skin parts that don't depends on settings
|
||||
# Other skins part are set from settings
|
||||
# @within function pk_waystones:blocks/waystone/main/settings/watch
|
||||
function pk_waystones:blocks/waystone/place/components/skins/parts/common with storage pk:common temp.waystone
|
||||
|
||||
# Place blocks
|
||||
setblock ~ ~ ~ barrier
|
||||
execute positioned ~ ~1 ~ run function pk_waystones:blocks/waystone/place/available_container
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#> pk_waystones:blocks/waystone/place/run
|
||||
# Place a Waystone and store its relative information in the database
|
||||
# @context any at the block location
|
||||
# Features like skins and visible names are placed further in the current tick
|
||||
# @within function pk_waystones:blocks/waystone/main/on_entity_load/run
|
||||
|
||||
# Scores
|
||||
scoreboard players add $next pk.custom_block.component.id 1
|
||||
scoreboard players operation $temp pk.custom_block.component.id = $next pk.custom_block.component.id
|
||||
|
||||
# Prepare data and store them to database
|
||||
execute if score $pk.custom_block.placed_by_player pk.temp matches 1 run function pk_waystones:blocks/waystone/place/data/store_from_player_placement
|
||||
execute if score $pk.custom_block.placed_by_command pk.temp matches 1 run function pk_waystones:blocks/waystone/place/data/store_from_command_placement/run
|
||||
|
||||
# Create controller
|
||||
execute positioned ~0.5 ~1.5 ~0.5 summon marker run function pk_waystones:blocks/waystone/place/components/controller_prepare
|
||||
|
||||
# Create skin parts that don't depends on settings
|
||||
# Other skins part are set from settings
|
||||
# @within function pk_waystones:blocks/waystone/main/settings/check
|
||||
function pk_waystones:blocks/waystone/place/components/skins/parts/common with storage pk:common temp.waystone
|
||||
|
||||
# Place blocks
|
||||
setblock ~ ~ ~ barrier
|
||||
execute if predicate pk_waystones:block_sets/waystone/adjacent_to_full_water run setblock ~ ~ ~ barrier[waterlogged=true]
|
||||
execute positioned ~ ~1 ~ run function pk_waystones:blocks/waystone/place/available_container
|
||||
|
||||
# Animations
|
||||
playsound block.beacon.ambient ambient @a[distance=..30] ~ ~ ~ 1 1.75
|
||||
|
||||
# Debug logs
|
||||
execute if score $logs.datapack.waystones pk.value matches 1 run tellraw @a[tag=pk.dev] [{"selector":"@a[tag=pk.current.player,limit=1]","color": "gray"},{"text": " placed Waystone at ["},{"nbt":"temp.waystone.location.x","storage":"pk:common"},{"text": ","},{"nbt":"temp.waystone.location.y","storage":"pk:common"},{"text": ","},{"nbt":"temp.waystone.location.z","storage":"pk:common"},{"text": "] in "},{"nbt":"temp.waystone.location.dimension","storage":"pk:common"}]
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#> pk_waystones:blocks/waystone/place/try/cancel
|
||||
# @input
|
||||
# $reason: reason
|
||||
|
||||
# Stop try
|
||||
scoreboard players set $place.stop pk.temp 1
|
||||
|
||||
# Throw error
|
||||
title @s clear
|
||||
$title @s actionbar {"text": "$(reason)", "color": "red"}
|
||||
|
||||
# Give item back to the player
|
||||
data modify storage pk:common temp.args.id set from storage pk:common temp.item.id
|
||||
data modify storage pk:common temp.args.tag set from storage pk:common temp.item.tag
|
||||
data modify storage pk:common temp.args.count set value 1
|
||||
function pk_waystones:packages/dynamic_item/give with storage pk:common temp.args
|
||||
|
||||
# Set the current block as air
|
||||
setblock ~ ~ ~ air
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#> pk_waystones:blocks/waystone/place/try/dimension
|
||||
|
||||
$execute if data storage pk:waystones database.blacklist.dimensions[{id:"$(dimension)"}] run function pk_waystones:blocks/waystone/place/try/cancel {reason:"You can't put a Waystone in this dimension"}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
#> pk_waystones:blocks/waystone/place/try/start
|
||||
# Player try to place a waystone
|
||||
# @context as the player that placed a waystone (tag=pk.current.player) at the found block
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Prepare scores and data
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Store placed block data
|
||||
data modify storage pk:common temp.block set from block ~ ~ ~
|
||||
|
||||
# Total amount of Waystones owned by the current player
|
||||
scoreboard players set $waystones_of_player pk.temp 0
|
||||
data modify storage pk:common temp.database_output set value []
|
||||
data modify storage pk:common temp.args set value {p1:"data modify storage pk:common temp.database_output append from storage pk:waystones database.waystones[{owner:",p2:"}]"}
|
||||
data modify storage pk:common temp.args.v1 set from entity @s UUID
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
execute store result score $waystones_of_player pk.temp run data get storage pk:common temp.database_output
|
||||
|
||||
# Total amount of Waystones in the world
|
||||
scoreboard players set $waystones_of_server pk.temp 0
|
||||
execute store result score $waystones_of_server pk.temp run data get storage pk:waystones database.waystones
|
||||
|
||||
# Score used to stop the process
|
||||
scoreboard players set $place.stop pk.temp 0
|
||||
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Start to check if the waystone can be placed at this location
|
||||
# ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||
# Check if the current dimension isn't blacklisted (condition outpassed by managers)
|
||||
data modify storage pk:common temp.args.dimension set from entity @s Dimension
|
||||
execute unless entity @s[tag=pk.waystones.manager] run function pk_waystones:blocks/waystone/place/try/dimension with storage pk:common temp.args
|
||||
execute unless score $place.stop pk.temp matches 0 run return 0
|
||||
|
||||
# Check if the player exceeded the Waystones limit per player (condition outpassed by managers)
|
||||
execute if score $pk.waystones.settings.limit_per_player pk.value matches 0.. if score $waystones_of_player pk.temp >= $pk.waystones.settings.limit_per_player pk.value unless entity @s[tag=pk.waystones.manager] run function pk_waystones:blocks/waystone/place/try/cancel {reason:"You already placed too many waystones"}
|
||||
execute unless score $place.stop pk.temp matches 0 run return 0
|
||||
|
||||
# Check if the Waystones limit of the server has been exceeded (condition outpassed by managers)
|
||||
execute if score $pk.waystones.settings.limit_per_server pk.value matches 0.. if score $waystones_of_server pk.temp >= $pk.waystones.settings.limit_per_server pk.value unless entity @s[tag=pk.waystones.manager] run function pk_waystones:blocks/waystone/place/try/cancel {reason:"There are already too many waystones in this world"}
|
||||
execute unless score $place.stop pk.temp matches 0 run return 0
|
||||
|
||||
# Check if the Waystone fits on the placed area
|
||||
execute unless predicate pk_waystones:block_sets/waystone/fit run function pk_waystones:blocks/waystone/place/try/cancel {reason:"There is not enough space for a waystone to be placed here"}
|
||||
execute unless score $place.stop pk.temp matches 0 run return 0
|
||||
|
||||
# If all checks passed
|
||||
function pk_waystones:blocks/waystone/place/run
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#> pk_waystones:blocks/waystone/remove/loot
|
||||
|
||||
$function pk_waystones:items/waystone/attributes/$(variant)
|
||||
data modify storage pk:common temp.packages.dynamic_item set value {apply_random_motion:1b}
|
||||
data modify storage pk:common temp.packages.dynamic_item.entity_data.Item set from storage pk:common temp.attributes
|
||||
execute unless data storage pk:common temp.waystone{name:'{"text":"Waystone"}'} run data modify storage pk:common temp.packages.dynamic_item.entity_data.Item.components."minecraft:custom_name" set from storage pk:common temp.waystone.name
|
||||
data modify storage pk:common temp.packages.dynamic_item.entity_data.Item.count set value 1
|
||||
function pk_waystones:packages/dynamic_item/drop/run
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#> pk_waystones:blocks/waystone/remove/run
|
||||
|
||||
# Set component id score
|
||||
scoreboard players operation $temp pk.custom_block.component.id = @s pk.custom_block.component.id
|
||||
|
||||
# Stop the tick environment process
|
||||
scoreboard players set $env.stop pk.temp 1
|
||||
|
||||
# Delete from the database
|
||||
data modify storage pk:common temp.args set value {p1:"data remove storage pk:waystones database.waystones[{id:",p2:"}]"}
|
||||
data modify storage pk:common temp.args.v1 set from storage pk:common temp.waystone.id
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
|
||||
# Kill dropped GUI items and potential barrel
|
||||
execute align xyz run kill @e[type=item,nbt={Item:{components:{"minecraft:custom_data":{pk_data:{gui:1b}}}}},dx=0]
|
||||
execute unless block ~ ~ ~ barrel align xyz run kill @e[type=item,nbt={Item:{id:"minecraft:barrel",count:1},Age:0s},dx=0,limit=1]
|
||||
|
||||
# Check if the waystones has been removed too quickly
|
||||
# Used for Worldguard compatibility
|
||||
function pk_waystones:blocks/waystone/remove/should_loot
|
||||
|
||||
# Remove potential remaining blocks
|
||||
setblock ~ ~-1 ~ air
|
||||
setblock ~ ~ ~ air
|
||||
|
||||
# Remove components
|
||||
kill @e[type=#pk_waystones:custom_block/components,tag=pk.waystones.waystone.component,predicate=pk_waystones:scores/custom_block/component_id/match_temp,distance=..10]
|
||||
|
||||
# Debug logs
|
||||
execute if score $logs.datapack.waystones pk.value matches 1 run tellraw @a[tag=pk.dev] [{"text": "Waystone at [", "color": "gray"},{"nbt":"temp.waystone.location.x","storage":"pk:common"},{"text": ","},{"nbt":"temp.waystone.location.y","storage":"pk:common"},{"text": ","},{"nbt":"temp.waystone.location.z","storage":"pk:common"},{"text": "] in "},{"nbt":"temp.waystone.location.dimension","storage":"pk:common"},{"text": " has been removed"}]
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#> pk_waystones:blocks/waystone/remove/should_loot
|
||||
# Check if the waystone existed enough time to be looted when removed
|
||||
# Used for protected-area plugins compatibility
|
||||
|
||||
# Store the created_at_gametime from the waystone data, or set it to 0 if the waystone was created before 3.2.3
|
||||
scoreboard players set $created_at_gametime pk.temp 0
|
||||
execute store result score $created_at_gametime pk.temp run data get storage pk:common temp.waystone.created_at_gametime 1
|
||||
# Check if should loot
|
||||
execute unless score $pk.waystones.settings.lootable_delay pk.value matches 0.. run scoreboard players set $pk.waystones.settings.lootable_delay pk.value 0
|
||||
scoreboard players operation $age pk.temp = $gametime pk.value
|
||||
scoreboard players operation $age pk.temp -= $created_at_gametime pk.temp
|
||||
execute if score $pk.waystones.settings.lootable_delay pk.value > $age pk.temp run return 0
|
||||
|
||||
# @continue: Loot
|
||||
data modify storage pk:common temp.args.variant set from storage pk:common temp.waystone.variant
|
||||
function pk_waystones:blocks/waystone/remove/loot with storage pk:common temp.args
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#> pk_waystones:blocks/waystone/remove/try/cancel
|
||||
|
||||
# Disclaimer
|
||||
title @p[scores={pk.waystones.mined.barrel=1..},distance=..20] actionbar {"text": "This waystone is protected", "color": "red"}
|
||||
|
||||
# Remove the dropped container and GUI items
|
||||
execute align xyz run kill @e[type=item,nbt={Item:{components:{"minecraft:custom_data":{pk_data:{gui:1b}}}}},dx=0]
|
||||
execute align xyz run kill @e[type=item,nbt={Item:{id:"minecraft:barrel",count:1},Age:0s},dx=0,limit=1]
|
||||
|
||||
# Place potentially removed block(s) back
|
||||
setblock ~ ~-1 ~ barrier
|
||||
function pk_waystones:blocks/waystone/place/available_container
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#> pk_waystones:blocks/waystone/remove/try/check_source
|
||||
# Try to check (with provided features reliabilities) if the Waystone has been broken by its owner or a manager
|
||||
# /!\ Note that this method is still unsafe, we don't have any way to check it safely for the moment
|
||||
|
||||
scoreboard players set $packages.search_block.found pk.temp 0
|
||||
$execute if entity @a[scores={pk.waystones.mined.barrel=1..},nbt={UUID:$(uuid)},distance=..20] run scoreboard players set $packages.search_block.found pk.temp 1
|
||||
execute if entity @a[scores={pk.waystones.mined.barrel=1..},tag=pk.waystones.manager,distance=..20] run scoreboard players set $packages.search_block.found pk.temp 1
|
||||
execute if score $packages.search_block.found pk.temp matches 0 run scoreboard players set $remove.stop pk.temp 1
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#> pk_waystones:blocks/waystone/remove/try/start
|
||||
|
||||
# Reset score that checks if the process should be canceled
|
||||
scoreboard players set $remove.stop pk.temp 0
|
||||
|
||||
# Load Waystone data and prepare component-id score
|
||||
scoreboard players operation $temp pk.custom_block.component.id = @s pk.custom_block.component.id
|
||||
data modify storage pk:common temp.args set value {p1:"data modify storage pk:common temp.waystone set from storage pk:waystones database.waystones[{id:",p2:"}]"}
|
||||
data modify storage pk:common temp.args.v1 set from entity @s data.waystone.id
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
|
||||
# If the Waystone is protected, check if it was removed by either its owner or a manager
|
||||
data modify storage pk:common temp.args.uuid set from storage pk:common temp.waystone.owner
|
||||
execute if data storage pk:common temp.waystone{protected:1b} run function pk_waystones:blocks/waystone/remove/try/check_source with storage pk:common temp.args
|
||||
|
||||
# Remove or cancel depending on the $remove.stop pk.temp score's value
|
||||
execute if score $remove.stop pk.temp matches 1 run function pk_waystones:blocks/waystone/remove/try/cancel
|
||||
execute if score $remove.stop pk.temp matches 0 run function pk_waystones:blocks/waystone/remove/run
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#> pk_waystones:blocks/waystone/use/components/controller/set_visible_waystones_data
|
||||
|
||||
# Cache the list of visible waystones for the GUI
|
||||
data modify entity @s data.waystone.gui.visible_waystones set from storage pk:common temp.visible_waystones
|
||||
|
||||
# Calculate and cache the last page value for the GUI
|
||||
execute store result score $length pk.temp run data get storage pk:common temp.visible_waystones
|
||||
scoreboard players operation $gui.last_page pk.temp = $length pk.temp
|
||||
scoreboard players operation $gui.last_page pk.temp /= $18 pk.value
|
||||
scoreboard players operation $rest pk.temp = $length pk.temp
|
||||
scoreboard players operation $rest pk.temp %= $18 pk.value
|
||||
execute unless score $rest pk.temp matches 0 run scoreboard players add $gui.last_page pk.temp 1
|
||||
execute store result entity @s data.waystone.gui.last_page int 1 run scoreboard players get $gui.last_page pk.temp
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#> pk_waystones:blocks/waystone/use/components/controller/update_on_start
|
||||
|
||||
# Prepare scores
|
||||
scoreboard players operation @s pk.custom_block.interaction.id = $next pk.custom_block.interaction.id
|
||||
scoreboard players operation $temp pk.custom_block.component.id = @s pk.custom_block.component.id
|
||||
scoreboard players set @s pk.waystones.page 1
|
||||
|
||||
# Mark in_use custom_block controller
|
||||
tag @s add pk.custom_block.in_use
|
||||
tag @s add pk.custom_block.locked.in_use
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#> pk_waystones:blocks/waystone/use/components/controller/update_on_stop
|
||||
|
||||
# Unmark in_use custom_block controller
|
||||
tag @s remove pk.custom_block.in_use
|
||||
tag @s remove pk.custom_block.locked.in_use
|
||||
|
||||
# Clear the cached GUI
|
||||
data remove entity @s data.waystone.gui
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#> pk_waystones:blocks/waystone/use/components/lock/prepare
|
||||
|
||||
# Set interaction.id score
|
||||
scoreboard players operation @s pk.custom_block.component.id = $temp pk.custom_block.component.id
|
||||
|
||||
# Add tags
|
||||
tag @s add pk.waystones.waystone.lock
|
||||
tag @s add pk.custom_block.lock
|
||||
tag @s add pk.custom_block.lock.in_use
|
||||
|
||||
# Set data
|
||||
data merge entity @s {width:1.002f,height:1.002f,response:1b}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#> pk_waystones:blocks/waystone/use/data/assign_owner_if_unclaimed
|
||||
# @context the player who opened the waystone container, at the waystone container
|
||||
|
||||
# Update database
|
||||
data modify storage pk:common temp.used_waystone.owner set from entity @s UUID
|
||||
function pk_waystones:blocks/waystone/use/data/used_waystone/update
|
||||
|
||||
# Warn player
|
||||
tellraw @s {"text": "You're the new owner of this unclaimed waystone"}
|
||||
playsound entity.player.levelup block @s ~ ~ ~ 1 1.1
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#> pk_waystones:blocks/waystone/use/data/discovered_by/try_append_player
|
||||
# @context the player who opened the waystone container, at the waystone container
|
||||
# Storage:
|
||||
# pk:common temp.used_waystone : the currently used waystone
|
||||
# @within function pk_waystones:blocks/waystone/use/start
|
||||
|
||||
# Prepare data
|
||||
data modify storage pk:common temp.player set value {}
|
||||
data modify storage pk:common temp.player.uuid set from entity @s UUID
|
||||
|
||||
# Check if the player is already stored in the discovered_by list, otherwise, add it
|
||||
scoreboard players set $success pk.temp 0
|
||||
data modify storage pk:common temp.args set value {p1:"execute unless data storage pk:common temp.used_waystone.discovered_by[{uuid:",p2:"}] store success score $success pk.temp run data modify storage pk:common temp.used_waystone.discovered_by append from storage pk:common temp.player"}
|
||||
data modify storage pk:common temp.args.v1 set from storage pk:common temp.player.uuid
|
||||
function pk_waystones:packages/dynamic_command/1_var with storage pk:common temp.args
|
||||
execute if score $success pk.temp matches 0 run return 0
|
||||
|
||||
# Update database
|
||||
function pk_waystones:blocks/waystone/use/data/used_waystone/update
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue