22# ruff: noqa: E501
33# Imports
44from beet import Predicate
5- from stewbeet .core import *
5+ from stewbeet .core import CUSTOM_ITEM_VANILLA , JsonDict , Mem , set_json_encoder , write_function
66
77from .pulverizer import pulverizer
88
99
1010# Setup machines work and visuals
1111def setup_machines (gui : dict [str , str ]) -> None :
1212 ns : str = Mem .ctx .project_id
13- GUI_DATA : str = 'tooltip_display={"hide_tooltip": true},custom_data={"common_signals":{"temp":true}}'
13+ GUI_DATA : str = r 'tooltip_display={"hide_tooltip": true},custom_data={"common_signals":{"temp":true}}'
1414
1515 # Solar panel
16- energy : dict = Mem .definitions ["solar_panel" ]["custom_data" ]["energy" ]
16+ energy : JsonDict = Mem .definitions ["solar_panel" ]["custom_data" ]["energy" ]
1717 content : str = f"""# Produce Energy depending on the power of daylight sensor
1818execute if predicate { ns } :check_daylight_power run scoreboard players add @s energy.storage { energy ["generation" ]}
1919execute if score @s energy.storage > @s energy.max_storage run scoreboard players operation @s energy.storage = @s energy.max_storage
@@ -28,7 +28,7 @@ def setup_machines(gui: dict[str, str]) -> None:
2828
2929 # Furnace Generator & Redstone Generator
3030 for gen in ["furnace_generator" , "redstone_generator" ]:
31- energy : dict = Mem .definitions [gen ]["custom_data" ]["energy" ]
31+ energy : JsonDict = Mem .definitions [gen ]["custom_data" ]["energy" ]
3232 default_gui : str = gui [f"gui/{ gen } .png" ]
3333 working_gui : str = gui [f"gui/{ gen } _on.png" ]
3434 default_model : str = Mem .definitions [gen ]["item_model" ]
@@ -50,9 +50,9 @@ def setup_machines(gui: dict[str, str]) -> None:
5050
5151# Update the gui to default
5252execute store result score #burn_time { ns } .data run data get block ~ ~ ~ lit_time_remaining
53- execute if score #burn_time { ns } .data matches 0 run item replace block ~ ~ ~ container.{ gui_slot } with paper [item_model="{ default_gui } ",{ GUI_DATA } ]
53+ execute if score #burn_time { ns } .data matches 0 run item replace block ~ ~ ~ container.{ gui_slot } with cobblestone [item_model="{ default_gui } ",{ GUI_DATA } ]
5454execute if score #burn_time { ns } .data matches 0 run data modify entity @s item.components."minecraft:item_model" set value "{ default_model } "
55- execute if score #burn_time { ns } .data matches 1.. run item replace block ~ ~ ~ container.{ gui_slot } with paper [item_model="{ working_gui } ",{ GUI_DATA } ]
55+ execute if score #burn_time { ns } .data matches 1.. run item replace block ~ ~ ~ container.{ gui_slot } with cobblestone [item_model="{ working_gui } ",{ GUI_DATA } ]
5656execute if score #burn_time { ns } .data matches 1.. run data modify entity @s item.components."minecraft:item_model" set value "{ working_model } "
5757
5858# Update the gui & produce Energy while working
@@ -86,7 +86,7 @@ def setup_machines(gui: dict[str, str]) -> None:
8686
8787 # Electric Smelter & Electric Furnace & Electric Brewing Stand
8888 for machine in ["electric_smelter" , "electric_furnace" , "electric_brewing_stand" ]:
89- energy : dict = Mem .definitions [machine ]["custom_data" ]["energy" ]
89+ energy : JsonDict = Mem .definitions [machine ]["custom_data" ]["energy" ]
9090 cook : str = "cooking_time_spent" if machine != "electric_brewing_stand" else "BrewTime"
9191 burn : str = "lit_time_remaining" if machine != "electric_brewing_stand" else "Fuel"
9292 burn_type : str = "short" if machine != "electric_brewing_stand" else "byte"
@@ -169,7 +169,7 @@ def setup_machines(gui: dict[str, str]) -> None:
169169""" )
170170
171171 # Cauldron Generator
172- energy : dict = Mem .definitions ["cauldron_generator" ]["custom_data" ]["energy" ]
172+ energy : JsonDict = Mem .definitions ["cauldron_generator" ]["custom_data" ]["energy" ]
173173 default_model : str = Mem .definitions ["cauldron_generator" ]["item_model" ]
174174 working_model : str = default_model + "_on"
175175 content : str = f"""
@@ -207,7 +207,7 @@ def setup_machines(gui: dict[str, str]) -> None:
207207 write_function (f"{ ns } :custom_blocks/electric_brewing_stand/place_secondary" , to_add )
208208
209209 # Heat generator
210- energy : dict = Mem .definitions ["heat_generator" ]["custom_data" ]["energy" ]
210+ energy : JsonDict = Mem .definitions ["heat_generator" ]["custom_data" ]["energy" ]
211211 default_model : str = Mem .definitions ["heat_generator" ]["item_model" ]
212212 working_model : str = default_model + "_on"
213213 write_function (f"{ ns } :custom_blocks/heat_generator/second" , f"""
@@ -233,7 +233,7 @@ def setup_machines(gui: dict[str, str]) -> None:
233233""" )
234234
235235 # Wind turbine
236- energy : dict = Mem .definitions ["wind_turbine" ]["custom_data" ]["energy" ]
236+ energy : JsonDict = Mem .definitions ["wind_turbine" ]["custom_data" ]["energy" ]
237237 default_model : str = Mem .definitions ["wind_turbine" ]["item_model" ]
238238 working_model : str = default_model + "_on"
239239 write_function (f"{ ns } :custom_blocks/wind_turbine/second" , f"""
@@ -259,7 +259,7 @@ def setup_machines(gui: dict[str, str]) -> None:
259259""" )
260260
261261 # Elevator
262- energy : dict = Mem .definitions ["elevator" ]["custom_data" ]["energy" ]
262+ energy : JsonDict = Mem .definitions ["elevator" ]["custom_data" ]["energy" ]
263263 default_model : str = Mem .definitions ["elevator" ]["item_model" ]
264264 working_model : str = default_model + "_on"
265265 Mem .ctx .data [ns ].predicates ["is_on_ground" ] = set_json_encoder (Predicate ({"condition" :"minecraft:entity_properties" ,"entity" :"this" ,"predicate" :{"movement" :{"vertical_speed" :{"max" :0.1 }}}}))
@@ -296,6 +296,7 @@ def setup_machines(gui: dict[str, str]) -> None:
296296execute if score #success { ns } .data matches 1 run scoreboard players operation @s { ns } .elevator_time = #elevator_time { ns } .data
297297execute if score #success { ns } .data matches 0 if entity @s[distance=..72] positioned ~ ~{ y_offset } ~ run function { ns } :custom_blocks/elevator/go_{ direction }
298298""" )
299+
299300 # Pulverizer
300301 pulverizer (gui )
301302
0 commit comments