#Flare - Next Generation Datapack Development
1 messages · Page 2 of 1
execute unless score windcharge_enabled tbs.server_data = !_1 __tg__constant__ run return fail
why do you use a constant here instead of matches?
Hmm, did you type x != 1
yes
lol
Thankfully everything's modular and structured well so I can just search fast 
Like you can use the constant feature too
getscore(5) gives the constant score
But you don't ever need to :p
Can you update and try again?
Finally finished this in the way you said Bolt did it 
Unified all the generated functions into the same file structuring
If you make a function like ns:a/b/c and make a while inside it it will put it in ns:a/b/_c folder
damn that was quick
I already had a unified function generator :p
Changed the destination from ns:tempname to the new structure
I think I'll sleep
yea me too
Good night!
aha mine currently UTC + 2
0:44
Ooh we are close
thanks :)
I'm very happy that I finally completely figured out a solution to every problem Radon had, Flare is like the perfected version of Radon with no design flaws (https://oguzhanumutlu.com/radon)
Next Generation Datapack Development
You can even define your own types in Flare
Like if float32 type didn't already exist you could convert flop into a type
There's even implicit casting so you can make your own type and every other existing type immediately supports it:
x = flop(10.5) # my type
y = fixed[3](10.532)
y = x # you defined the conversion of flop to fixed and this immediately calls that
All explained in the internals page but I might make a page for defining types
have never heard of radon but damn that's really cool
Thanks ❤️
like the whole file?
this is the function
@export('score_menu/incr_score')
def incr_score():
score_menu['#correct'] += 1
score_menu['#streak'] += 1
score_menu['#total'] += 1
update_menu()
if score_menu['#streak'] % 10 == 0:
playsound minecraft:block.decorated_pot.shatter master @a ~ ~ ~ 10 0
playsound minecraft:entity.player.levelup master @a ~ ~ ~ 0.2 1.2
else:
playsound minecraft:entity.armadillo.brush master @a ~ ~ ~ 10 1.5
playsound minecraft:block.trial_spawner.spawn_item_begin master @a ~ ~ ~ 0.3 1.2
with @n[type=text_display,tag=main].at(@s):
particle minecraft:cloud ~ ~1.2 ~1.5 0 0 0 0.2 5 force
I can't seem to replicate it
Oh I see okay
The error is not actually at the end there
I think the pre-tokenizer preprocessing breaks errors
I'll fix both that and this error
Like that's not where update_menu is written
I'll fix this and your error
also would be nice to know which line of code generated the error maybe you can add this to the error message
I've had multiple errors which I wasn't sure where they occured
On it
I made a very little change in the preprocessor can you update and run it again
It should still error but this time you will see the error correctly hopefully
Also the problem was not on this function I think
yes it's on the last with line. If I remove it, it works
Hmm
I had a little hacky solution in the command processor and it's unnecessary at this point, maybe it caused both of the problems at the same time
Because mine compiles fine now
Found another issue. I have a function called enable somewhere
What
You type enable but it calls disable?
Wait no the namespace is different too
tbh I think it's a good idea to use your interpolation syntax here
so only theblackswitch:__version__/easing/~enable~
to make it be replaced
no the V2.0 is normal
that's a plugin of mine
yep the enabling is also a mistake on my part :P
aah nice this is fixed now

This is basically caused by me forgetting : and / characters can be inside an identifier
So it was splitting the single identifier into like 3 easing and / and enable
So it did the substitution instead of understanding this as a single big identifier
Two
aah IC I recommend making variables only be inserted when the ~var~ syntax is used. This also makes it a lot easier for the user to figure out what's happening
Only two characters 🙏
Hmmm
Yeah makes sense
Except for json though right?
hmm...
Like here
Or the bolt tutorial one
Also what about ~i ~ ~ do they do ~~i~ ~ ~
for this I think it's best to allow both and disable it inside strings
yea I think ~~i~ ~ ~ then I guess. Maybe a different character?
can you do maybe $var instead?
a = 10
say a
say \a
?
How about this for disabling
Hmm
hmm looks a bit weird
like you can do execute positioned ~$offs_x ~ ~
looks great
and it's easy to type
{} and [] are same as before though right?
what do you mean?
Ohh like that. Yea for the [] I would allow both so like both [infinite_invis]
and ```
[$infinite_invis]
are allowed
Hmm
I don't know if I like the duality in objects and arrays
I feel like $var should be a special feature specifically for commands and using {} is same as the already existing nbt{} syntax
hmm yea maybe it's a bit weird
z = 10
x = nbt{x: 1b, y: z}
tellraw @a {x: 1b, y: z, k: $z}
Like I don't want two concepts for the user to learn and when to use which
Also I'll add ${} too
For expressions
oohh yea makes sense. This looks really complicated
This will also speed up the preprocessor juust a bit
Probably not a necessary amount because preprocessor is already the fastest part of the Flare pipeline
But theoratically it will because I was checking literally every word against the variable list
Also this is a huge breaking change so get ready 
Ohh also quick suggestion. Can you add the output of all the syntax on your wiki? As a user that's just starting I'm still working myself from the output to flare's syntax so it's nice to know ow everything works
even more 💀
yay
maybe bump the minor then
I was actually planning on doing that but didn't because a lot of stuff just generates so many files lol
I had it in radon too like this
I'll try to add it to as many blocks as possible

yea true. Maybe you can add like a <details> that you can expand to see the output but it isn't
ohh yea that's great
Yeah vitepress (the docs framework I'm using) has it built-in 
ohh found another case where you can just use matches
hmm I'm also not sure what the elif score is for
You can use min max globally
Math functions are all injected into Python's math and builtin functions because they're deterministic
Only random functions need to be ran from the flrand because I know when you write min(1, 2) you want to run the Python version but I don't know if you mean in Python or in Minecraft when you do randint(1, 5)
OMG this is insanely cool
Glad you like it 😊
ohh yea makes sense
Currently working on the preprocessor $x update
Will also fix this
Also you do motion_y[@s] and motion_y[@s, 3], if you want you can use , 3 on both or even store it in a variable like my = ref(motion_y[@s, 3])
I don't think max is working correctly
I'll check it in a bit
It's set to 1 if the first condition succeeded
I might make it so that you can tell it to invert the first condition instead
But it will get very messy if you have if-chains so it will probably be an explicit feature where you have to tell it to inline the inverted condition
elif is never being set here
It should be setting it in the generated function
ahh yes IC
Also renamed it from generated to if for if chains
I'll also optimize it or simple cases like this where it's just an if-else and not an if chain
Actually wait I can't really
I mean I guess I can in theory
Problem is
x = 10
if x > 5:
x = 0
else:
print("hi")
Here the safest option for the compiler is to use the elif temp variable
Because it will be
x = 10
if x > 5:
x = 0
if x <= 5: # automatically generated
print("hi") # this will always run because even if x was bigger than 5 it will be 0 which is smaller than 5
Logically the solution is to just change the order:
x = 10
if x <= 5:
print("hi")
if x > 5:
x = 0
But this also requires me to track which branches change which variables and if we need them in the condition
And then there's the case where both of the branches change the variable
I would just in general advise not using else if you want maximum optimized code without the little-costy elif temp variable
elif temp variable is just the safest option for the compiler though, unless I do this in-depth analysis
And there's also the question of "How do I find the perfect order combination if it was an if-elif-else chain?" and this might slow things down too
This is basically my conclusion, I might optimize it in the future with in-depth analysis
But in your case you probably shouldn't worry about a single score
Also I pushed the new version!
Also I just lazified both min and max functions
I'm going to cry because it's all linear

No temps
I just love how everything works perfectly with each other and everything's so independent of each other yet they resonate with each other so perfectly with just a few simple rules
(Also I should probably ping you, I fixed the problems)
awesome
@median notch
how do I do this
nbt[
aha
Also same thing goes with nbt{
Hmm I expected this to output something like ```py
with schedule("1t", append=True).as(@n[type=text_display,tag=streak_counter]):
@s.transformation.scale = nbt[3.5f, 3.5f, 3.5f]
@s.start_interpolation = 0
**this function**
schedule function tg:with_0 1t append
**with_0**
execute as @n[type=text_display,tag=streak_counter] run function tg:with_1
**with_1**
@s.transformation.scale = nbt[3.5f, 3.5f, 3.5f]
@s.start_interpolation = 0
What happened
sorry accidentally pressed enter to early
Oh you need to have two withs, schedule is a special one
If you're asking why it errored
maybe you can add evaluation like this
I might connect them but the philosophy behind you being able to chain them was because they are all execute modifiers, but schedule isn't
hmm IC
So if you do as...schedule...at it can make sense as in you first do as, then inside schedule do at
well I'm not thinking of them as "execute modifiers" anymore
Oh also you can always just put a comma in between
oh actually thats not bad syntax
Instead of dot
did you already add @tag?
Oh I forgot
ahh no problem :)
One second it should be easy
It will just call add_function_tag
Also should it just call add_function_tag or should it add it to the existing one if there is one
I think I'll make it have like tag_name.json by default and if it exists append to it
You can use it now!
uugh
I'm on 0.10.2
Can you update and try again?
noice seems to work propperly now

hmm ok I have a problem, I want to do execute unless #streak score_menu >= #record score_menu This is because scores can have a value of unset and thus > in this case won't work
not (x >= y)
If I didn't break it this should work, I had the same problem in the past
What happens when you don't put $
Let me test it
same thing, just writes it literally
Can you send the function as a text
here ```
@tag('dash_weapons/give')
@export('dash_weapons/give')
def give_item(id: macro, components: macro):
loot give @s loot {
"pools":[
{
"rolls":1,
"entries": [
{
"type": "minecraft:item",
"name": id,
"functions": [
{
"function": "set_components",
"components": {
"minecraft:consumable": {"consume_seconds":0.01,"consume_animation":"none","has_consume_particles":False,"sound":"minecraft:intentionally_empty"},
"minecraft:use_cooldown": {"seconds":5},
"minecraft:use_effects": {"can_sprint":True,"speed_multiplier":1},
"minecraft:custom_data": {"tg":{"dashable_weapon":True}},
"minecraft:custom_name": {"text": "SHIFT + RClick to dash","color":"green"}
}
},
{
"function": "set_components",
"components": components
}
]
}
]
}
]
}
Sorry I got busy, it should be fixed now
Resource pack support is here 👀
Ooooh
I also optimized the way it communicated with Beet so now it directly gives the output files to Beet through it's context api
Nice. Did it first output a build and then link that to the pipeline?
You can also make resource packs without Beet, if you don't give any Minecraft function producing code it simply doesn't produce any
Yup that was my simple solution at the time
Now it's pretty ✨ professional ✨
FaNcY
I'm moving stuff around in the docs atm but you can find the docs about it at https://flare.oguzhanumutlu.com/guide/beet#resourcepack-images-textures
I will move it out of there though as it's not necessarily dependant on Beet
It's here now
It's for temporary textures
Ohh so I can use it for my textures that I use to generate the assets?
Yup
Damn awesome
You can also just texture("namespace:item/something")
It will save to there automatically
You can modify the texture and it will save the last version of that texture
Ooo
The docs should update in a sec to include every function with an example
Damn my project is finished now I need time to start another project and actually use flare even more
🤭
Also added the use of AI acknowledgement in README
Because I wrote very little in the documentation
You can see them all in here
Hmm ok that's nice
damn AI is getting good. I didn't notice any AI-ish language in the docs
Yeah I haven't written markdown in a long time 😔
This is probably the most I wrote like ever
Actually wait radon docs too
Next Generation Datapack Development
Also just out of curiosity
How many lines of mcfunction 👀
In the output
Well... I have written a lot of markdown lately. Especially edge case type markdown like __hello__this__*isn't*_underlined
Oooh where
As testing data for my markdown parser 
Hmm idk can I see it somewhere in flares build?
Hmm, no should I add that
That would be really cool
Okay let me think of a place to put it
I'm going to sleep so have a nice evening I guess :)
Good night!
I always say "It's not that I lied, it's because I failed"
