Mob Attack Range Value

Started by OMGitsMiniMe on

Topic category: Feature requests and ideas for MCreator

Active 2 years ago
Joined May 2022
Points:
368

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
Mob Attack Range Value

I am making a mod with very small mobs and I would like to be able to change the attack range of them because they can attack each other from very far away (1-2 blocks). and id like them to have to get right up on each other to attack each other. thank you!

Active 1 year ago
Joined May 2022
Points:
367

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
open your Entity code find…
Thu, 05/26/2022 - 01:47

open your Entity code

find registerGoals


		@Override
		protected void registerGoals() {
			super.registerGoals();
......
			this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.2, false) {
				@Override
				protected double getAttackReachSqr(LivingEntity entity) {
					return (double) (4 + entity.getWidth() * entity.getWidth());
				}
			});
......
		}

return (double) (4 + entity.getWidth() * entity.getWidth());

Try reducing the value of 4, it should reduce the attack range

For example my ZombieArm entity is using 0.5

Active 2 years ago
Joined May 2022
Points:
368

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
thank you so much. they…
Sat, 05/28/2022 - 03:24

thank you so much. they should really add this to the properties or something. it really shouldn't be that hard to add should it

Active 1 month ago
Joined Nov 2019
Points:
777

User statistics:

  • Modifications: 0
  • Forum topics: 25
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 42
there is already such attack…
Thu, 01/30/2025 - 04:34

there is already such attack AI variant with attack range value to be set

Active 2 hours ago
Joined Mar 2024
Points:
211

User statistics:

  • Modifications: 0
  • Forum topics: 7
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 226
Or use attributes
Sun, 02/02/2025 - 08:21

Or use attributes