Hello! I just released an Update of the MCreator Tutorial Mod and I just added the Guards, which is supposed to attack all hostile mobs around, but we need to add all mobs possible in here AI Builder, like in Image 1
What I am asking in this ticket is a Procedure block which is "Check if mob is [Hostile/Docile?]"
Or something same in AI Builder which is "Attack only[ ] Hostile Mobs?" or "Attack only[ ] Docile Mobs?"
I am asking this feature because guards won't attack Hostile mobs of other mods
Issue comments
Back on this, It can be implemented in many ways, I see, You can add all the ways? Well I think No, because it will be hard
Then If we can't detect Hostility, Then there is another solution, A lot of procedures blocks like:
Can entity attack player?
Does Entity spawn during night?
Does Entity spawn during day?D
Does Entity burn to sun?
Entity can breed?
Entity can open doors?
Get Entity Speed
Get Entity Attack Damage
And surely many other ones may be possible to detect a mob,
What I am think is a IF for all mobs AI procedure blocks
@Loic_MaitreDuFeu I actually figured out how to do this inside a procedure with a bit of custom code! :]
what you do is you have to create whatever you want to be inside the procedure like normal along with a place holder if-statement for where you want the “if entity is hostile” part to be, then lock the code and inside the code editor put “if (entity instanceof Monster) {your code here…}” where you put the placeholder if-statement, then up towards the top where the “import” statements are past in “import net.minecraft.world.entity.monster.Monster;” before closing out and clicking the “save changes” option, and you’re done!! :D
Just keep in mind this is for the more recent versions of Minecraft, so i’m not sure how well it’ll work for the older versions!! :P
@Klemen I couldn't find the "is entity of type" procedure block you mentioned, the closest thing to it I could find (for MCreator version 2024.3) is "is [Entity] creature type" which only has the following options to choose from:
UNDEAD
ARTHROPOD
ILLAGER
WATER
None of which could be used to detect if a entity is a hostile mob in general, you could get semi close by combing them, but then you'd end up getting bees in the list too and wouldn't be able to detect creepers, endermen, blaze, ghasts, or piglin-brutes all of which don't fall under any of the above mentioned categories! :P
admittedly though I could be wrong about this and just overlooked the procedure block you mentioned, and if that is the case I do apologize, however as I said previously I really didn't see anything that could do this without custom code!! ';./
@Klemen Never mind I found it, in my defence though it was for the longest time that the "is [Entity] (sub)type of [Type]" procedure block was only for things like detecting if the entity was a pig or cow or something like that! XP
sorry for the previous message, feel free to ignore it! :(
For the AI tasks, we are limited to the functions that are available in AI tasks that Minecraft has and these can only define entities per name, not per type so we can't add this.
Hostility is also not a 100% defined parameter that would make checking this possible in procedures too.
The solution I see right now is that you make a list of all entities that are hostile and save it as a template so you can easily reuse it.