public override FluidStack Deserialize(TagCompound tag)
 {
     if (tag.ContainsKey("Fluid"))
     {
         BaseFluid fluid     = tag.Get <BaseFluid>("Fluid");
         int       volume    = tag.GetInt("Volume");
         int       maxVolume = tag.GetInt("MaxVolume");
         return(new FluidStack(fluid, volume, maxVolume));
     }
     else
     {
         int maxVolume = tag.GetInt("MaxVolume");
         return(new FluidStack(null, 0, maxVolume));
     }
 }
Example #2
0
        internal static void RegisterFluid(BaseFluid fluid)
        {
            switch (fluid)
            {
            case Water _:
                fluid.Type = 0;
                break;

            case Lava _:
                fluid.Type = 1;
                break;

            case Honey _:
                fluid.Type = 2;
                break;

            default:
                fluid.Type = NextTypeID++;
                break;
            }

            fluids.Add(fluid);
        }