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);
}
Aggregations