Posted August 26, 20214 yr Forge 1.17.1 Hello. I want to do something like scare mobs potion effect. It basically would make mobs ignore the player, just like on gamemode creative. I discovered that when I give player disableDamage ability (player.abilities.disableDamage), mobs start to ignore the player. But I don't want to make player invulnerable (I'll use tags). Then I found this method in MobEntity class: public boolean canAttack(LivingEntity target) { return target.getType() == EntityType.PLAYER && ((PlayerEntity)target).abilities.disableDamage ? false : super.canAttack(target); } I just need to somehow override/change/...? it to something like return target.getType() == EntityType.PLAYER && ((PlayerEntity)target).getTags().contains("scare_mobs") ? false && ((PlayerEntity)target).abilities.disableDamage ? false : super.canAttack(target);) but I don't really know how. What is the best way to do this, without breaking the game? Edited August 26, 20214 yr by KopoL
August 26, 20214 yr 1.15 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
August 26, 20214 yr only possible via coremodding ask on the forge discord server in the non-api-modding chanel there are the experts about coremodding
August 26, 20214 yr Author Okay, thank you. But do you think of any other way to prevent them from attacking the player without making him invulnerable - without using abilities? Because using core modding is my final solution, If I had any other option I'd prefer to use it.
August 26, 20214 yr 28 minutes ago, Luis_ST said: only possible via coremodding there is no Hook or Event where you can use
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.