Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,769 changes: 1,052 additions & 717 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
mecha = "^0.95.0"
bolt = "^0.49.0"
bolt-expressions = "^0.17.0"
beet = ">=0.108.5"
pydantic = "^2.5.2"
rich = "^13.9.2"
beet = "^0.112.0"
bolt = "^0.49.2"
mecha = "^0.101.0"

[tool.poetry.group.dev.dependencies]
black = "^22.8.0"
Expand Down
21 changes: 21 additions & 0 deletions smithed_libraries/packs/tech-slots/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<p align="center">
<img width='50%' src="https://github.com/TheNuclearNexus/smithed/blob/master/public/official_smithed_library.png?raw=true">
</p>

# Technical Slots
This library helps modify the body and saddle slots according to the [unused player slots convention](https://docs.smithed.dev/conventions/unused-player-slots).

## Usage
For usage information, see the [documentation](https://docs.smithed.dev/libraries/tech-slots)
## Downloading
You can download this library from [the website](https://smithed.net/packs/tech-slots)
or
You can build it from source using [beet](https://github.com/mcbeet/beet)

### Building
```
$ pip install beet mecha
$ git clone https://github.com/Smithed-MC/Libraries
$ cd Libraries/tech-slots
$ beet -s 'meta.libraries = ["tech-slots"]'
```
17 changes: 17 additions & 0 deletions smithed_libraries/packs/tech-slots/beet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extend: "@smithed_libraries/common.yaml"

id: smithed.tech_slots
name: Smithed Tech Slots
version: "1.0.0"
description: Tech Slots Library for Smithed
author: BPR02 and Conure512

data_pack:
name: Smithed Tech Slots
load: .
zipped: true

require:
- beet.contrib.unknown_files

output: dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"criteria": {
"death": {
"trigger": "minecraft:entity_hurt_player",
"conditions": {
"player": [
{
"condition": "minecraft:entity_scores",
"entity": "this",
"scores": {
"smithed.tech_slots.death": {
"min": 1
}
}
}
]
}
}
},
"rewards": {
"function": "smithed.tech_slots:impl/player/died"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"criteria": {
"respawned": {
"trigger": "minecraft:tick",
"conditions": {
"player": [
{
"condition": "inverted",
"term": {
"condition": "entity_properties",
"entity": "this",
"predicate": {
"nbt": "{Health:0f}"
}
}
}
]
}
}
},
"rewards": {
"function": "smithed.tech_slots:impl/player/respawned"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# toggle gamemode
gamemode spectator
gamemode adventure

# restore command feedback
execute if score $send_command_feedback smithed.data matches 1 run gamerule send_command_feedback true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# check if player needs to be set back to flying
execute if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{flags:{is_flying:0b}}} run tag @s add smithed.tech_slots.no_fly

# toggle gamemode
gamemode spectator
gamemode adventure @s[tag=smithed.tech_slots.no_fly]
gamemode creative
tag @s[tag=smithed.tech_slots.no_fly] remove smithed.tech_slots.no_fly

# restore command feedback
execute if score $send_command_feedback smithed.data matches 1 run gamerule send_command_feedback true
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# toggle gamemode
gamemode spectator
gamemode creative
gamemode spectator

# restore command feedback
execute if score $send_command_feedback smithed.data matches 1 run gamerule send_command_feedback true
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# toggle gamemode
gamemode spectator
gamemode survival

# restore command feedback
execute if score $send_command_feedback smithed.data matches 1 run gamerule send_command_feedback true
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

$item modify entity @s armor.body $(modifier)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

$item modify entity @s saddle $(modifier)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @public

# set body slot
function smithed.tech_slots:impl/player/set_body_item

# run modifier
function smithed.tech_slots:impl/modifier/modify_body with storage smithed.tech_slots:data input
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @public

# set saddle slot
item replace entity @s saddle with saddle[equippable={slot:"saddle",equip_sound:"intentionally_empty"}]

# run modifier instantly
function smithed.tech_slots:impl/modifier/modify_saddle with storage smithed.tech_slots:data input
function smithed.tech_slots:impl/modifier/trigger

# clear saddle slot
item replace entity @s saddle with air
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @public

# apply to body slot
function smithed.tech_slots:impl/modifier/set_constant

# add to player storage
function smithed.tech_slots:impl/storage/save_modifier
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @public

# disable command feedback
execute if function smithed.tech_slots:impl/technical/get_send_command_feedback run gamerule send_command_feedback false

# toggle gamemode (and re-enable command feedback)
execute if entity @s[gamemode=survival] run return run function smithed.tech_slots:impl/modifier/gamemode/survival
execute if entity @s[gamemode=adventure] run return run function smithed.tech_slots:impl/modifier/gamemode/adventure
execute if entity @s[gamemode=creative] run return run function smithed.tech_slots:impl/modifier/gamemode/creative
execute if entity @s[gamemode=spectator] run function smithed.tech_slots:impl/modifier/gamemode/spectator
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
advancement revoke @s only smithed.tech_slots:impl/death
scoreboard players reset @s smithed.tech_slots.death
execute unless function smithed.tech_slots:impl/technical/get_keep_inventory run advancement revoke @s only smithed.tech_slots:impl/respawn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# place an item in the body slot
function smithed.tech_slots:impl/player/set_body_item

# get player storage entry
execute store result score $modifier_count smithed.data run function smithed.tech_slots:impl/storage/load_player with entity @s
execute if score $modifier_count smithed.data matches 0 run return run data remove storage smithed.tech_slots:data temp

# restore modifiers
function smithed.tech_slots:impl/player/restore_modifier with storage smithed.tech_slots:data temp.current_modifiers[-1]

# allow other packs to run custom functionality
function #smithed.tech_slots:player/restore_modifiers
data remove storage smithed.tech_slots:data temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


$item modify entity @s armor.body $(modifier)
data remove storage smithed.tech_slots:data temp.current_modifiers[-1]
scoreboard players remove $modifier_count smithed.data 1
execute if score $modifier_count smithed.data matches 1.. run function smithed.tech_slots:impl/player/restore_modifier with storage smithed.tech_slots:data temp.current_modifiers[-1]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @public

# set item if doesn't exist
execute unless items entity @s armor.body * run return run item replace entity @s armor.body with minecraft:poisonous_potato[!minecraft:consumable, minecraft:equippable= {slot:"body",equip_sound:"intentionally_empty"},enchantments={"minecraft:vanishing_curse":1,"minecraft:binding_curse":1},custom_data={smithed.tech_slots:{set:true}}]

# return early if smithed data is present
execute if items entity @s armor.body *[minecraft:custom_data~{smithed.tech_slots:{set:true}}] run return 1

# force binding and vanishing curses
item modify entity @s armor.body smithed.tech_slots:impl/set_body_data

# force silent equip sound
data modify storage smithed.tech_slots:data temp.body set from entity @s equipment.body
data modify storage smithed.tech_slots:data temp.body merge value {components:{"minecraft:equippable":{slot:"body",equip_sound:"intentionally_empty"}}}
item replace entity @s armor.body with air

tag @s add smithed.tech_slots.target
execute summon item_display run function smithed.tech_slots:impl/player/set_body_sound
tag @s remove smithed.tech_slots.target

data remove storage smithed.tech_slots:data temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data modify entity @s item set from storage smithed.tech_slots:data temp.body
item replace entity @a[distance=0,tag=smithed.tech_slots.target] armor.body from entity @s container.0
kill @s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$data modify storage smithed.tech_slots:data modifier_registry."$(UUID)" append from storage smithed.tech_slots:data input
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @public

data modify storage smithed.tech_slots:data temp.args.UUID set from entity @s UUID
data modify storage smithed.tech_slots:data temp.args.input set from storage smithed.tech_slots:data input
function smithed.tech_slots:impl/storage/remove_modifier with storage smithed.tech_slots:data temp.args
data remove storage smithed.tech_slots:data temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# grab from storage registry
$data modify storage smithed.tech_slots:data temp.current_modifiers set from storage smithed.tech_slots:data modifier_registry."$(UUID)"

# if in registry, return amount of modifiers
execute if data storage smithed.tech_slots:data temp.current_modifiers run return run data get storage smithed.tech_slots:data temp.current_modifiers

# if not in registry, create an entry
$data modify storage smithed.tech_slots:data modifier_registry."$(UUID)" set value []
return 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$data remove storage smithed.tech_slots:data modifier_registry."$(UUID)"[$(input)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @public

function smithed.tech_slots:impl/storage/add_modifier with entity @s
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

$data modify storage smithed.tech_slots:data modifier_registry."$(UUID)" set from storage smithed.tech_slots:data temp.current_player
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return run gamerule keep_inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
execute store result score $send_command_feedback smithed.data run return run gamerule send_command_feedback
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scoreboard objectives add smithed.data dummy
scoreboard objectives add smithed.tech_slots.death deathCount
scoreboard players reset * smithed.tech_slots.death
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"function": "minecraft:set_enchantments",
"enchantments": {
"minecraft:binding_curse": 1,
"minecraft:vanishing_curse": 1
}
},
{
"function": "set_custom_data",
"tag": {
"smithed.tech_slots": {
"set": true
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": []
}
Binary file added smithed_libraries/packs/tech-slots/pack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading