Started by
CaptainShark
on
Topic category: Help with Minecraft modding (Java Edition)
Currently messing around with a villager related mod but it relies on 4 types.
I have 4 new chests, a farmer, butcher, shepherd and then an "all villager types" chest.
How do I use a procedure to work with just the one type of villager, for example a farmer?
I might be building this wrong so providing a photo of it https://i.imgur.com/yjYTQEp.png
Uhh, you sure that there's
method that returns enum VillagerProfession?
I believe I copied it all including the despawn part. When test running the workspace though it comes back with the "your workspace contains mod elements" message and lists the same element as the issue
I only mean this part:
I answered basing on pretty good (unofficial) forge documentation. Also by code snippet i meant the one in Advanced category.
https://nekoyue.github.io/ForgeJavaDocs-NG/
Also i just noticed that there's no
Which stores vanilla Villager professions.
Im sure it will crush.
I'll send picture tomorrow. It'll be easier to explain how to do it.
Okay cool lmao. It will be a lot easier after seeing the working versions of the procedure blocks and the working code if it gets edited. It will get a bit more complicated at the next few steps of the mod but to keep it simple for now it just needs to make sure a specific villager type is required to summon an entity ( purely so it is easier to understand, eventually it will have to involve breaking blocks/custom chests )
But both Event class and PlayerEvent.EntityInteract class do not have direct access to Villager Profession, so I don't know how it's gonna work?
Gonna list basically the full list of what I planned for the specific villagers to do. Are they possible, insanely difficult to do, or simpler than expected lol
When a Farmer is near a crop ( like melon/pumpkin, non vanilla harvested ones ) AND is near a "Farmer's Chest" ( custom block )
Break the Melon, spawn 1 melon in the Farmers Chest
Fisherman near an axolotl = Spawn a salmon at the position of the Axolotl ( on a 2 minute cooldown )
Shepherd near a sheep with wool AND "Shepherds Chest" = Shear nearby sheep and spawn the correct wool in the Shepherds chest
Butcher near pig/cow/chicken AND "Butchers Chest" = Kill 1 animal and spawn the food in the "butchers chest" ( 1 minute cooldown )
Cleric near any villager or golem = gives them 10 seconds of regen 1 ( 1 minute cooldown )
Any villager near 2 of the same: sheep, pig, cow, chicken AND "Breeding Chest" if 2 wheat in chest spawn 1 baby of 1 type of the nearby animals ( 5 minute cooldown )
So i guess it'll be working on entity update tick (or sth like this i don't remember how it's called).
For checking entities (like sheep, chicken etc) you'd have to loop though all entities with some range (there's a procedure for this in mcreator blocks, something like "for each entity") and do your stuff for each found entity.
About blocks/crops i have no idea.
I assume blocks/crops I can test for block in radius similar to entity radius checks? I am fairly sure if 1 of them works I can then mostly copy and paste for the others/edit the small parts like which chest/which villager from the first example. I just one doe with pictures of it all so I can understand it lol
Okay, sorry for the delay, i have Internet and yesterday couldn't make new project (i was re-downloading mcreator cause im trying to do a thing qwq).
Anyway, here how "if" block looks like:
And code snippet you can find here:
And to this snippet paste:
For other professions just change "FARMER". But remember that it has to be uppercase.
If pics didn't show or something, here raw url:
https://raw.githubusercontent.com/Azzy380/json-files/main/Img/procedure…
https://raw.githubusercontent.com/Azzy380/json-files/main/Img/Untitled1…
https://raw.githubusercontent.com/Azzy380/json-files/main/Img/Untitled2…
ok but how did this post get 34 replies
in only a few minutes
This thread has a week soo,
That happens when you forget stuff qwp.