-
-
Notifications
You must be signed in to change notification settings - Fork 58
Modernize (and Boltify) Liquid Tanks #1036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 74 commits
dbaf45f
d9d1806
8b0aa09
8f8318d
db01379
c090154
267fe83
695b283
e1453de
71fdc50
b7c1bac
626541f
aad53b6
427a145
79e830e
c1076a2
aa353bf
3090742
eeb7468
8c30c4b
2f9c97a
ffa252f
81ba8c8
9f43cfb
ec6895c
71a9cac
d7858e0
c715bf4
54002d5
acf65c6
24e166b
a75e5c4
cb82e22
1882f5e
f431b9c
51bcf49
14c4344
616a728
7aba842
95bc21c
d2dec67
13fce81
6c092ae
fd9d460
01d9639
f2ca573
2f31b8a
82323ac
4b401c7
1a7b12a
8716ed8
cdfc2fe
ff669bf
a4f0e8d
8c4c626
3b4fe92
e69fd2d
931896b
6022247
575d2e2
80cfdeb
c7b2e29
aa63288
7e2604c
e0e3f05
175240f
0779092
924deb5
6ece8bd
70ec696
7181138
cb181e3
df5967e
1179237
c540b39
5ac40c6
213aa30
6eabf6a
0c5423f
92ff9d6
c8a6adc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
# run from item_fill | ||
# @s = liquid tank at @s | ||
|
||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:black_concrete_powder"}} run function gm4_cement_mixers:item_fill/black_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:blue_concrete_powder"}} run function gm4_cement_mixers:item_fill/blue_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:brown_concrete_powder"}} run function gm4_cement_mixers:item_fill/brown_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:cyan_concrete_powder"}} run function gm4_cement_mixers:item_fill/cyan_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:gray_concrete_powder"}} run function gm4_cement_mixers:item_fill/gray_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:green_concrete_powder"}} run function gm4_cement_mixers:item_fill/green_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:light_blue_concrete_powder"}} run function gm4_cement_mixers:item_fill/light_blue_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:light_gray_concrete_powder"}} run function gm4_cement_mixers:item_fill/light_gray_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:lime_concrete_powder"}} run function gm4_cement_mixers:item_fill/lime_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:magenta_concrete_powder"}} run function gm4_cement_mixers:item_fill/magenta_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:orange_concrete_powder"}} run function gm4_cement_mixers:item_fill/orange_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:pink_concrete_powder"}} run function gm4_cement_mixers:item_fill/pink_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:purple_concrete_powder"}} run function gm4_cement_mixers:item_fill/purple_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:red_concrete_powder"}} run function gm4_cement_mixers:item_fill/red_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:white_concrete_powder"}} run function gm4_cement_mixers:item_fill/white_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:yellow_concrete_powder"}} run function gm4_cement_mixers:item_fill/yellow_concrete | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:dirt"}} run function gm4_cement_mixers:item_fill/mud | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:coarse_dirt"}} run function gm4_cement_mixers:item_fill/mud | ||
execute if data storage gm4_liquid_tanks:temp/tank {input_slot:{id:"minecraft:rooted_dirt"}} run function gm4_cement_mixers:item_fill/mud | ||
concretes_colors = ( | ||
"black", | ||
"blue", | ||
"brown", | ||
"cyan", | ||
"gray", | ||
"green", | ||
"light_blue", | ||
"light_gray", | ||
"lime", | ||
"magenta", | ||
"orange", | ||
"pink", | ||
"purple", | ||
"red", | ||
"white", | ||
"yellow" | ||
) | ||
for color in concretes_colors: | ||
execute if items block ~ ~ ~ container.0 f"minecraft:{color}_concrete_powder" run function f"gm4_cement_mixers:item_fill/{color}_concrete": | ||
scoreboard players set $item_value gm4_lt_value -1 | ||
item replace entity 00344d47-0004-0004-0004-000f04ce104d weapon.mainhand with f"minecraft:{color}_concrete" | ||
function gm4_liquid_tanks:smart_item_fill | ||
tag @s add gm4_lt_fill | ||
|
||
for variant in ("", "coarse_", "rooted_"): | ||
execute if items block ~ ~ ~ container.0 f"minecraft:{variant}dirt" run function gm4_cement_mixers:item_fill/mud: | ||
scoreboard players set $item_value gm4_lt_value -1 | ||
item replace entity 00344d47-0004-0004-0004-000f04ce104d weapon.mainhand with minecraft:mud | ||
function gm4_liquid_tanks:smart_item_fill | ||
tag @s add gm4_lt_fill |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very interesting, I'm considering doing something similar with my interface for like kit pvp server kits. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from gm4_liquid_tanks:liquid_wrappers import liquid | ||
|
||
@liquid | ||
class BottledLightning: | ||
id = 'liab_lightning' | ||
name = "Lightning" | ||
capacity = 300 | ||
skin = 'lightning_liquid' | ||
|
||
liquid.init() | ||
|
||
@liquid.item_fill("glass_bottle", "potion[custom_data~{gm4_lightning_in_a_bottle:1b}]", 1) | ||
def fill_bottle(): | ||
loot replace entity 344d47-4-4-4-f04ce104d weapon.mainhand loot gm4_lightning_in_a_bottle:items/bottle_of_lightning | ||
misode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@liquid.util_below | ||
def lightning_strike(): | ||
execute unless entity @s[predicate=gm4_lightning_in_a_bottle:on_fire] run function gm4_lightning_in_a_bottle:liquid_tanks/util/lightning: | ||
execute at @s run summon lightning_bolt ~ ~ ~ | ||
scoreboard players remove @e[type=armor_stand,tag=gm4_liquid_tank,tag=gm4_processing_tank,distance=..8] gm4_lt_value 1 | ||
playsound entity.firework_rocket.twinkle block @a[distance=..8] ~ ~ ~ 2 1.5 | ||
advancement grant @s only gm4:lightning_in_a_bottle_drink |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a really odd way to load the module. Was there a specific reason you are mounting this file in code? you could just do it directly in your There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted a cleaner way to mount the bolt module from another subproject. Running a plugin from another module is pretty easy, but mounting this external bolt file in |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# beet plugin to add the liquid_wrappers.bolt module to other gm4 datapacks more easily | ||
from beet import Context | ||
from bolt import Module | ||
from pathlib import Path | ||
|
||
|
||
def beet_default(ctx: Context): | ||
print(Path.cwd()) | ||
ctx.data[Module]['gm4_liquid_tanks:liquid_wrappers'] = Module(source_path=Path("gm4_liquid_tanks/data/gm4_liquid_tanks/modules/liquid_wrappers.bolt")) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,17 @@ | |
# @s = processing tank | ||
|
||
# merge count from input and set to tank | ||
data modify storage gm4_liquid_tanks:temp/tank output.count set from storage gm4_liquid_tanks:temp/tank input_slot.count | ||
data modify block ~ ~ ~ Items[{Slot:0b}] set from storage gm4_liquid_tanks:temp/tank output | ||
item_modifier gm4_liquid_tanks:apply_output_count: | ||
function: "minecraft:set_count" | ||
count: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get wanting to use bolt, but what is the advantage of defining the item modifier here inline using the bolt syntax? I would move it out to a separate json file, or if you really want it here, use the vanilla inline item modifier syntax. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's not really any advantage. It's a part of experimenting with the bolt syntax to see what feels most useful for gm4. Since this is the only place this modifier is used, it makes sense to define it here instead of in another file for clarity, and that's what this syntax does in build time. Is there any theoretical downsides to vanilla inlining? Like in repeated parsings for example? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Performance wise, vanilla inlining should perform just as well as a reference. During load they're converted to equivalent data structures. |
||
type: "minecraft:score" | ||
target: | ||
type: "minecraft:fixed" | ||
name: "$stack_size" | ||
score: "gm4_lt_value" | ||
|
||
item replace block ~ ~ ~ container.0 from entity 344d47-4-4-4-f04ce104d weapon.mainhand gm4_liquid_tanks:apply_output_count | ||
item replace entity 344d47-4-4-4-f04ce104d weapon.mainhand with air | ||
|
||
# apply value delta | ||
scoreboard players operation @s gm4_lt_value += $stack_value gm4_lt_value | ||
|
Uh oh!
There was an error while loading. Please reload this page.