Skip to content

Commit c1cecea

Browse files
committed
fix: 🐛 Can't burn anything in the furnace generator
1 parent e0ae43d commit c1cecea

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

src/link.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11

22
# Imports
3+
from beet import Context
34
from stewbeet.contrib.simplenergy import (
4-
Context,
55
GuiTranslation,
6-
Mem,
76
energy_cables_models,
87
insert_lib_calls,
98
item_cables_models,
@@ -22,8 +21,6 @@
2221

2322
# Main function is run just before making finalyzing the build process (zip, headers, lang, ...)
2423
def beet_default(ctx: Context) -> None:
25-
if Mem.ctx is None:
26-
Mem.ctx = ctx
2724

2825
# Add commands to place and destroy functions for energy items
2926
insert_lib_calls()
@@ -40,7 +37,7 @@ def beet_default(ctx: Context) -> None:
4037
"furnace_generator": GuiTranslation.furnace_top,
4138
"redstone_generator": GuiTranslation.furnace_bottom,
4239
"pulverizer": GuiTranslation.barrel_bottom_right,
43-
}
40+
} # pyright: ignore[reportArgumentType]
4441
)
4542

4643
# Setup machines

src/utils/custom_ore_generation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def setup_custom_ore_generation():
1111
CustomOreGeneration.all_with_config(ore_configs = {
1212
"simplunium_ore": [
1313
CustomOreGeneration(
14-
dimensions = ["minecraft:overworld"],
14+
dimensions = ["minecraft:overworld", "stardust:cavern", "stardust:celestial"],
1515
maximum_height = 50,
1616
minimum_height = 0,
1717
veins_per_region = 1.5,
@@ -20,7 +20,7 @@ def setup_custom_ore_generation():
2020
],
2121
"deepslate_simplunium_ore": [
2222
CustomOreGeneration(
23-
dimensions = ["minecraft:overworld"],
23+
dimensions = ["minecraft:overworld", "stardust:cavern", "stardust:celestial"],
2424
maximum_height = 0,
2525
veins_per_region = 1.5,
2626
vein_size_logic = 0.4,

src/utils/machines.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
# ruff: noqa: E501
33
# Imports
44
from beet import Predicate
5-
from stewbeet.core import *
5+
from stewbeet.core import CUSTOM_ITEM_VANILLA, JsonDict, Mem, set_json_encoder, write_function
66

77
from .pulverizer import pulverizer
88

99

1010
# Setup machines work and visuals
1111
def 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
1818
execute if predicate {ns}:check_daylight_power run scoreboard players add @s energy.storage {energy["generation"]}
1919
execute 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
5252
execute 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}]
5454
execute 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}]
5656
execute 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:
296296
execute if score #success {ns}.data matches 1 run scoreboard players operation @s {ns}.elevator_time = #elevator_time {ns}.data
297297
execute 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

Comments
 (0)