PikaMug / Quests

Easy-to-use, open-source plugin for the creation and execution of quests on Minecraft servers.
https://modrinth.com/plugin/quests.classic
MIT License
157 stars 108 forks source link

Craft items with custom names #2313

Open S4r3ss opened 1 week ago

S4r3ss commented 1 week ago

What does your feature do?

Plugin can't detect when user is crafting custom item, configured using plugin Oraxen

Item could have custom name with colors and lore

If it is already exist, please let me know how to configure it. My item data is

needle:
  itemname: <yellow>Голка
  material: PAPER
  lore:
  - <yellow>Використовуйте даний предмет для крафту теплої броні
  Pack:
    generate_model: true
    parent_model: item/generated
    textures:
    - default/needle.png
    custom_model_data: 1026

There are how I was trying to catch it, using your plugin

'000001':
    name: Зимовий мор
    ask-message: Challenge objectives!
    finish-message: Well done!
    npc-giver-uuid: 2c53e5fc-028f-4092-9b82-fa3f6411b1eb
    stages:
      ordered:
        '1':
          items-to-craft:
          - ==: org.bukkit.inventory.ItemStack
            v: 3953
            type: PAPER
            amount: 4
            meta:
              ==: ItemMeta
              meta-type: UNSPECIFIC
              display-name: '{"text":"","extra":["§eГолка"]}'
              lore:
              - '{"text":"","extra":[{"text":"Використовуйте даний предмет для крафту
                теплої броні","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"yellow","bold":false}]}'

How would people use it?

From my perspective, it will allow people to use custom crafts, created by other plugins (like in my case) or using datapacks (also could be implemented in this way)

PikaMug commented 1 week ago

This seems to be similar to #2234

While it's not within the scope of Quests to handle objects from other plugins (that's what modules and such are for), I'm curious if it's possible to find a general solution using just the Bukkit API.

@S4r3ss Can you provide some more details on how to replicate this with Oraxen? What sort of item you created, how you added the crafting recipe, how to get the item in your hand, etc.?

S4r3ss commented 6 days ago

@PikaMug exist 2 ways of creating custom items. I have explained one of them on description, using oraxen and other one is in native minecraft, but little bit harder to do

I will create steps to reproduce for both of them, and if you will have some questions, don't forget to ping me.

For Native minecraft _5e851004caa47a0c199a00d1-Create a new texture for native minecraft-201124-185448.pdf

For oraxen plugin is much easier. It already has custom items and you can just modify them as you want. But, it's supporting additional plugin, so would be better to implement it at least for native minecraft

S4r3ss commented 6 days ago

Ohh, and also, I forget about crafting receipt. You can use this guide to impelent it https://www.youtube.com/watch?v=XUrKD7K1U7o&t=171s

You just need to modify the result item, to give him custom_model_data and that's it. Crafting receip for custom item is created

PikaMug commented 5 days ago

I will create steps to reproduce for both of them, and if you will have some questions, don't forget to ping me.

That would be appreciated. Still unsure of how to create an item with Oraxen. If you'd rather I use your 'needle' item data instead, then I need to know where to put it and how to then acquire it in-game.

S4r3ss commented 5 days ago

@PikaMug okay, you want to proceed with oraxen then

Open plugins/Oraxen/items/items.yml

Inside this file you should add

needle:
  Enchantments:
    sharpness: 1
  ItemFlags:
    - HIDE_ENCHANTS
  itemname: <yellow>Голка
  material: PAPER
  lore:
  - <yellow>Використовуйте даний предмет для крафту теплої броні
  Pack:
    generate_model: true
    parent_model: item/generated
    textures:
    - default/needle.png
    custom_model_data: 1026

Next, open plugins/Oraxen/recipes/shaped.yml

There you should add next code

needle:
  result:
    oraxen_item: needle
  ingredients:
    A:
      minecraft_type: IRON_NUGGET
  shape:
  - OAO
  - AOO
  - OOO

And also, add texture inside plugins/Oraxen/pack/textures/default. This texture should have name "needle". There are example of our picture, you can use it needle

And now you can give this needle in minecraft using command /o give nickName needle

or craft it, using iron nuggets, like you craft shears

PikaMug commented 4 days ago

Thank you. I gave that a try, but the quest seemed to work fine. The only strange thing was server chat displaying the item as 'Paper' but I'm guessing that's because it does not have a displayname. For reference, here's the quest I used:

  '000001':
    name: craftNeedle
    ask-message: Challenge objectives!
    finish-message: Well done!
    stages:
      ordered:
        '1':
          items-to-craft:
          - ==: org.bukkit.inventory.ItemStack
            v: 4082
            type: PAPER
            meta:
              ==: ItemMeta
              meta-type: UNSPECIFIC
              item-name: '{"text":"Голка","color":"yellow"}'
              lore:
              - '{"text":"","extra":[{"text":"Використовуйте даний предмет для крафту
                теплої броні","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"yellow","bold":false}]}'
              custom-model-data: 1052
              enchants:
                minecraft:sharpness: 1
              ItemFlags:
              - HIDE_ENCHANTS
              PublicBukkitValues: |-
                {
                    "oraxen:id": "needle"
                }
S4r3ss commented 2 days ago

@PikaMug but what if you set display name, quest will still keep working?

PikaMug commented 1 day ago

@S4r3ss I did not see a reason to test that, as the bottomline is it worked fine. Not sure what the issue could be on your end. If you'd like to share the quest you're using I could try to identify a difference, but if that checks out then all I can do is recommend that you investigate potential plugin conflicts.