/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.jspecify.annotations.Nullable */ package net.minecraft.world.entity.monster; import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.monster.AbstractSkeleton; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.Arrow; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Blocks; import org.jspecify.annotations.Nullable; public class Stray extends AbstractSkeleton { public Stray(EntityType type, Level level) { super((EntityType)type, level); } public static boolean checkStraySpawnRules(EntityType type, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random) { BlockPos checkSkyPos = pos; while (level.getBlockState(checkSkyPos = checkSkyPos.above()).is(Blocks.POWDER_SNOW)) { } return Stray.checkMonsterSpawnRules(type, level, spawnReason, pos, random) && (EntitySpawnReason.isSpawner(spawnReason) || level.canSeeSky(checkSkyPos.below())); } @Override protected SoundEvent getAmbientSound() { return SoundEvents.STRAY_AMBIENT; } @Override protected SoundEvent getHurtSound(DamageSource source) { return SoundEvents.STRAY_HURT; } @Override protected SoundEvent getDeathSound() { return SoundEvents.STRAY_DEATH; } @Override SoundEvent getStepSound() { return SoundEvents.STRAY_STEP; } @Override protected AbstractArrow getArrow(ItemStack projectile, float power, @Nullable ItemStack firingWeapon) { AbstractArrow arrow = super.getArrow(projectile, power, firingWeapon); if (arrow instanceof Arrow) { ((Arrow)arrow).addEffect(new MobEffectInstance(MobEffects.SLOWNESS, 600)); } return arrow; } }