Atlantis

Atlantis

822k Downloads

[1.17.1] Possible conflict with vanilla water breathing effect

kwpugh opened this issue ยท 10 comments

commented

Hi,

I'm the author of MoreGems and other mods. It was brought to my attention that one of the items in MoreGems that provides vanilla water breathing effect while in inventory was not working. The player also mentioned Atlantis, I tried without Atlantis, then with and discovered the same issue. I then gave myself water breathing by command and it gets negated. Tried breathing potion, same thing.

Looking at your code, I suspect that your mixin into PlayerEntity might be creating the issue.
https://github.com/Exploding-Creeper/atlantis/blob/1d75006d4a08f954a2e30b67e55f448fd7fa0c2e/src/main/java/com/mystic/atlantis/mixin/CanBreatheInDimension.java

I believe that your baseTick override is affecting the normal water breathing effect in vanilla.
If you could take a look into it, I would really appreciate it.

Regards,

Kevin

commented

I got the mixin from another person I myself don't know exactly where in the mixin it is occurring or I would fix it. The mixin is to reverse the breathing underwater and in air. So I may need another mixin or something else idk. This is the 5 - 6 issue about this so. If you can PR a fix that would be great but until then, idk how to fix this. I'm also pinning the issue for future problem about this.

commented

The else clause in the conditional is applying to everywhere other than the Atlantis dimension, so you are breaking vanilla functionality.

    if (world.getRegistryKey() == DimensionAtlantis.ATLANTIS_WORLD) {
        if (this.isAlive() && !this.isSubmergedIn(FluidTags.WATER)) {
            this.setAir(air - 1);
            if (this.getAir() == -20) {
                this.setAir(0);
                this.damage(DamageSource.DROWN, 2.0F);
            }
        } else {
            this.setAir(getNextAirOnLand(air));
        }
    } else {
        if (this.isAlive() && this.isSubmergedIn(FluidTags.WATER)) {
            this.setAir(air - 1);
            if (this.getAir() == -20) {
                this.setAir(0);
                this.damage(DamageSource.DROWN, 2.0F);
            }
        } else {
            this.setAir(getNextAirOnLand(air));
        }
    }

you might think about re-writing this to just inject a check for the dimension and being underwater to give air, and that's it. I really do not have time to re-write your code. If you are unable to fix it, you should put a note on the CurseForge page indicating that it has a known issue of breaking water breathing effect in all dimensions.

commented

ah thank you for finding it, I will fix it as soon as I can. Rn fighting with a modpack of mine and trying to find a website of mine a lost. XD Thanks again.

commented

I will let you know here when it is fixed.

commented

I can confirm this is happening in the 1.16.5 version as well. Cannot even give myself water breathing with commands. Also haste effects are also borked. I assume the same coding was used to make it so the normal slow mining speed underwater would not apply in Atlantis. I hope this is fixed soon, as it stands I may have to remove it, not having access to Haste and Water breathing are deal breakers for me- which would be unfortunate, this looks like a neat mod.

commented

So is the purpose here to reverse the water breathing function when in the water world? Fine in water, suffocate out of water?

commented

If all you want to do is give the player full air while underwater in the Atlantis dimension, you can use this:
`

@mixin(PlayerEntity.class)
public abstract class CanBreatheInDimension extends LivingEntity
{
@shadow protected boolean isSubmergedInWater;

private CanBreatheInDimension(EntityType<? extends LivingEntity> type, World world)
{
    super(type, world);
}

@Inject(method = "tick", at = @At("TAIL"))
public void atlantisTick(CallbackInfo ci)
{
    if (world.getRegistryKey() == DimensionAtlantis.ATLANTIS_WORLD)
    {
        if (this.isAlive() && this.isSubmergedInWater)
        {
            this.setAir(this.getMaxAir());
        }
    }
}

}

`

commented

this will not affect any of the other vanilla functions that the mod is currently breaking

commented

thank sorry I haven't been around to fix it yet, I've been preparing for my third year of college so little busy atm. I will fix it soon just give me some time. :D

commented

Fixed in the latest version? I'm trying to raid a water temple which obviously isn't gonna work if I'm drowning lol