content: package com.accbdd.complicated_bees.bees.mutation.condition;
  
  import com.accbdd.complicated_bees.bees.gene.enums.EnumHumidity;
  import net.minecraft.core.BlockPos;
  import net.minecraft.nbt.CompoundTag;
  import net.minecraft.nbt.StringTag;
  import net.minecraft.network.chat.Component;
  import net.minecraft.resources.ResourceLocation;
  import net.minecraft.world.level.Level;
  
  import static com.accbdd.complicated_bees.ComplicatedBees.MODID;
  
  public class HumidityCondition extends MutationCondition {
      public static String ID = "humidity";
      EnumHumidity humidityMin;
      EnumHumidity humidityMax;
  
      public HumidityCondition(EnumHumidity humidityMin, EnumHumidity humidityMax) {
          this.humidityMin = humidityMin;
          this.humidityMax = humidityMax;
      }
  
      @Override
      public ResourceLocation getID() {
          return new ResourceLocation(MODID, ID);
      }
  
      @Override
      public boolean check(Level level, BlockPos pos) {
          EnumHumidity checkedHumidity = EnumHumidity.getFromPosition(level, pos);
          return checkedHumidity.ordinal() >= humidityMin.ordinal() && checkedHumidity.ordinal() <= humidityMax.ordinal();
      }
  
      @Override
      public Component getDescription() {
          if (humidityMax.equals(humidityMin))
              return Component.translatable("gui.complicated_bees.mutations.humidity", humidityMin.getTranslationKey());
          else
              return Component.translatable("gui.complicated_bees.mutations.humidity_range", humidityMin.getTranslationKey(), humidityMax.getTranslationKey());
      }
  
      @Override
      public CompoundTag serialize() {
          CompoundTag tag = new CompoundTag();
          tag.put("min", StringTag.valueOf(humidityMin.toString()));
          tag.put("max", StringTag.valueOf(humidityMax.toString()));
          return tag;
      }
  
      @Override
      public HumidityCondition deserialize(CompoundTag tag) {
          return new HumidityCondition(EnumHumidity.getFromString(tag.getString("min")), EnumHumidity.getFromString(tag.getString("max")));
      }
  }
  