-
Notifications
You must be signed in to change notification settings - Fork 9
CraftTweaker Possibilities
I've realized that I can restrict crafting recipes based on numerous things, but here are a few that might be most useful:
- Player's current XP or level
- Player's current dimension
- NBT tags that the player has applied to them
Now, of those three, the one that might have tons of unknown possibilities is that NBT tag stuff. NBT tags on a player contain a LOT of information. I'm pretty sure it contains, for example, the player's position and current inventory. I could, for example, only allow someone to craft something above y=128 using NBT tags. Not only that, I could possibly apply custom tags to a player when they perform an action, which can then be checked in a recipe, essentially locking that recipe behind a "gate" that is that action.
Obviously, having such control can be good in a progression-based modpack. However, these recipes will show up in JEI as normal recipes with no notes as to why you cannot craft them unless we do something to point that out. One way that I have done so is by applying lore tags to the inputs of a recipe. Specifically, look at the recipe for the bloomery. On the salamander's eye, there is a Lore tag that says, "not used up when crafting." Since I used "withTag" instead of "onlyWithTag" the lore isn't actually required to be on the item, so it shows up as a note about the recipe, rather than a requirement of the recipe. Thing is, putting the tag on the recipe's output will cause that item to have that tag. It might be a little odd to have an item that talks about how to craft it, and it will not stack with similar items that don't have that tag. Placing a block with that tag then breaking it will likely remove the tag that was applied, so blocks will likely be most susceptible to this.
A second way would be to apply a universal tooltip to that item, similar to the tooltips added to wooden and stone tools. We can't be too descriptive in a tooltip, though, or the tooltip's box might become overly large and get cut off at larger GUI sizes. However, we can add multi-line tooltips or tooltips that are hidden unless the player is holding control or shift.
A third way would be to talk about it in an in-game guide. I don't mind making guides, but I know not everyone wants to read guides every time they craft something.
I expect that we'll get bug reports no matter how we go about trying to resolve this issue.
Applying a tag to a player can be done when a player crafts something. For example, crafting a bloomery, sag mill, grinder, or crusher could set the player's "iron age" tag to "true" then we could have a set of recipes that can only be crafted when that player has entered the iron age.
I know that CraftTweaker has some integration with Forge's events system. I know that it can potentially subscribe to an event and trigger an action in response to that event. I admit that I do not know how to do it yet. My best guess right now is you can create an action in CraftTweaker such as "event.PlayerUseItemStartEvent" then, depending on the item being used, cause the event to apply a tag to the player. In this way, I could cause someone to be marked for the Iron Age if they use, say, an iron pickaxe.