AbstractIllager .java

net.minecraft.world.entity.monster.illager.AbstractIllager (class): members: RaiderOpenDoorGoal, IllagerArmPose, considersEntityAsAlly, getArmPose.

net.minecraft.world.entity.monster.illagerclass62 linescommonextends Raider1.6 KB

API Surface (5)

void registerGoals()
AbstractIllager.IllagerArmPose getArmPose()
boolean canAttack(final LivingEntity target)
boolean considersEntityAsAlly(final Entity other)
boolean canUse()

Full Source

AbstractIllager.java62 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.monster.illager;
2
3
import net.minecraft.tags.EntityTypeTags;
4
import net.minecraft.world.entity.Entity;
5
import net.minecraft.world.entity.EntityType;
6
import net.minecraft.world.entity.LivingEntity;
7
import net.minecraft.world.entity.ai.goal.OpenDoorGoal;
8
import net.minecraft.world.entity.npc.villager.AbstractVillager;
9
import net.minecraft.world.entity.raid.Raider;
10
import net.minecraft.world.level.Level;
11
12
public abstract class AbstractIllager extends Raider {
13
	protected AbstractIllager(final EntityType<? extends AbstractIllager> type, final Level level) {
14
		super(type, level);
15
	}
16
17
	@Override
18
	protected void registerGoals() {
19
		super.registerGoals();
20
	}
21
22
	public AbstractIllager.IllagerArmPose getArmPose() {
23
		return AbstractIllager.IllagerArmPose.CROSSED;
24
	}
25
26
	@Override
27
	public boolean canAttack(final LivingEntity target) {
28
		return target instanceof AbstractVillager && target.isBaby() ? false : super.canAttack(target);
29
	}
30
31
	@Override
32
	protected boolean considersEntityAsAlly(final Entity other) {
33
		if (super.considersEntityAsAlly(other)) {
34
			return true;
35
		} else {
36
			return !other.is(EntityTypeTags.ILLAGER_FRIENDS) ? false : this.getTeam() == null && other.getTeam() == null;
37
		}
38
	}
39
40
	public enum IllagerArmPose {
41
		CROSSED,
42
		ATTACKING,
43
		SPELLCASTING,
44
		BOW_AND_ARROW,
45
		CROSSBOW_HOLD,
46
		CROSSBOW_CHARGE,
47
		CELEBRATING,
48
		NEUTRAL;
49
	}
50
51
	protected class RaiderOpenDoorGoal extends OpenDoorGoal {
52
		public RaiderOpenDoorGoal(final Raider raider) {
53
			super(raider, false);
54
		}
55
56
		@Override
57
		public boolean canUse() {
58
			return super.canUse() && AbstractIllager.this.hasActiveRaid();
59
		}
60
	}
61
}
62

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