Skip to content
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

Craft items with custom names #2313

Open
S4r3ss opened this issue Nov 19, 2024 · 8 comments
Open

Craft items with custom names #2313

S4r3ss opened this issue Nov 19, 2024 · 8 comments

Comments

@S4r3ss
Copy link

S4r3ss commented Nov 19, 2024

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
Copy link
Owner

PikaMug commented Nov 19, 2024

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
Copy link
Author

S4r3ss commented Nov 20, 2024

@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
Copy link
Author

S4r3ss commented Nov 20, 2024

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
Copy link
Owner

PikaMug commented Nov 21, 2024

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
Copy link
Author

S4r3ss commented Nov 21, 2024

@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
Copy link
Owner

PikaMug commented Nov 22, 2024

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
Copy link
Author

S4r3ss commented Nov 24, 2024

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

@PikaMug
Copy link
Owner

PikaMug commented Nov 25, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants