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've been thrown by one type of mob in particular, Variations of sheep, There are quite a few "color" related data parts for them so it's not been simple to follow and so far nothing i tried worked. Either it crashed/refused to load or no mob was detected. I had a look online but the few people i found asking about this seemed to never get answers/ are now very old posts.
The idea is to have a shepherd near sheep = shears the sheep/spawns wool at their position but for this it needs to be able to detect what sheep variation it is to spawn the right wool type.
You can't get everything through data tags cause you can get everything through code:
((Sheep) entity).getColor() == DyeColor.BLUE.
You check all colors, that are given by code above, here, look under enum constants:
https://nekoyue.github.io/ForgeJavaDocs-NG/javadoc/1.18.2/net/minecraft/world/item/DyeColor.html
In doing stuff that are not in mcreator its good to know how to read documentation qwq.
Ah I was basically skipping the "dye" part and just putting the color. The code you put I assume goes in a code snippet(null). It ends up crashing on activation so not sure why. I think we had a similar issue before and it got figured out somehow but not sure?
Code above is for IF statement. I didn't test it, i assume i it should work, it would be better to check if entity is a sheep before checking dyecolor.
In docs there might be some useful methods that can sometimes will be better than things built in mcreator but you have to know java programing basics at least to use them. :<