Jump to content

[1.12.2] Custom Villager Help


Hazmatik

Recommended Posts

So I've been trying to add a custom villager to the game and I have added a villager profession and career and set up a trade and everything is working when I use a spawn egg I can get the villager from it however they don't seem to be spawning naturally in villages. Do I need to add a structure for them to spawn with or is there something else that I need to do to get them to spawn?

My Professions Class: https://github.com/Hazmatik/SonicTech/blob/master/src/main/java/hazmatik/sonictech/init/STProfessions.java

 

and here is where it is called in the init() of my main mod class: https://github.com/Hazmatik/SonicTech/blob/master/src/main/java/hazmatik/sonictech/SonicTech.java#L49


 

 
Edited by Hazmatik
Link to comment
Share on other sites

Is it possible to load a village structure from an NBT file created from Structure Blocks? I decided on adding a structure in the village for my villager to spawn with and I am trying to wrap my head around how to define the different blocks of the structure and was thinking it would be a lot easier if I could build the structure in world and use a Structure Block to export it to an NBT file like I've done before to spawn structures in the world in general.

Link to comment
Share on other sites

15 hours ago, Hazmatik said:

Is it possible to load a village structure from an NBT file created from Structure Blocks? I decided on adding a structure in the village for my villager to spawn with and I am trying to wrap my head around how to define the different blocks of the structure and was thinking it would be a lot easier if I could build the structure in world and use a Structure Block to export it to an NBT file like I've done before to spawn structures in the world in general.

Yeah, in your method for addComponentParts() it is up to you how you place the blocks. It is your code, so you can do whatever you want there, either using loops to generate algorithmically, using arrays to generated based on a "map", using a file to load a structure, etc.

 

What I usually do is create a command where I can "capture" an area of the world as an array of blocks and store that to file. Then I just copy that array directly into my code and loop through it. Here is an example of the command I use: https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/commands/CommandStructureCapture.java

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.

Announcements



×
×
  • Create New...

Important Information

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