Jump to content

Changing/Reading Villager Data?


laufenderWahnsinn

Recommended Posts

Hi, I am used to Java coding, but not so much to forge.

And even after multiple days of googling, I still struggle.

Right now, I am trying to read (and later modify) villager data. The idea is to be able to reset the last level of the villager, including exp and trades.

Right now I am struggling to understand how to read the data, so I get the trades, level and exp.

What I have found: with

entity.getEntityData().getAll();

I get data, but I haven't found any information about what the entry means (only numbers for 1 to 18, while 18 is "VillagerData").

Side question: Is there a way to directly get the "VillagerData" without a "foreach"?

Okay, there I have "VillagerData", but according to this

1.18.2 VillagerData

I can get and set level and profession, but I don't see trades and exp.

Any attempt to get "CompundTag" like

CompoundTag test = entity.getEntityData();

does not work.

How can I get the data so I can modify it?

I am using forge-1.19.2 43.2.0.

 

Chees

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.