-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Recipe Support #7150
base: dev/feature
Are you sure you want to change the base?
Recipe Support #7150
Conversation
# Conflicts: # src/main/java/ch/njol/skript/classes/data/BukkitClasses.java # src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java # src/main/java/ch/njol/skript/classes/data/DefaultComparators.java # src/main/resources/lang/default.lang
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So uuh thinking about moving this to a module?
nada |
src/main/java/ch/njol/skript/conditions/CondDiscoveredRecipes.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprRecipeCookingTime.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprRecipeCookingTime.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprRecipeCookingTime.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprRecipeCookingTime.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprRecipeExperience.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided more changes were needed, we're aiming for 100
if (delayed.get()) { | ||
Skript.error("Delays cannot be used within a 'register recipe' section."); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? Maybe I wanna add user input for these, there's nothing here that breaks
on jump:
set {_player} to player
register a new furnace recipe with id "why&*($^#&$(*^#&$*#":
set recipe result to bedrock
set recipe cooking time to 1 hour
set recipe experience to 100
set recipe group to "hand_holders"
set {-RecipeBuilder::%{_player}%::waiting} to true
send "What should be the recipe input (item), you have 5 seconds to respond":
set {_now} to 5 second later
while {-RecipeBuilder::%{_player}%::waiting} is true:
if now >= {_now}:
send "You didn't define the input in time, speed up your typing" to {_player}
delete {-RecipeBuilder::%{_player}%::*}
stop
wait a tick
set recipe input to {-RecipeBuilder::%{_player}%::waiting}
delete {-RecipeBuilder::%{_player}%::*}
on chat:
{-RecipeBuilder::%player%::waiting} is true
set {_input} to uncolored message parsed as item
if {_input} is set:
set {-RecipeBuilder::%player%::waiting} to {_input}
stop
send "'%uncolored message%' is an invalid item"
More accurately I just don't see why a wait can't be done, this isn't a consumer like spawn event or anything else, this is a trigger, supporting waits should be fine and will not cause any issues
src/main/java/org/skriptlang/skript/bukkit/recipes/RecipeModule.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/RecipeModule.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/RecipeModule.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/RecipeModule.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java
Outdated
Show resolved
Hide resolved
I mentioned it to smurf once, but mentioning it in the pr itself will be good, what's the thought about a proper RecipeChoice implementation to have more support of ingredients. If this goes through a custom ItemTypeChoice should be created to enable skript's item types correctly and not converting to an itemstack always. This should be pretty safe due to the fact recipes and these can't be serialized by default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lookin' better
src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/SecRegisterRecipe.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/ExprRecipeResult.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/ExprRecipeResult.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/ExprRecipeType.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/ExprRecipeType.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/CondDiscoveredRecipes.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/CondRecipeExists.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/EffDiscoverRecipe.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/EffRemoveRecipe.java
Outdated
Show resolved
Hide resolved
|
||
static { | ||
Skript.registerEffect(EffResetRecipes.class, | ||
"reset [the] server['s] recipes"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove, reset, etc makes me thing maybe the server's recipes should be an expression with changers
this.pattern = "[the] " + pattern + " [of %-recipes%]"; | ||
this.toString = toString; | ||
this.eventClass = eventClass; | ||
this.error = error; | ||
} | ||
|
||
RecipePattern(String pattern, String toString, Class<? extends Event>[] eventClasses, String error) { | ||
this.pattern = "[the] " + pattern + " [of %-recipes%]"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, shouldn't be nullable
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/ExprRecipeKeyConverter.java
Outdated
Show resolved
Hide resolved
|
||
static { | ||
Skript.registerExpression(ExprRecipeResult.class, ItemStack.class, ExpressionType.PROPERTY, | ||
"[the] recipe result[ing] [item] [of %-recipes%]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be nullable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea here is that the expression can be used in a recipe section, and therefor no need to specify the recipe?!?!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but that should be done via a default value: [of %recipe%]
that's filled in by the section's event-recipe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right, duh... my bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sovde, so I did attempt to make a event value for the section, however, not all recipes are able to be modified after creation, i.e. Smithing Recipe + sub recipes. I was unsure how to go about it as it would be inconsistent.
Let me know what you think I should do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should wrap them in a mutable wrapper, then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would I go about doing this? Is there a reference by chance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not off the top of my head
you just make your own recipe class that wraps the actual recipe
private static final boolean RUNNING_1_20 = Skript.isRunningMinecraft(1, 20, 0); | ||
|
||
static { | ||
Skript.registerSection(SecRegisterRecipe.class, "(register|create) [a] [new] %*recipetype% with [the] (key|id) %string%"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I want to create a recipe without registering it? I think that this should wait for secspressions and utilise that feature instead. An expression section to create the recipe, and an effect to register a recipe (could just be the server recipe's expression changer i mentioned before (could support set, add, remove, reset, clear, etc))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is your idea behind it just this?? Since if so I'd agree it's nice, but I think it could be added as a future thing unless it's confirmed Secpressions are 2.10
set {_recipeCopy} to a new %recipetype% with [the] (id|key) %string%:
set recipe cook time to 10 seconds
return recipe#???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set {_recipeCopy} to a new %recipetype% with [the] (id|key) %string%:
set recipe cook time to 10 seconds
just this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And they are feature-ready, but just waiting on a double check by walrus
private void customError(String message) { | ||
Skript.info("Line " + thisNode.getLine() + ": (" + thisScript + ")\n\t" + message + "\n\t" + thisNode.getKey()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please either do this properly or don't do it at all
properly would entail an api that all syntaxes could use that uses proper lang nodes and colours like all the rest of the error formats.
src/main/java/org/skriptlang/skript/bukkit/recipes/RecipeModule.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/SecRegisterRecipe.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/SecRegisterRecipe.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/recipes/elements/ExprRecipeKey.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few lil nitpicky things.
Description
This PR aims to add support for recipes including:
Target Minecraft Versions: any
Requirements: none
Related Issues: #5261