|
| 1 | +package dev.isxander.debugify.mixins.basic.mc221257; |
| 2 | + |
| 3 | +import dev.isxander.debugify.fixes.BugFix; |
| 4 | +import dev.isxander.debugify.fixes.FixCategory; |
| 5 | +import net.minecraft.core.particles.ParticleTypes; |
| 6 | +import net.minecraft.world.entity.EntityType; |
| 7 | +import net.minecraft.world.entity.projectile.Projectile; |
| 8 | +import net.minecraft.world.entity.projectile.ShulkerBullet; |
| 9 | +import net.minecraft.world.level.Level; |
| 10 | +import net.minecraft.world.phys.Vec3; |
| 11 | +import org.spongepowered.asm.mixin.Mixin; |
| 12 | +import org.spongepowered.asm.mixin.injection.At; |
| 13 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 14 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
| 15 | + |
| 16 | +@BugFix(id = "MC-221257", category = FixCategory.BASIC, env = BugFix.Env.SERVER, description = "Shulker bullets don't produce bubble particles when moving through water") |
| 17 | +@Mixin(ShulkerBullet.class) |
| 18 | +public abstract class ShulkerBulletMixin extends Projectile { |
| 19 | + public ShulkerBulletMixin(EntityType<? extends Projectile> entityType, Level level) { |
| 20 | + super(entityType, level); |
| 21 | + } |
| 22 | + |
| 23 | + /** |
| 24 | + * Code taken from {@link net.minecraft.world.entity.projectile.AbstractArrow} |
| 25 | + */ |
| 26 | + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/projectile/ShulkerBullet;setPos(Lnet/minecraft/world/phys/Vec3;)V")) |
| 27 | + private void addMissingBubbleParticles(CallbackInfo ci) { |
| 28 | + if (this.isInWater()) { |
| 29 | + Vec3 vec3 = this.position(); |
| 30 | + Vec3 vec32 = this.getDeltaMovement(); |
| 31 | + |
| 32 | + for (int i = 0; i < 4; ++i) { |
| 33 | + this.level().addParticle(ParticleTypes.BUBBLE, vec3.x - vec32.x * (double) 0.25F, vec3.y - vec32.y * (double) 0.25F, vec3.z - vec32.z * (double) 0.25F, vec32.x, vec32.y, vec32.z); |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | +} |
0 commit comments