How do I select specific mob types?

Started by CaptainShark on

Topic category: Help with modding (Java Edition)

Last seen on 06:13, 28. Aug 2023
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I select specific mob types?

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?
 

Last seen on 06:13, 28. Aug 2023
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've been thrown by one type…
Sat, 07/23/2022 - 22:18

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.

Last seen on 15:21, 16. Oct 2023
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can't get everything…
Tue, 07/26/2022 - 05:02

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. 

Last seen on 06:13, 28. Aug 2023
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ah I was basically skipping…
Tue, 07/26/2022 - 12:49

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?

Last seen on 15:21, 16. Oct 2023
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Code above is for IF…
Fri, 07/29/2022 - 16:05

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. :<