ZombieAttackGoal .java

net.minecraft.world.entity.ai.goal.ZombieAttackGoal (class, 37 lines): members: raiseArmTicks, zombie, stop, start, tick. imports: Zombie.

net.minecraft.world.entity.ai.goalclass37 linescommonextends MeleeAttackGoal828 B

API Surface (3)

void start()
void stop()
void tick()

Fields & Constants (2)

zombie
raiseArmTicks

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ZombieAttackGoal.java37 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.ai.goal;
2
3
import net.minecraft.world.entity.monster.zombie.Zombie;
4
5
public class ZombieAttackGoal extends MeleeAttackGoal {
6
	private final Zombie zombie;
7
	private int raiseArmTicks;
8
9
	public ZombieAttackGoal(final Zombie zombie, final double speedModifier, final boolean trackTarget) {
10
		super(zombie, speedModifier, trackTarget);
11
		this.zombie = zombie;
12
	}
13
14
	@Override
15
	public void start() {
16
		super.start();
17
		this.raiseArmTicks = 0;
18
	}
19
20
	@Override
21
	public void stop() {
22
		super.stop();
23
		this.zombie.setAggressive(false);
24
	}
25
26
	@Override
27
	public void tick() {
28
		super.tick();
29
		this.raiseArmTicks++;
30
		if (this.raiseArmTicks >= 5 && this.getTicksUntilNextAttack() < this.getAttackInterval() / 2) {
31
			this.zombie.setAggressive(true);
32
		} else {
33
			this.zombie.setAggressive(false);
34
		}
35
	}
36
}
37

Decompiled Minecraft 26.3 source of ZombieAttackGoal (net/minecraft/world/entity/ai/goal/ZombieAttackGoal.java) with Mojang official mappings, stored verbatim on the site.