#(plasmatm) Custom item as the trade input?

70 messages · Page 1 of 1 (latest)

lament nova
#

Hey, I have some code that creates a simple villager trade shop, based on config.

If I set the input as any vanilla item, such as charcoal, it works perfectly as the first image shows. It shows up, I can trade no problem.

But if I change JUST the config "input" for the trade to test_item, it works visually but I cannot trade. Pictures added for clarity.

Config before (working with charcoal):

config:
    type: data
    main_shop:
        one:
            result: diamond
            result_amount: 3
            input: charcoal
            input_cost: 5

Config after (not working with test_item, but shows the correct item visually I just cannot trade):

config:
    type: data
    main_shop:
        one:
            result: diamond
            result_amount: 3
            input: test_item
            input_cost: 5

Also, here is the code used to generate the trade from the config:

get_config:
    type: procedure
    definitions: key
    script:
        - determine <script[config].data_key[<[key]>]>

test_shop:
    type: task
    definitions: player
    script:
        - define config_trades <map[<proc[get_config].context[main_shop]>]>
        - define trades <list>
        - foreach <[config_trades]> key:key as:trade_info:
            - define trades:->:<trade[trade[result=<[trade_info].get[result]>[quantity=<[trade_info].get[result_amount]>];max_uses=999;inputs=<[trade_info].get[input]>[quantity=<[trade_info].get[input_cost]>]]]>
        - opentrades players:<[player]> <[trades]>

Any ideas?

marble pilotBOT
#

(plasmatm) Custom item as the trade input?

marble pilotBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

lost bobcat
#

!debug

weary burrowBOT
# lost bobcat !debug
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

lost bobcat
#

Can you provide a debug of that script please?

lament nova
lament nova
#

The debug shows nothing wrong, and the item appears visually so i just can't understand why the trade doesn't work

pallid sundial
#

I just tried this with your exact code and it's working as expected

weary burrowBOT
# pallid sundial !logcheck https://paste.denizenscript.com/View/117705
Server Version

Paper version git-Paper-176 (MC: 1.20.1)-- (:warning: Outdated build, behind by 116... Current build is 292)

Plugin Version(s)

Citizens: 2.0.32-SNAPSHOT (build 3147) -- (:warning:Outdated build, behind by 119)
Denizen: 1.2.8-SNAPSHOT (build 1797-REL) -- (Outdated build, behind by 2)
Depenizen: 2.1.0 (build 840) -- (Outdated build, behind by 10)
dDiscordBot: 0.7 (build 293) -- (Outdated build, behind by 2)

Checked For

@pallid sundial

Online/Offline

Offline, but proxied.

UUID Version

4 (:white_check_mark: Online)

Java Version

17.0.9 :white_check_mark:

Other Noteworthy Plugin(s)

WorldGuard: 7.0.9+5934e49, MythicMobs: 5.4.1-${CI_COMMIT_SHORT_SHA}, ProtocolLib: 5.1.0, Quests: 4.8.3-b423

Problematic Plugin(s)

PlugManX: 2.3.3 - :warning: Plugin Managers are dangerous and will cause unpredictable issues. Remove it.

Possibly Relevant Plugin(s)

TAB: 4.0.3 - This plugin adds Below_Name scoreboards to NPCs.
ViaVersion: 4.8.1 - Mixed client vs server versions can sometimes cause packet-related issues.
HeadDatabase: 4.18.0 - HeadDatabase has been known to cause issues with skins.
ModelEngine: R4.0.2 - ModelEngine has Citizens support, but that support is known to be buggy. Issues related to NPCs that use ModelEngine should be reported to ModelEngine support, not Citizens.
FastAsyncWorldEdit: 2.8.2-SNAPSHOT-585;37161f9 - This plugin has been known to break the plugin load order on many servers, due to usage of the 'loadbefore' directive in its 'plugin.yml'.
GSit

pallid sundial
#

!update paper denizen

weary burrowBOT
# pallid sundial !update paper denizen
Update Paper

Paper is a higher-performance alternative to Spigot that is 100% compatible with the equivalent Spigot version. It's much easier to update than Spigot itself, and carries a lot of performance and quality-of-life benefits.

Latest Paper builds are at https://papermc.io/downloads/paper.

(If you would prefer to use a Spigot build, refer to !update spigot).

pallid sundial
#

try updating

#

Also, your code looks very much over complicated

#
config:
    type: data
    main_shop:
        1:
            result: diamond[quantity=3]
            input: iron_ingot[quantity=5]
        2:
            result: emerald[quantity=3]
            input: gold_ingot[quantity=5]

test_shop:
    type: task
    script:

    - define trade_config <script[config].data_key[main_shop]>
    - foreach <[trade_config]> as:trade:
      - define trade <trade[trade[result=<[trade.result]>;inputs=<[trade.input]>;max_uses=999]]>
      - define trades:->:<[trade]>
    - opentrades <[trades]>```
This does the exact same thing
lament nova
lament nova
lament nova
lament nova
# pallid sundial try updating

Okay updating was a disaster

Did you try this with a custom item? as that's what my question was about but your new suggested code doesn't mention 1, and even on the latest versions it isn't working for me

pallid sundial
#

Yes custom works as well

pallid sundial
#

!patchversion

weary burrowBOT
# pallid sundial !patchversion
Info: patchversion

We support only the latest patch-version of Minecraft for any recent main version (and Mojang, Spigot, Paper, etc. all generally also follow the same rule).

"Patch version" means the last number in a version label, for example in 1.18.2, the main version is 1.18, and the patch version is .2.
So if 1.18.2 is the latest patch version, then 1.18.1, and 1.18(.0) are all outdated patch versions, and therefore are unsupported.

Note that we do still support recent older main versions (such as 1.17 and 1.16) so long as you are on the latest patch-version of those main versions (like 1.17.1 and 1.16.5).

pallid sundial
lament nova
# pallid sundial

okay so idk why but it's clear after a ton of testing that the test_item I get from the shop is different to the test_item i get with "/ex give test_item", and I cannot think of a reason why

i can only get your code to work if i buy tokens, then use them to buy other stuff. the tokens from this shop do not seem stackable with the /ex give ones, even with your exact code

steep sun
#

It might tell you something about their differences

lament nova
steep sun
#

I believe you just keep SelectedItem there. It should get the item in your hand if Im not mistaken

#

otherwise, throw the item onto the ground and use /data get entity @e[type=item,limit=1,sort=nearest]

lament nova
#

ah yes, so the item from /ex give is:

#

and the item i get from the trade gui is:

#

hard to really see the difference but, they're clearly different somehow

steep sun
#

Alright so yeah that's a pretty huge difference

#

Where do you define the item you get from the trade gui?

#

As in, where do you specify all those parameters

lament nova
#

i am just putting "test_item" in a config value for the "result" part of a trade tag, and then the test_item in the code is very simple

test_item:
    type: item
    material: sugar
    display name: <&gradient[from=<&color[#0276FD]>;to=<&color[#ADF3FD]>]><&l>Test Item
    enchantments:
    - luck_of_the_sea:1
    mechanisms:
        hides: all
lament nova
#

okay so, changing display name to just "<&6>Test Item" has it now working

#

so it's something to do with the gradient and bold? is this a bug?

#

yep, it's the gradient

#

for some reason, the gradient breaks it

#

should i report this somewhere?

cerulean isle
#

After trading an item with a gradient through a trading GUI it doesn't match the original item anymore?

steep sun
#

What mc version is this?

#

ok yeah no Im lost. Good luck 😕

cerulean isle
#

Well first of all the last debug you posted was on an outdated version, so should post an updated one

lament nova
flint vapor
weary burrowBOT
# flint vapor !logcheck https://paste.denizenscript.com/View/118094
Server Version

Paper version git-Paper-309 (MC: 1.20.2)-- (Current build :white_check_mark:)

Plugin Version(s)

Citizens: 2.0.33-SNAPSHOT (build 3275) -- (Current build :white_check_mark:)
Denizen: 1.2.9-SNAPSHOT (build 6936-DEV) -- (Current build :white_check_mark:)
Depenizen: 2.1.0 (build 850) -- (Current build :white_check_mark:)
Sentinel: 2.8.1-SNAPSHOT (build 513) -- (Current build :white_check_mark:)
dDiscordBot: 0.7 (build 295) -- (Current build :white_check_mark:)

Checked For

@flint vapor

Online/Offline

Offline, but proxied.

UUID Version

4 (:white_check_mark: Online)

Java Version

17.0.6 :white_check_mark:

flint vapor
#

works fine on current version

#

!update

weary burrowBOT
#
Update Paper

Paper is a higher-performance alternative to Spigot that is 100% compatible with the equivalent Spigot version. It's much easier to update than Spigot itself, and carries a lot of performance and quality-of-life benefits.

Latest Paper builds are at https://papermc.io/downloads/paper.

(If you would prefer to use a Spigot build, refer to !update spigot).

lucid lavaBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@lament nova

lament nova
flint vapor
#

we can help you update though, that's a common misunderstanding that you are infact able to remain persistent in maintaining your server properly

lament nova
#

Can I update Denizen and not paper? Updating Paper is going to be a huge task that I cannot do before I need the above code to work

flint vapor
#

probably not, but you can rest assured it's just like waking up on a hard Monday - you'll be happy when it's done, over with, and working great again. we're here to support you clappy

cerulean isle
#

We're happy to help if you can provide more info on why can't you update, otherwise we can't really fix issues on outdated versions (epecially ones that already got fixed)

lucid lavaBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@lament nova

lament nova