Search in sources :

Example 1 with McdwBow

use of chronosacaria.mcdw.bases.McdwBow in project MCDungeonsWeapons by chronosacaria.

the class PersistentProjectileEntityMixin method changeParticles.

@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V", ordinal = 0))
private void changeParticles(World world, ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
    ItemStack sourceStack = dataTracker.get(ORIGIN_STACK);
    double d = posContext.x;
    double e = posContext.y;
    double g = posContext.z;
    // Check if the source bow has a preferred particle to display
    if (!sourceStack.isEmpty() && sourceStack.getItem() instanceof McdwBow) {
        McdwBow bow = (McdwBow) sourceStack.getItem();
        ParticleEffect bowParticles = bow.getArrowParticles();
        if (bowParticles != null) {
            this.world.addParticle(bowParticles, this.getX() + d * (double) iteration / 4.0D, this.getY() + e * (double) iteration / 4.0D, this.getZ() + g * (double) iteration / 4.0D, -d, -e + 0.2D, -g);
            return;
        }
    }
    // Display default crit particles
    this.world.addParticle(ParticleTypes.CRIT, this.getX() + d * (double) iteration / 4.0D, this.getY() + e * (double) iteration / 4.0D, this.getZ() + g * (double) iteration / 4.0D, -d, -e + 0.2D, -g);
}
Also used : ParticleEffect(net.minecraft.particle.ParticleEffect) McdwBow(chronosacaria.mcdw.bases.McdwBow) ItemStack(net.minecraft.item.ItemStack) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

McdwBow (chronosacaria.mcdw.bases.McdwBow)1 ItemStack (net.minecraft.item.ItemStack)1 ParticleEffect (net.minecraft.particle.ParticleEffect)1 Redirect (org.spongepowered.asm.mixin.injection.Redirect)1