Stray .java

net.minecraft.world.entity.monster.skeleton.Stray (class): members: checkStraySpawnRules, getArrow, getStepSound, getAmbientSound, getDeathSound, pos.

net.minecraft.world.entity.monster.skeletonclass69 linescommonextends AbstractSkeleton2.2 KB

API Surface (6)

boolean checkStraySpawnRules(final EntityType<Stray> type, final ServerLevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random)
SoundEvent getAmbientSound()
SoundEvent getHurtSound(final DamageSource source)
SoundEvent getDeathSound()
SoundEvent getStepSound()
AbstractArrow getArrow(final ItemStack projectile, final float power, final @Nullable ItemStack firingWeapon)

Fields & Constants (1)

pos

Full Source

Stray.java69 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.monster.skeleton;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.sounds.SoundEvent;
5
import net.minecraft.sounds.SoundEvents;
6
import net.minecraft.util.RandomSource;
7
import net.minecraft.world.damagesource.DamageSource;
8
import net.minecraft.world.effect.MobEffectInstance;
9
import net.minecraft.world.effect.MobEffects;
10
import net.minecraft.world.entity.EntitySpawnReason;
11
import net.minecraft.world.entity.EntityType;
12
import net.minecraft.world.entity.monster.Monster;
13
import net.minecraft.world.entity.projectile.arrow.AbstractArrow;
14
import net.minecraft.world.entity.projectile.arrow.Arrow;
15
import net.minecraft.world.item.ItemStack;
16
import net.minecraft.world.level.Level;
17
import net.minecraft.world.level.ServerLevelAccessor;
18
import net.minecraft.world.level.block.Blocks;
19
import org.jspecify.annotations.Nullable;
20
21
public class Stray extends AbstractSkeleton {
22
	public Stray(final EntityType<? extends Stray> type, final Level level) {
23
		super(type, level);
24
	}
25
26
	public static boolean checkStraySpawnRules(
27
		final EntityType<Stray> type, final ServerLevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random
28
	) {
29
		BlockPos checkSkyPos = pos;
30
31
		do {
32
			checkSkyPos = checkSkyPos.above();
33
		} while (level.getBlockState(checkSkyPos).is(Blocks.POWDER_SNOW));
34
35
		return Monster.checkMonsterSpawnRules(type, level, spawnReason, pos, random)
36
			&& (EntitySpawnReason.isSpawner(spawnReason) || level.canSeeSky(checkSkyPos.below()));
37
	}
38
39
	@Override
40
	protected SoundEvent getAmbientSound() {
41
		return SoundEvents.STRAY_AMBIENT;
42
	}
43
44
	@Override
45
	protected SoundEvent getHurtSound(final DamageSource source) {
46
		return SoundEvents.STRAY_HURT;
47
	}
48
49
	@Override
50
	protected SoundEvent getDeathSound() {
51
		return SoundEvents.STRAY_DEATH;
52
	}
53
54
	@Override
55
	protected SoundEvent getStepSound() {
56
		return SoundEvents.STRAY_STEP;
57
	}
58
59
	@Override
60
	protected AbstractArrow getArrow(final ItemStack projectile, final float power, final @Nullable ItemStack firingWeapon) {
61
		AbstractArrow arrow = super.getArrow(projectile, power, firingWeapon);
62
		if (arrow instanceof Arrow arrow2) {
63
			arrow2.addEffect(new MobEffectInstance(MobEffects.SLOWNESS, 600));
64
		}
65
66
		return arrow;
67
	}
68
}
69

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