<commit_before>package crazypants.enderio.base.config.factory;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.enderio.core.common.util.NullHelper;

import io.netty.buffer.ByteBuf;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.LoaderState;

public class FluidValue extends AbstractValue<Fluid> {

  private final static @Nonnull Fluid defaultFluidPlaceholder = new Fluid("", null, null);

  private final @Nonnull String defaultValueName;
  private Fluid defaultFluid = null;

  protected FluidValue(@Nonnull IValueFactory owner, @Nonnull String section, @Nonnull String keyname, @Nonnull String defaultValue, @Nonnull String text) {
    super(owner, section, keyname, defaultFluidPlaceholder, text);
    defaultValueName = defaultValue;
  }

  @Nonnull
  @Override
  public Fluid get() {
    if (!Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) {
      return defaultValue;
    }
    if (defaultFluid == null) {
      FluidRegistry.getFluid(defaultValueName);
    }
    if (value == null || valueGeneration != owner.getGeneration()) {
      if (owner.getServerConfig() != null && owner.getServerConfig().containsKey(keyname)) {
        value = FluidRegistry.getFluid((String) owner.getServerConfig().get(keyname));
      } else {
        value = FluidRegistry.getFluid(getString());
        if (!owner.isInInit() && owner.getConfig().hasChanged()) {
          owner.getConfig().save();<commit_msg>Fix fluid defaults for config values not working<commit_after>package crazypants.enderio.base.config.factory;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.enderio.core.common.util.NullHelper;

import io.netty.buffer.ByteBuf;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.LoaderState;

public class FluidValue extends AbstractValue<Fluid> {

  private final static @Nonnull Fluid defaultFluidPlaceholder = new Fluid("", null, null);

  private final @Nonnull String defaultValueName;
  private Fluid defaultFluid = null;

  protected FluidValue(@Nonnull IValueFactory owner, @Nonnull String section, @Nonnull String keyname, @Nonnull String defaultValue, @Nonnull String text) {
    super(owner, section, keyname, defaultFluidPlaceholder, text);
    defaultValueName = defaultValue;
  }

  @Nonnull
  @Override
  public Fluid get() {
    if (!Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) {
      return defaultValue;
    }
    if (defaultFluid == null) {
      defaultFluid = FluidRegistry.getFluid(defaultValueName);
    }
    if (value == null || valueGeneration != owner.getGeneration()) {
      if (owner.getServerConfig() != null && owner.getServerConfig().containsKey(keyname)) {
        value = FluidRegistry.getFluid((String) owner.getServerConfig().get(keyname));
      } else {
        value = FluidRegistry.getFluid(getString());
        if (!owner.isInInit() && owner.getConfig().hasChanged()) {
          owner.getConfig().save();
{'fraction_non_alphanumeric': 0.1128345498783455, 'fraction_numerical': 0.0, 'mean_word_length': 4.690311418685121, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5566725', 'n_tokens_mistral': 964, 'n_tokens_neox': 963, 'n_words': 205}