Auditory

Auditory

75.8k Downloads

Auditory Causing Crashes When Paired with Incendium

catter1 opened this issue ยท 7 comments

commented

Hello, I am one of the developers from Stardust Labs. Occasionally, we get reports of crashes in one of our Incendium structures, and we've narrowed down the issue to be with Auditory.

The issue can be manually resolved by disabling ender pearl sounds inside the Auditory config. I should also note that I've seen the same crash before but with fireballs - it has not been tested to my knowledge, but I'm assuming that disabling fireball sounds in the conflict would resolve that issue as well.

Sample user crash logs:

My guess is that this issue happens due to the way Incendium is generating these ender pearls. First, it generates the pearl, then it goes to a different function to redo the pearl summoning, while setting its nbt and playing a custom sound. I should also mention that this is performed as a piglin, and not a player. I don't think Auditory likes that :)

Let me know if you have any other questions.

commented

In what structure is this happining? As I've tried to replicate it in multiple structures of Incendium and I wasn't able to do so.
How do you get a Piglin to throw an Ender Pearl?

On the latest version of Auditory, there should be already a check implemented this.getOwner() instanceof Player player, so only players can hear the Ender Pearl sound.

I've tested this with the 0.0.5 version for 1.19.3 of Auditory and 5.1.4 version of Incendium.

commented

Forbidden Castles. I have not tried it out myself, but I assume it is quite rare, since I only see someone report this once every couple of months or so.

Castle Archers have a 35% chance to use the ender pearl, if: they are near and facing a player, and they have not already used another "move".

commented

Will test this out as soon as I'm able to, thank you!

commented

This also happens (on 1.19.2) when some mobs (creeper, skeleton, drowned...) throw an ender pearl while using the ImprovedMobs mod. Here is my crash log if you need it: https://paste.gg/p/anonymous/d41d94f4888c4bce82c2af0a3bd760ae

commented

I want to try some fixes. How do I get the 1.19.2 version of the repository? There is no branch except 1.19.3.

commented

You can click on the History and see what has changed in the Enderpearl Mixin Code. With the 1.19.3 code I would guess it got already fixed. But the 1.19.2 one looks like this:

package net.sydokiddo.auditory.mixin.items;

import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.entity.projectile.ThrownEnderpearl;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.HitResult;
import net.sydokiddo.auditory.Auditory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

// Plays a sound to the player when they teleport with an Ender Pearl
@@ -31,38 +25,19 @@ public EnderPearlSoundMixin(EntityType<? extends ThrowableItemProjectile> entity
        super(entityType, level);
    }

    @Inject(method = "onHit", at = @At("HEAD"))
    protected void onHit(HitResult hitResult, CallbackInfo ci) {
        if (Auditory.getConfig().item_sounds.ender_pearl_sounds && (!FabricLoader.getInstance().isModLoaded("endlessencore"))) {
            Entity entity = this.getOwner();
            if (entity instanceof ServerPlayer serverPlayer) {
                if (serverPlayer.connection.getConnection().isConnected() && serverPlayer.level == this.level && !serverPlayer.isSleeping()) {
                    if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
                        Endermite endermite = EntityType.ENDERMITE.create(this.level);
                        assert endermite != null;
                        endermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
                        this.level.addFreshEntity(endermite);
                    }
                    if (entity.isPassenger()) {
                        serverPlayer.dismountTo(this.getX(), this.getY(), this.getZ());
                    } else {
                        entity.teleportTo(this.getX(), this.getY(), this.getZ());
                        ((Player) entity).playNotifySound(SoundEvents.CHORUS_FRUIT_TELEPORT, SoundSource.PLAYERS, 0.8f, 1.0f);
                    }
                    entity.resetFallDistance();
                    entity.hurt(DamageSource.FALL, 5.0F);
                }
            } else if (entity != null) {
                entity.teleportTo(this.getX(), this.getY(), this.getZ());
                ((Player) entity).playNotifySound(SoundEvents.CHORUS_FRUIT_TELEPORT, SoundSource.PLAYERS, 0.8f, 1.0f);
                entity.resetFallDistance();
            }
            this.discard();
        }
    }
    @Override
    public Item getDefaultItem() {
        return Items.ENDER_PEARL;
    }
}
commented

Thanks but I need to test this, so I need to whole repository on 1.19.2 version. Actually, I tried to backport to 1.19.2, but a lot of things have changed, and it gave a lot of errors, I will probably turn off ender pearls sounds.