DenizenScript / Denizen

NPC and general Spigot scripting, using the Denizen Scripting Language!
https://denizenscript.com/
MIT License
207 stars 104 forks source link

Recipes #1481

Closed HeadlessJoey closed 7 years ago

HeadlessJoey commented 7 years ago

Version, build 1626. Using this event: 'on item recipe formed' I've just been having lots of issues.

on torch recipe formed:
- determine i@stone

Works totally fine and it changes the outcome into stone. However:

on i@torch recipe formed:
- determine i@stone

Doesn't work. Just using torch here as an example but this means any i@customitem doesn't trigger this event. Trying to do: Make 3 custom items with the same item but their recipes would be in different orders. For example SteelSword, SteelSword2 and SteelSword3 with 3 different recipes but then with that event I would determine SteelSword, so people don't walk around with numbers SteelSword2 or 3.

Next, I'm not sure if this is an issue or just not possible but I would think it's something normal to make a recipe using quantities instead of always using 1 of each item:

recipe:
- air|air|air
- air|air|air
- charcoal|iron_ore[quantity=5]|charcoal

This recipe works but only 1 iron_ore will be deduced and the outcome already shows up as soon as you put in 1 iron_ore, so quantities don't seem to work in recipes.

Morphan1 commented 7 years ago

Don't use object identifiers in events (The i@ portion). For example, instead of on i@ItemScript blah, just use on ItemScript blah Also, I don't believe Bukkit supports multiple items in one slot - they don't even support requiring lore or anything besides material, we have our own custom handlers for that. We may be able to add support for quantities if it's an important feature

HeadlessJoey commented 7 years ago
SteelIngot:
  type: item
  material: iron_ingot
  display name: <&7>Steel Ingot
  recipe:
  - air|air|air
  - air|air|air
  - charcoal|iron_ore[quantity=5]|charcoal

For example I got this item that I've been testing with and it would be awesome if that [quantity=5] behind the item in the recipe would work. Up to you whether it's possible and worth implementing. For me it would safe a lot of time. Right now I would have to make extra items such as iron_ore bundles or whatever which would equal to 5 iron_ore and use that instead. Kinda confusing but it's a workaround.

Anyway the real problem, if I understood correctly then I'm not supposed to use i@SteelIngot in the event but instead just use 'on SteelIngot recipe formed' but that too doesn't seem to be working.

on SteelIngot recipe formed:
- determine i@stone

Just gives the SteelIngot item and not stone.

Problem is with the determine if I tested it correctly just now:

ChangeRecipeItems:
  type: world
  events:
    on item recipe formed:
    - if <context.item.scriptname> == STEELINGOT determine i@stone[quantity=5]

This triggers fine but it doesn't change the outcome to stone. If I use it with a torch, if <context.item> == i@torch[quantity=4] determine i@stone[quantity=5] then that works fine. So I think the determine doesn't work with a custom item recipe as that overrides it somehow? No clue.

Morphan1 commented 7 years ago

Fixed the determining issue. I'll open a new issue for quantities and stuff

Morphan1 commented 7 years ago

1482

Also, for the fix use the latest developmental build http://ci.citizensnpcs.co/job/Denizen_Developmental/lastSuccessfulBuild/