[TUTORIAL] How to change a mobs melee range

Started by Wowie on

Topic category: User side tutorials

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to change a mobs melee range

Step 1. Right click on your mob element and select "Open mod element in code editor" then select "YourMobsName"Entity.java

 

Step 2. Look for this piece of code

@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.0 + entity.getBbWidth() * entity.getBbWidth());
            }
        });

The 4.0 represents the melee range and increasing will increase your mobs melee range similar to ravager

Step 3. Save and lock code