2025-11-24 22:52:51 +03:00

73 lines
2.5 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* org.jspecify.annotations.Nullable
*/
package net.minecraft.world.entity.projectile;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.particles.SpellParticleOption;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.storage.ValueInput;
import net.minecraft.world.level.storage.ValueOutput;
import org.jspecify.annotations.Nullable;
public class SpectralArrow
extends AbstractArrow {
private static final int DEFAULT_DURATION = 200;
private int duration = 200;
public SpectralArrow(EntityType<? extends SpectralArrow> type, Level level) {
super((EntityType<? extends AbstractArrow>)type, level);
}
public SpectralArrow(Level level, LivingEntity owner, ItemStack pickupItemStack, @Nullable ItemStack firedFromWeapon) {
super(EntityType.SPECTRAL_ARROW, owner, level, pickupItemStack, firedFromWeapon);
}
public SpectralArrow(Level level, double x, double y, double z, ItemStack pickupItemStack, @Nullable ItemStack firedFromWeapon) {
super(EntityType.SPECTRAL_ARROW, x, y, z, level, pickupItemStack, firedFromWeapon);
}
@Override
public void tick() {
super.tick();
if (this.level().isClientSide() && !this.isInGround()) {
this.level().addParticle(SpellParticleOption.create(ParticleTypes.EFFECT, -1, 1.0f), this.getX(), this.getY(), this.getZ(), 0.0, 0.0, 0.0);
}
}
@Override
protected void doPostHurtEffects(LivingEntity mob) {
super.doPostHurtEffects(mob);
MobEffectInstance effect = new MobEffectInstance(MobEffects.GLOWING, this.duration, 0);
mob.addEffect(effect, this.getEffectSource());
}
@Override
protected void readAdditionalSaveData(ValueInput input) {
super.readAdditionalSaveData(input);
this.duration = input.getIntOr("Duration", 200);
}
@Override
protected void addAdditionalSaveData(ValueOutput output) {
super.addAdditionalSaveData(output);
output.putInt("Duration", this.duration);
}
@Override
protected ItemStack getDefaultPickupItem() {
return new ItemStack(Items.SPECTRAL_ARROW);
}
}