Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-255811

Level#isRainingAt(BlockPos) always returns false for snowy and frozen biomes, even when it is raining

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • 23w03a
    • 1.19.2, 22w42a, 22w43a, 22w44a, 22w45a, 22w46a, 1.19.3 Pre-release 2, 1.19.3
    • Confirmed
    • Block states
    • Normal
    • Platform

    Description

      The bug

      In frozen biomes, it looks like it's raining in some places and snowing in other places. But where it looks like it's raining, there are some glitches.

      1. Cauldrons catch powder snow instead of water (MC-230678)
      2. No particles when hit block.
      3. No snow layer and ice generating when ticking chunks
      4. Farmland cannot get water
      5. Riptide trident doesn't work (MC-247836)
      6. Zombies still burn in the daytime (MC-233893)
      7. Endermen, snow golems, blazes and striders do not take damage
      8. and so on

      Code analysis

      The reason is because the snowy (Biome.Precipitation.SNOW in the code) biomes can't rain (Level.isRainingAt in the code), but the frozen (Biome.TemperatureModifier.FROZEN) biomes are warm enough to rain at random places.

      Using Mojang mappings, 22w42a: In Level#isRainingAt(BlockPos):

      ...
          public boolean isRainingAt(BlockPos $$0) {
              if (!this.isRaining()) {
                  return false;
              }
              if (!this.canSeeSky($$0)) {
                  return false;
              }
              if (this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, $$0).getY() > $$0.getY()) {
                  return false;
              }
              Biome $$1 = this.getBiome($$0).value();
              return $$1.getPrecipitation() == Biome.Precipitation.RAIN && $$1.warmEnoughToRain($$0);
          }
      ...
      

      We can see that the function only returns true if the biome precipitation is RAIN. Frozen oceans have a biome precipitation of SNOW, so this will always be false for frozen oceans. This return statement should probably be changed to something like

         return ($$1.getPrecipitation() == Biome.Precipitation.RAIN || $$1.getPrecipitation() == Biome.Precipitation.SNOW) && $$1.warmEnoughToRain($$0);
      

      How to reproduce

      1. Create a new flat world with preset string: 
        minecraft:bedrock,5*minecraft:stone;minecraft:frozen_ocean
      2. Run /weather rain
      3. Find a places where it's raining rather than snowing

      Attachments:

      Attachments

        Issue Links

          Activity

            People

              gegy1000 [Mojang] Gegy
              Chixvv Dl
              Votes:
              6 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                CHK: